Follow the info here:
http://wiki.gp2x.org/wiki/Writing_to_the_framebuffer_device
More information can be figured out from Rlyeh's minilib:
http://www.emulnation.info/retrodev/forum/...topic.php?t=142
if you look at the method "gp2x_video_RGB_flip" what's basically happening here is that he's switching between the two framebuffers, whilst one is stored on the screen another is being written to by you... I believe the last two lines are setting the addresses to blit the bitmap to the screen, although I'm not sure of the significance of mask on the address and the shift on the second line...
To wait for vsync you need to do this: (this is the updated version that works with firmware 2.0):
static volatile unsigned long *gp2x_memregl=(unsigned long *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, gp2x_dev[2], 0xc0000000);
static volatile unsigned short *gp2x_memregs=(unsigned short *)gp2x_memregl;
void gp2x_video_waitvsync(void)
{
while(gp2x_memregs[0x1182>>1]&(1<<4));
while(!(gp2x_memregs[0x1182>>1]&(1<<4)));
}
I don't fully understand it all myself, I'm just trying to figure it all out because I need to steal it for my own simplified code... Rlyeh is the best person to ask, but the wiki needs updating when it can be explained better for definite.