X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pandora%2Fpandora.c;h=5541c2db68a8a59e17d17b99e5589afb6ece5faf;hb=f6eaae4f09c6abab99692900a31c1df2a06b99af;hp=b72d8b6520e6b34847c1e237845d8275a6552e0e;hpb=b3972d826fe31f82aa3382f80454e5d8ce895705;p=libpicofe.git diff --git a/pandora/pandora.c b/pandora/pandora.c index b72d8b6..5541c2d 100644 --- a/pandora/pandora.c +++ b/pandora/pandora.c @@ -1,204 +1,45 @@ - #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../gp2x/gp2x.h" -#include "../linux/usbjoy.h" #include "../linux/sndout_oss.h" -#include "../common/arm_linux.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) -{ -// 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) -{ -} +#include "../linux/fbdev.h" +#include "../linux/oshide.h" +#include "../common/emu.h" - -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) +void plat_early_init(void) { - memset(gp2x_screen, 0, 800*480*2); } - -unsigned long gp2x_joystick_read(int allow_usb_joy) -{ - unsigned long value = 0; - int i; - - if (allow_usb_joy && num_of_joys > 0) { - // check the usb joy as well.. - usbjoy_update(); - for (i = 0; i < num_of_joys; i++) - value |= usbjoy_check(i); - } - - return value; -} - -// 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) +void plat_init(void) { - UCB1X00_TS_EVENT event; - static int zero_seen = 0; - int retval; - - if (touchdev < 0) return -1; + int ret, w, h; - 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; + oshide_init(); - 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) -{ - 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) - { - perror("open(\"/dev/fb0\")"); + ret = vout_fbdev_init(&w, &h); + if (ret != 0) { + fprintf(stderr, "couldn't init framebuffer\n"); exit(1); } - screen = mmap(0, SCREEN_MAP_SIZE, PROT_WRITE|PROT_READ, MAP_SHARED, fbdev, 0); - if (screen == MAP_FAILED) - { - perror("mmap(fbptr)"); + if (w != g_screen_width || h != g_screen_height) { + fprintf(stderr, "%dx%d not supported\n", w, h); + vout_fbdev_finish(); exit(1); } - printf("fbptr %p\n", screen); - gp2x_screen = screen; // snd sndout_oss_init(); - - /* init usb joys -GnoStiC */ - usbjoy_init(); - - 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); - sndout_oss_exit(); - usbjoy_deinit(); + vout_fbdev_finish(); + oshide_finish(); - printf("all done"); + printf("all done\n"); } /* lprintf */ @@ -211,14 +52,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) {} -