kaka wrote: > Hi Denis, > > Thanks for the reply. > I am writing gfxdriver for directFB library for broadcom chip. > I have also written a frambuffer driver for broadcom chip. Directly for broadcom or at another company? > In directFB code, > > static volatile void * > system_map_mmio( unsigned int offset, > int length ) > { > void *addr; > > if (length <= 0) > length = dfb_fbdev->shared->fix.mmio_len; > > addr = mmap( NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, > dfb_fbdev->fd, dfb_fbdev->shared->fix.smem_len + offset ); > if ((int)(addr) == -1) { > D_PERROR( "DirectFB/FBDev: Could not mmap MMIO region " > "(offset %d, length %d)!\n", offset, length ); > return NULL; > } > > return(volatile void*) ((u8*) addr + (dfb_fbdev->shared->fix.mmio_start& > dfb_fbdev->shared->page_mask)); > } Can you add printfs to show dfb_fbdev->shared->fix.mmio_start, mmio_len, smem_start and smem_len? > the length and offset i am providing as 0 and -1. You mean offset 0 and length -1? > It is throwing me error as Could not mmap MMIO region. > length coming from dfb_fbdev->shared->fix.smem_len is 16,00,000. 1600000 = 1.6MB? > When i change the code to addr = mmap( NULL, 900000, PROT_READ | > PROT_WRITE, MAP_SHARED, dfb_fbdev->fd, dfb_fbdev->shared->fix.smem_len + > offset ); You changed the length to 900000, but you need to use this to map offset 900000: addr = mmap( NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, dfb_fbdev->fd, 900000 ); But it should work if you set smem_len to 900000 in the fb driver. > Then it works fine but it is not allowing me to write to addresses with > offset greater than 900000. Segfault? > My requirement is to write in to the MMIO registers with offset between > 900000 and 16 00 000. What exactly is your frame buffer size and physical MMIO address? You need to put the frame buffer size into smem_len and the physical MMIO address into mmio_start, the length into mmio_len. -- Best regards, Denis Oliver Kropp .------------------------------------------. | DirectFB - Hardware accelerated graphics | | http://www.directfb.org/ | "------------------------------------------"