Commit | Line | Data |
---|---|---|
2d3fa877 | 1 | #ifndef LIBPICOFE_PLAT_H |
2 | #define LIBPICOFE_PLAT_H | |
3 | ||
e22d791c | 4 | #include <stdlib.h> |
5 | ||
24b24674 | 6 | #ifdef __cplusplus |
7 | extern "C" { | |
8 | #endif | |
9 | ||
2d3fa877 | 10 | /* target device, everything is optional */ |
11 | struct plat_target { | |
12 | int (*cpu_clock_get)(void); | |
13 | int (*cpu_clock_set)(int clock); | |
a1b30e1a | 14 | int (*bat_capacity_get)(void); |
15 | int (*hwfilter_set)(int which); | |
16 | int (*lcdrate_set)(int is_pal); | |
17 | int (*gamma_set)(int val, int black_level); | |
7ceadd99 | 18 | int (*step_volume)(int *volume, int diff); |
1bc471eb | 19 | int (*switch_layer)(int which, int enable); |
e81b987f | 20 | const char **vout_methods; |
21 | int vout_method; | |
22 | int vout_fullscreen; | |
23 | const char **hwfilters; | |
24 | int hwfilter; | |
2d3fa877 | 25 | }; |
b5bfb864 | 26 | |
2d3fa877 | 27 | extern struct plat_target plat_target; |
28 | int plat_target_init(void); | |
29 | void plat_target_finish(void); | |
30 | void plat_target_setup_input(void); | |
93c18cb4 | 31 | |
a1b30e1a | 32 | /* CPU clock in MHz */ |
33 | static __inline int plat_target_cpu_clock_get(void) | |
2d3fa877 | 34 | { |
a1b30e1a | 35 | if (plat_target.cpu_clock_get) |
36 | return plat_target.cpu_clock_get(); | |
37 | return -1; | |
2d3fa877 | 38 | } |
d572cbad | 39 | |
a1b30e1a | 40 | static __inline int plat_target_cpu_clock_set(int mhz) |
2d3fa877 | 41 | { |
a1b30e1a | 42 | if (plat_target.cpu_clock_set) |
43 | return plat_target.cpu_clock_set(mhz); | |
44 | return -1; | |
45 | } | |
46 | ||
47 | /* battery capacity (0-100) */ | |
48 | static __inline int plat_target_bat_capacity_get(void) | |
49 | { | |
50 | if (plat_target.bat_capacity_get) | |
51 | return plat_target.bat_capacity_get(); | |
52 | return -1; | |
53 | } | |
54 | ||
55 | /* set some hardware-specific video filter, 0 for none */ | |
56 | static __inline int plat_target_hwfilter_set(int which) | |
57 | { | |
58 | if (plat_target.hwfilter_set) | |
59 | return plat_target.hwfilter_set(which); | |
60 | return -1; | |
61 | } | |
62 | ||
63 | /* set device LCD rate, is_pal 0 for NTSC, 1 for PAL compatible */ | |
64 | static __inline int plat_target_lcdrate_set(int is_pal) | |
65 | { | |
66 | if (plat_target.lcdrate_set) | |
67 | return plat_target.lcdrate_set(is_pal); | |
68 | return -1; | |
69 | } | |
70 | ||
71 | /* set device LCD rate, is_pal 0 for NTSC, 1 for PAL compatible */ | |
72 | static __inline int plat_target_gamma_set(int val, int black_level) | |
73 | { | |
74 | if (plat_target.gamma_set) | |
75 | return plat_target.gamma_set(val, black_level); | |
76 | return -1; | |
77 | } | |
78 | ||
79 | /* step sound volume up or down */ | |
7ceadd99 | 80 | static __inline int plat_target_step_volume(int *volume, int diff) |
a1b30e1a | 81 | { |
82 | if (plat_target.step_volume) | |
7ceadd99 | 83 | return plat_target.step_volume(volume, diff); |
a1b30e1a | 84 | return -1; |
2d3fa877 | 85 | } |
388947f3 | 86 | |
1bc471eb | 87 | /* switch device graphics layers/overlays */ |
88 | static __inline int plat_target_switch_layer(int which, int enable) | |
89 | { | |
90 | if (plat_target.switch_layer) | |
91 | return plat_target.switch_layer(which, enable); | |
92 | return -1; | |
93 | } | |
94 | ||
24b24674 | 95 | /* menu: enter (switch bpp, etc), begin/end drawing */ |
96 | void plat_video_menu_enter(int is_rom_loaded); | |
97 | void plat_video_menu_begin(void); | |
98 | void plat_video_menu_end(void); | |
95a2ec38 | 99 | void plat_video_menu_leave(void); |
24b24674 | 100 | |
b188c2b6 | 101 | void plat_video_flip(void); |
b5bfb864 | 102 | void plat_video_wait_vsync(void); |
b188c2b6 | 103 | |
2d3fa877 | 104 | /* return the dir/ where configs, saves, bios, etc. are found */ |
105 | int plat_get_root_dir(char *dst, int len); | |
fa8d1331 | 106 | |
c52e6628 PC |
107 | /* return the dir/ where skin files are found */ |
108 | int plat_get_skin_dir(char *dst, int len); | |
109 | ||
049a6b3e | 110 | int plat_is_dir(const char *path); |
4ab30ad4 | 111 | int plat_wait_event(int *fds_hnds, int count, int timeout_ms); |
112 | void plat_sleep_ms(int ms); | |
049a6b3e | 113 | |
5e417de5 | 114 | void *plat_mmap(unsigned long addr, size_t size, int need_exec, int is_fixed); |
115 | void *plat_mremap(void *ptr, size_t oldsize, size_t newsize); | |
116 | void plat_munmap(void *ptr, size_t size); | |
6282e17e | 117 | int plat_mem_set_exec(void *ptr, size_t size); |
5e417de5 | 118 | |
8ced8d2b | 119 | /* timers, to be used for time diff and must refer to the same clock */ |
b5bfb864 | 120 | unsigned int plat_get_ticks_ms(void); |
121 | unsigned int plat_get_ticks_us(void); | |
122 | void plat_wait_till_us(unsigned int us); | |
4ab30ad4 | 123 | |
93c18cb4 | 124 | void plat_debug_cat(char *str); |
049a6b3e | 125 | |
24b24674 | 126 | #ifdef __cplusplus |
127 | } // extern "C" | |
128 | #endif | |
129 | ||
2d3fa877 | 130 | #endif /* LIBPICOFE_PLAT_H */ |