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 |
3a3947cd |
16 | \r |
e5ab6faf |
17 | static int fbdev = -1;\r |
3a3947cd |
18 | \r |
3bb7bd19 |
19 | #define SCREEN_MAP_SIZE (800*480*2)\r |
e163b67f |
20 | static void *screen = MAP_FAILED;\r |
3a3947cd |
21 | \r |
697746df |
22 | void plat_early_init(void)\r |
23 | {\r |
24 | }\r |
25 | \r |
26 | void plat_init(void)\r |
3a3947cd |
27 | {\r |
28 | printf("entering init()\n"); fflush(stdout);\r |
29 | \r |
a7efb231 |
30 | fbdev = open("/dev/fb0", O_RDWR);\r |
31 | if (fbdev == -1)\r |
32 | {\r |
e5ab6faf |
33 | perror("open(\"/dev/fb0\")");\r |
e163b67f |
34 | exit(1);\r |
35 | }\r |
36 | \r |
e55f0cbb |
37 | screen = mmap(0, SCREEN_MAP_SIZE, PROT_WRITE|PROT_READ, MAP_SHARED, fbdev, 0);\r |
38 | if (screen == MAP_FAILED)\r |
39 | {\r |
e5ab6faf |
40 | perror("mmap(fbptr)");\r |
e55f0cbb |
41 | exit(1);\r |
42 | }\r |
43 | printf("fbptr %p\n", screen);\r |
74f5e726 |
44 | g_screen_ptr = screen;\r |
3a3947cd |
45 | \r |
3a3947cd |
46 | // snd\r |
e5ab6faf |
47 | sndout_oss_init();\r |
3a3947cd |
48 | \r |
3a3947cd |
49 | printf("exitting init()\n"); fflush(stdout);\r |
50 | }\r |
51 | \r |
697746df |
52 | void plat_finish(void)\r |
3a3947cd |
53 | {\r |
e163b67f |
54 | if (screen != MAP_FAILED)\r |
55 | munmap(screen, SCREEN_MAP_SIZE);\r |
74f5e726 |
56 | if (fbdev >= 0)\r |
57 | close(fbdev);\r |
3a3947cd |
58 | \r |
e5ab6faf |
59 | sndout_oss_exit();\r |
3a3947cd |
60 | \r |
e55f0cbb |
61 | printf("all done");\r |
3a3947cd |
62 | }\r |
63 | \r |
64 | /* lprintf */\r |
65 | void lprintf(const char *fmt, ...)\r |
66 | {\r |
67 | va_list vl;\r |
68 | \r |
69 | va_start(vl, fmt);\r |
70 | vprintf(fmt, vl);\r |
71 | va_end(vl);\r |
72 | }\r |
73 | \r |