提交 ef62c1cc 编写于 作者: C Chon 提交者: GitHub

Merge pull request #670 from zhangyang0701/develop

change namespaces
...@@ -29,15 +29,15 @@ limitations under the License. */ ...@@ -29,15 +29,15 @@ limitations under the License. */
#include "fpga/api/fpga_api.h" #include "fpga/api/fpga_api.h"
namespace paddle { namespace paddle_mobile {
namespace mobile {
namespace fpga { namespace fpga {
namespace api {
static int fd = -1; static int fd = -1;
static const char *device_path = "/dev/fpgadrv0"; 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() { int open_device() {
if (fd == -1) { if (fd == -1) {
...@@ -48,8 +48,8 @@ int open_device() { ...@@ -48,8 +48,8 @@ int open_device() {
// memory management; // memory management;
void *fpga_malloc(size_t size) { void *fpga_malloc(size_t size) {
return reinterpret_cast<(void *)> mmap64(NULL, size, PROT_READ | PROT_WRITE, return reinterpret_cast<void *>(
MAP_SHARED, fd, 0); mmap64(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));
} }
void fpga_free(void *ptr) { munmap(ptr, 0); } void fpga_free(void *ptr) { munmap(ptr, 0); }
...@@ -58,11 +58,9 @@ void fpga_copy(void *dest, const void *src, size_t num) { ...@@ -58,11 +58,9 @@ void fpga_copy(void *dest, const void *src, size_t num) {
memcpy(dest, src, num); memcpy(dest, src, num);
} }
int ComputeFpgaConv(struct FpgaConvArgs) {} int ComputeFpgaConv(struct FpgaConvArgs args) {}
int ComputeFpgaPool(struct FpgaPoolArgs) {} int ComputeFpgaPool(struct FpgaPoolArgs args) {}
int ComputeFpgaEWAdd(struct FpgaEWAddArgs) {} int ComputeFpgaEWAdd(struct FpgaEWAddArgs args) {}
} // namespace api
} // namespace fpga } // namespace fpga
} // namespace mobile } // namespace paddle_mobile
} // namespace paddle
...@@ -27,17 +27,17 @@ namespace memory { ...@@ -27,17 +27,17 @@ namespace memory {
const int MALLOC_ALIGN = 64; const int MALLOC_ALIGN = 64;
#ifdef PADDLE_MOBILE_FPGA #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) { void Copy(void *dst, const void *src, size_t num) {
std::memcpy(dst, src, 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) { void Free(void *ptr) {
if (ptr) { if (ptr) {
api::fpga_free(ptr); fpga::fpga_free(ptr);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册