diff --git a/src/fpga/api/fpga_api.cpp b/src/fpga/api/fpga_api.cpp index a913d6e39cddda97b347c0675717c265dfa89d18..706614e9449eb33e70e261b221d8882a9353ddbf 100644 --- a/src/fpga/api/fpga_api.cpp +++ b/src/fpga/api/fpga_api.cpp @@ -29,15 +29,15 @@ limitations under the License. */ #include "fpga/api/fpga_api.h" -namespace paddle { -namespace mobile { +namespace paddle_mobile { namespace fpga { -namespace api { static int fd = -1; static const char *device_path = "/dev/fpgadrv0"; -static inline int do_ioctl(int req, void *arg) { return ioctl(req, arg); } +static inline int do_ioctl(int req, void *arg) { + return ioctl(req, (long unsigned int)arg); +} int open_device() { if (fd == -1) { @@ -48,8 +48,8 @@ int open_device() { // memory management; void *fpga_malloc(size_t size) { - return reinterpret_cast<(void *)> mmap64(NULL, size, PROT_READ | PROT_WRITE, - MAP_SHARED, fd, 0); + return reinterpret_cast( + mmap64(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)); } void fpga_free(void *ptr) { munmap(ptr, 0); } @@ -58,11 +58,9 @@ void fpga_copy(void *dest, const void *src, size_t num) { memcpy(dest, src, num); } -int ComputeFpgaConv(struct FpgaConvArgs) {} -int ComputeFpgaPool(struct FpgaPoolArgs) {} -int ComputeFpgaEWAdd(struct FpgaEWAddArgs) {} +int ComputeFpgaConv(struct FpgaConvArgs args) {} +int ComputeFpgaPool(struct FpgaPoolArgs args) {} +int ComputeFpgaEWAdd(struct FpgaEWAddArgs args) {} -} // namespace api } // namespace fpga -} // namespace mobile -} // namespace paddle +} // namespace paddle_mobile diff --git a/src/memory/t_malloc.cpp b/src/memory/t_malloc.cpp index 178541953323b6ffd1a3339f8209c2839b37a784..42b8c4551871c58955251d94845ca13576d7735b 100644 --- a/src/memory/t_malloc.cpp +++ b/src/memory/t_malloc.cpp @@ -27,17 +27,17 @@ namespace memory { const int MALLOC_ALIGN = 64; #ifdef PADDLE_MOBILE_FPGA -namespace api = paddle::mobile::fpga::api; +namespace fpga = paddle_mobile::fpga; void Copy(void *dst, const void *src, size_t num) { std::memcpy(dst, src, num); } -void *Alloc(size_t size) { return api::malloc(size); } +void *Alloc(size_t size) { return fpga::fpga_malloc(size); } void Free(void *ptr) { if (ptr) { - api::fpga_free(ptr); + fpga::fpga_free(ptr); } }