From: notaz Date: Sat, 2 Jan 2010 21:03:04 +0000 (+0000) Subject: 32x: drc: mmap dram+rom for direct dereference X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=libpicofe.git;a=commitdiff_plain;h=997b2e4ff9773b32d81bb8e1faa17bb9c379f68b 32x: drc: mmap dram+rom for direct dereference git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@851 be3aeb3a-fb24-0410-a615-afba39da0efa --- diff --git a/linux/plat.c b/linux/plat.c index d777f23..492007c 100644 --- a/linux/plat.c +++ b/linux/plat.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "../common/plat.h" @@ -108,3 +109,21 @@ int plat_wait_event(int *fds_hnds, int count, int timeout_ms) return ret; } +void *plat_mmap(unsigned long addr, size_t size) +{ + void *req, *ret; + req = (void *)addr; + ret = mmap(req, size, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0); + if (ret == MAP_FAILED) + return NULL; + if (ret != req) + printf("warning: mmaped to %p, requested %p\n", ret, req); + + return ret; +} + +void plat_munmap(void *ptr, size_t size) +{ + munmap(ptr, size); +} +