Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Raspberry Pi 2 and 3 #74

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/src/lib/graph/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Buffer::Buffer(const Dimensions& dims) :
fprintf(stderr, "Unable to allocate %d bytes of GPU memory\n", byteCount);
}
_gpuMemoryBase = mem_lock(_gpuMemoryHandle);
_data = (jpfloat_t*)(mapmem(_gpuMemoryBase + GPU_MEM_MAP, byteCount));
_data = (jpfloat_t*)(mapmem(BUS_TO_PHYS(_gpuMemoryBase + GPU_MEM_MAP), byteCount));
#elif defined(USE_EIGEN_GEMM)
_data = (jpfloat_t*)(Eigen::internal::aligned_malloc(byteCount));
#else // TARGET_PI
Expand Down Expand Up @@ -119,7 +119,7 @@ Buffer::Buffer(const Dimensions& dims, jpfloat_t min, jpfloat_t max, int bitsPer
fprintf(stderr, "Unable to allocate %d bytes of GPU memory\n", byteCount);
}
_gpuMemoryBase = mem_lock(_gpuMemoryHandle);
_quantizedData = (char*)(mapmem(_gpuMemoryBase + GPU_MEM_MAP, byteCount));
_quantizedData = (char*)(mapmem(BUS_TO_PHYS(_gpuMemoryBase + GPU_MEM_MAP), byteCount));
#elif defined(USE_EIGEN_GEMM)
_quantizedData = (void*)(Eigen::internal::aligned_malloc(byteCount));
#else // TARGET_PI
Expand Down
4 changes: 2 additions & 2 deletions source/src/lib/pi/mailbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#define MAJOR_NUM 100
#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *)
#define DEVICE_DIRECTORY "/var/lib/jpcnn"
#define DEVICE_PATH "/var/lib/jpcnn/char_dev"
#define DEVICE_DIRECTORY "/dev"
#define DEVICE_PATH DEVICE_DIRECTORY "/vcio"
#define PAGE_SIZE (4*1024)

int g_mailboxHandle = -1;
Expand Down
2 changes: 2 additions & 0 deletions source/src/lib/pi/mailbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,6 @@ unsigned execute_code(unsigned code, unsigned r0, unsigned r1, unsigned r2, unsi
unsigned execute_qpu(unsigned num_qpus, unsigned control, unsigned noflush, unsigned timeout);
unsigned qpu_enable(unsigned enable);

#define BUS_TO_PHYS(x) ((((x)) & ~0xC0000000))

#endif // INCLUDE_MAILBOX_H
2 changes: 1 addition & 1 deletion source/src/lib/pi/qpu_gemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void qpu_cblas_sgemm_fixed(
return;
}
uint32_t gpuMemoryBase = mem_lock(gpuMemoryHandle);
char* armMemoryBase = (char*)(mapmem(gpuMemoryBase + GPU_MEM_MAP, totalByteCount));
char* armMemoryBase = (char*)(mapmem(BUS_TO_PHYS(gpuMemoryBase + GPU_MEM_MAP), totalByteCount));

const size_t messageOffset = 0;
const size_t codeOffset = (messageOffset + messageByteCount);
Expand Down