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