X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pandora%2Fpandora.c;h=92047c289ca0e1062e9408b81c18481c46a76d08;hb=d2f29611d1379a249c8f3f955ed16a336f9290cd;hp=6c33e6ccd7594090a514ba1b1d4b262feec5aedf;hpb=fce20e73e7094060b29f1668b8f0032f75eb152e;p=libpicofe.git diff --git a/pandora/pandora.c b/pandora/pandora.c index 6c33e6c..92047c2 100644 --- a/pandora/pandora.c +++ b/pandora/pandora.c @@ -1,4 +1,3 @@ - #include #include #include @@ -11,139 +10,23 @@ #include #include -#include "../gp2x/gp2x.h" #include "../linux/sndout_oss.h" #include "../common/arm_linux.h" +#include "../common/emu.h" -static volatile unsigned int *memregs = MAP_FAILED; -//static -int memdev = 0; static int fbdev = -1; #define SCREEN_MAP_SIZE (800*480*2) static void *screen = MAP_FAILED; -void *gp2x_screen; - - -/* video stuff */ -void gp2x_video_flip(void) -{ -} - -/* doulblebuffered flip */ -void gp2x_video_flip2(void) -{ -} - - -void gp2x_video_changemode2(int bpp) -{ -} - - -void gp2x_video_changemode(int bpp) -{ -} - -void gp2x_video_setpalette(int *pal, int len) -{ -} - - -void gp2x_video_RGB_setscaling(int ln_offs, int W, int H) -{ -} - - -void gp2x_video_wait_vsync(void) -{ -} - -void gp2x_video_flush_cache(void) +void plat_early_init(void) { -// cache_flush_d_inval_i(gp2x_screen, (char *)gp2x_screen + 320*240*2, 0); } -void gp2x_memcpy_buffers(int buffers, void *data, int offset, int len) -{ -} - - -void gp2x_memcpy_all_buffers(void *data, int offset, int len) -{ -} - - -void gp2x_memset_all_buffers(int offset, int byte, int len) -{ - memset((char *)gp2x_screen + offset, byte, len); -} - - -void gp2x_pd_clone_buffer2(void) -{ - memset(gp2x_screen, 0, 800*480*2); -} - -// FIXME -#if 0 -static int touchcal[7] = { 6203, 0, -1501397, 0, -4200, 16132680, 65536 }; - -typedef struct ucb1x00_ts_event -{ - unsigned short pressure; - unsigned short x; - unsigned short y; - unsigned short pad; - struct timeval stamp; -} UCB1X00_TS_EVENT; - -int gp2x_touchpad_read(int *x, int *y) -{ - UCB1X00_TS_EVENT event; - static int zero_seen = 0; - int retval; - - if (touchdev < 0) return -1; - - retval = read(touchdev, &event, sizeof(event)); - if (retval <= 0) { - printf("touch read failed %i %i\n", retval, errno); - return -1; - } - // this is to ignore the messed-up 4.1.x driver - if (event.pressure == 0) zero_seen = 1; - - if (x) *x = (event.x * touchcal[0] + touchcal[2]) >> 16; - if (y) *y = (event.y * touchcal[4] + touchcal[5]) >> 16; - // printf("read %i %i %i\n", event.pressure, *x, *y); - - return zero_seen ? event.pressure : 0; -} -#else -int gp2x_touchpad_read(int *x, int *y) { return -1; } -#endif - -/* common */ -void gp2x_init(void) +void plat_init(void) { printf("entering init()\n"); fflush(stdout); - memdev = open("/dev/mem", O_RDWR); - if (memdev == -1) - { - perror("open(\"/dev/mem\")"); - exit(1); - } -/* - memregs = mmap(0, 0x01000000, PROT_READ|PROT_WRITE, MAP_SHARED, memdev, 0x48000000); - if (memregs == MAP_FAILED) - { - printf("mmap(memregs) failed with %i\n", errno); - exit(1); - } -*/ fbdev = open("/dev/fb0", O_RDWR); if (fbdev == -1) { @@ -158,7 +41,7 @@ void gp2x_init(void) exit(1); } printf("fbptr %p\n", screen); - gp2x_screen = screen; + g_screen_ptr = screen; // snd sndout_oss_init(); @@ -166,14 +49,12 @@ void gp2x_init(void) printf("exitting init()\n"); fflush(stdout); } -void gp2x_deinit(void) +void plat_finish(void) { if (screen != MAP_FAILED) munmap(screen, SCREEN_MAP_SIZE); - if (memregs != MAP_FAILED) - munmap((void *)memregs, 0x10000); - close(memdev); - if (fbdev >= 0) close(fbdev); + if (fbdev >= 0) + close(fbdev); sndout_oss_exit(); @@ -190,14 +71,3 @@ void lprintf(const char *fmt, ...) va_end(vl); } - -/* fake GP2X */ -int crashed_940 = 0; - -void set_gamma(int g100, int A_SNs_curve) {} -void set_FCLK(unsigned MHZ) {} -void set_LCD_custom_rate(int rate) {} -void unset_LCD_custom_rate(void) {} -void Pause940(int yes) {} -void Reset940(int yes, int bank) {} -