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 is_up);
22 extern struct plat_target plat_target;
23 int plat_target_init(void);
24 void plat_target_finish(void);
25 void plat_target_setup_input(void);
27 /* CPU clock in MHz */
28 static __inline int plat_target_cpu_clock_get(void)
30 if (plat_target.cpu_clock_get)
31 return plat_target.cpu_clock_get();
35 static __inline int plat_target_cpu_clock_set(int mhz)
37 if (plat_target.cpu_clock_set)
38 return plat_target.cpu_clock_set(mhz);
42 /* battery capacity (0-100) */
43 static __inline int plat_target_bat_capacity_get(void)
45 if (plat_target.bat_capacity_get)
46 return plat_target.bat_capacity_get();
50 /* set some hardware-specific video filter, 0 for none */
51 static __inline int plat_target_hwfilter_set(int which)
53 if (plat_target.hwfilter_set)
54 return plat_target.hwfilter_set(which);
58 /* set device LCD rate, is_pal 0 for NTSC, 1 for PAL compatible */
59 static __inline int plat_target_lcdrate_set(int is_pal)
61 if (plat_target.lcdrate_set)
62 return plat_target.lcdrate_set(is_pal);
66 /* set device LCD rate, is_pal 0 for NTSC, 1 for PAL compatible */
67 static __inline int plat_target_gamma_set(int val, int black_level)
69 if (plat_target.gamma_set)
70 return plat_target.gamma_set(val, black_level);
74 /* step sound volume up or down */
75 static __inline int plat_target_step_volume(int is_up)
77 if (plat_target.step_volume)
78 return plat_target.step_volume(is_up);
82 /* menu: enter (switch bpp, etc), begin/end drawing */
83 void plat_video_menu_enter(int is_rom_loaded);
84 void plat_video_menu_begin(void);
85 void plat_video_menu_end(void);
86 void plat_video_menu_leave(void);
88 void plat_video_flip(void);
89 void plat_video_wait_vsync(void);
91 /* return the dir/ where configs, saves, bios, etc. are found */
92 int plat_get_root_dir(char *dst, int len);
94 int plat_is_dir(const char *path);
95 int plat_wait_event(int *fds_hnds, int count, int timeout_ms);
96 void plat_sleep_ms(int ms);
98 void *plat_mmap(unsigned long addr, size_t size, int need_exec, int is_fixed);
99 void *plat_mremap(void *ptr, size_t oldsize, size_t newsize);
100 void plat_munmap(void *ptr, size_t size);
102 /* timers, to be used for time diff and must refer to the same clock */
103 unsigned int plat_get_ticks_ms(void);
104 unsigned int plat_get_ticks_us(void);
105 void plat_wait_till_us(unsigned int us);
107 void plat_debug_cat(char *str);
113 #endif /* LIBPICOFE_PLAT_H */