bugfix
[picodrive.git] / platform / pandora / pandora.c
CommitLineData
3a3947cd 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
e163b67f 9#include <linux/fb.h>\r
3a3947cd 10#include <fcntl.h>\r
11#include <errno.h>\r
12\r
e5ab6faf 13#include "../linux/sndout_oss.h"\r
16b0afd0 14#include "../common/arm_linux.h"\r
74f5e726 15#include "../common/emu.h"\r
16#include "pandora.h"\r
3a3947cd 17\r
e5ab6faf 18static int fbdev = -1;\r
3a3947cd 19\r
3bb7bd19 20#define SCREEN_MAP_SIZE (800*480*2)\r
e163b67f 21static void *screen = MAP_FAILED;\r
3a3947cd 22\r
23/* common */\r
74f5e726 24void pnd_init(void)\r
3a3947cd 25{\r
26 printf("entering init()\n"); fflush(stdout);\r
27\r
a7efb231 28 fbdev = open("/dev/fb0", O_RDWR);\r
29 if (fbdev == -1)\r
30 {\r
e5ab6faf 31 perror("open(\"/dev/fb0\")");\r
e163b67f 32 exit(1);\r
33 }\r
34\r
e55f0cbb 35 screen = mmap(0, SCREEN_MAP_SIZE, PROT_WRITE|PROT_READ, MAP_SHARED, fbdev, 0);\r
36 if (screen == MAP_FAILED)\r
37 {\r
e5ab6faf 38 perror("mmap(fbptr)");\r
e55f0cbb 39 exit(1);\r
40 }\r
41 printf("fbptr %p\n", screen);\r
74f5e726 42 g_screen_ptr = screen;\r
3a3947cd 43\r
3a3947cd 44 // snd\r
e5ab6faf 45 sndout_oss_init();\r
3a3947cd 46\r
3a3947cd 47 printf("exitting init()\n"); fflush(stdout);\r
48}\r
49\r
74f5e726 50void pnd_exit(void)\r
3a3947cd 51{\r
e163b67f 52 if (screen != MAP_FAILED)\r
53 munmap(screen, SCREEN_MAP_SIZE);\r
74f5e726 54 if (fbdev >= 0)\r
55 close(fbdev);\r
3a3947cd 56\r
e5ab6faf 57 sndout_oss_exit();\r
3a3947cd 58\r
e55f0cbb 59 printf("all done");\r
3a3947cd 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
74f5e726 74/*\r
3a3947cd 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
e55f0cbb 79void Pause940(int yes) {}\r
80void Reset940(int yes, int bank) {}\r
74f5e726 81*/\r