1 #ifndef LIBPICOFE_PLAT_H
2 #define LIBPICOFE_PLAT_H
10 /* target device, everything is optional */
12 int (*cpu_clock_get)(void);
13 int (*cpu_clock_set)(int clock);
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 *volume, int diff);
19 const char **vout_methods;
22 const char **hwfilters;
26 extern struct plat_target plat_target;
27 int plat_target_init(void);
28 void plat_target_finish(void);
29 void plat_target_setup_input(void);
31 /* CPU clock in MHz */
32 static __inline int plat_target_cpu_clock_get(void)
34 if (plat_target.cpu_clock_get)
35 return plat_target.cpu_clock_get();
39 static __inline int plat_target_cpu_clock_set(int mhz)
41 if (plat_target.cpu_clock_set)
42 return plat_target.cpu_clock_set(mhz);
46 /* battery capacity (0-100) */
47 static __inline int plat_target_bat_capacity_get(void)
49 if (plat_target.bat_capacity_get)
50 return plat_target.bat_capacity_get();
54 /* set some hardware-specific video filter, 0 for none */
55 static __inline int plat_target_hwfilter_set(int which)
57 if (plat_target.hwfilter_set)
58 return plat_target.hwfilter_set(which);
62 /* set device LCD rate, is_pal 0 for NTSC, 1 for PAL compatible */
63 static __inline int plat_target_lcdrate_set(int is_pal)
65 if (plat_target.lcdrate_set)
66 return plat_target.lcdrate_set(is_pal);
70 /* set device LCD rate, is_pal 0 for NTSC, 1 for PAL compatible */
71 static __inline int plat_target_gamma_set(int val, int black_level)
73 if (plat_target.gamma_set)
74 return plat_target.gamma_set(val, black_level);
78 /* step sound volume up or down */
79 static __inline int plat_target_step_volume(int *volume, int diff)
81 if (plat_target.step_volume)
82 return plat_target.step_volume(volume, diff);
86 /* menu: enter (switch bpp, etc), begin/end drawing */
87 void plat_video_menu_enter(int is_rom_loaded);
88 void plat_video_menu_begin(void);
89 void plat_video_menu_end(void);
90 void plat_video_menu_leave(void);
92 void plat_video_flip(void);
93 void plat_video_wait_vsync(void);
95 /* return the dir/ where configs, saves, bios, etc. are found */
96 int plat_get_root_dir(char *dst, int len);
98 int plat_is_dir(const char *path);
99 int plat_wait_event(int *fds_hnds, int count, int timeout_ms);
100 void plat_sleep_ms(int ms);
102 void *plat_mmap(unsigned long addr, size_t size, int need_exec, int is_fixed);
103 void *plat_mremap(void *ptr, size_t oldsize, size_t newsize);
104 void plat_munmap(void *ptr, size_t size);
105 int plat_mem_set_exec(void *ptr, size_t size);
107 /* timers, to be used for time diff and must refer to the same clock */
108 unsigned int plat_get_ticks_ms(void);
109 unsigned int plat_get_ticks_us(void);
110 void plat_wait_till_us(unsigned int us);
112 void plat_debug_cat(char *str);
118 #endif /* LIBPICOFE_PLAT_H */