mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-06 23:28:04 -04:00
32x: drc: mmap dram+rom for direct dereference
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@851 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
5ff8efa9e5
commit
997b2e4ff9
1 changed files with 19 additions and 0 deletions
19
linux/plat.c
19
linux/plat.c
|
@ -4,6 +4,7 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
|
||||||
#include "../common/plat.h"
|
#include "../common/plat.h"
|
||||||
|
|
||||||
|
@ -108,3 +109,21 @@ int plat_wait_event(int *fds_hnds, int count, int timeout_ms)
|
||||||
return ret;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue