Hi,
I have implemented a resource manager for a device with the basic functions (open, close, etc) and io_mmap(). The problem is that when i issue an mmap() call the return value say “Not supported”. However I can map the physical memory using mmap_device_memory() instead. This is how my code looks like in main()
/* Register mmap() handler function */
io_funcs.mmap = io_mmap;
the function handler is declared as follows
int io_mmap(resmgr_context_t *ctp, io_mmap_t *msg, RESMGR_OCB_T *ocb);
I am using the following code to call the resource manager after open()
BT_UINT memorySize = 0x10000;
lpbase[cardnum] = (BT_U16BIT*) mmap((void*)0, memorySize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if(lpbase[cardnum] == (BT_U16BIT*) -1) {
perror(“mmap() failed”);
close(fd);
return NULL;
}
Please could somebody tell me what i’m doing wrong.
//collin