sram bugfix + savestate refactoring
[picodrive.git] / platform / pandora / pandora.c
... / ...
CommitLineData
1#include <stdio.h>\r
2#include <stdlib.h>\r
3#include <stdarg.h>\r
4#include <string.h>\r
5#include <unistd.h>\r
6#include <sys/mman.h>\r
7#include <sys/types.h>\r
8#include <sys/stat.h>\r
9#include <linux/fb.h>\r
10#include <fcntl.h>\r
11#include <errno.h>\r
12\r
13#include "../linux/sndout_oss.h"\r
14#include "../common/arm_linux.h"\r
15#include "../common/emu.h"\r
16#include "pandora.h"\r
17\r
18static int fbdev = -1;\r
19\r
20#define SCREEN_MAP_SIZE (800*480*2)\r
21static void *screen = MAP_FAILED;\r
22\r
23/* common */\r
24void pnd_init(void)\r
25{\r
26 printf("entering init()\n"); fflush(stdout);\r
27\r
28 fbdev = open("/dev/fb0", O_RDWR);\r
29 if (fbdev == -1)\r
30 {\r
31 perror("open(\"/dev/fb0\")");\r
32 exit(1);\r
33 }\r
34\r
35 screen = mmap(0, SCREEN_MAP_SIZE, PROT_WRITE|PROT_READ, MAP_SHARED, fbdev, 0);\r
36 if (screen == MAP_FAILED)\r
37 {\r
38 perror("mmap(fbptr)");\r
39 exit(1);\r
40 }\r
41 printf("fbptr %p\n", screen);\r
42 g_screen_ptr = screen;\r
43\r
44 // snd\r
45 sndout_oss_init();\r
46\r
47 printf("exitting init()\n"); fflush(stdout);\r
48}\r
49\r
50void pnd_exit(void)\r
51{\r
52 if (screen != MAP_FAILED)\r
53 munmap(screen, SCREEN_MAP_SIZE);\r
54 if (fbdev >= 0)\r
55 close(fbdev);\r
56\r
57 sndout_oss_exit();\r
58\r
59 printf("all done");\r
60}\r
61\r
62/* lprintf */\r
63void lprintf(const char *fmt, ...)\r
64{\r
65 va_list vl;\r
66\r
67 va_start(vl, fmt);\r
68 vprintf(fmt, vl);\r
69 va_end(vl);\r
70}\r
71\r
72\r
73/* fake GP2X */\r
74/*\r
75void set_gamma(int g100, int A_SNs_curve) {}\r
76void set_FCLK(unsigned MHZ) {}\r
77void set_LCD_custom_rate(int rate) {}\r
78void unset_LCD_custom_rate(void) {}\r
79void Pause940(int yes) {}\r
80void Reset940(int yes, int bank) {}\r
81*/\r