add pandora code from PCSX
[libpicofe.git] / plat.h
1 #ifndef LIBPICOFE_PLAT_H
2 #define LIBPICOFE_PLAT_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 /* target device, everything is optional */
9 struct plat_target {
10         int (*cpu_clock_get)(void);
11         int (*cpu_clock_set)(int clock);
12         int (*get_bat_capacity)(void);
13         void (*set_filter)(int which);
14         char **filters;
15         void (*set_lcdrate)(int is_pal);
16         void (*step_volume)(int is_up);
17 };
18
19 extern struct plat_target plat_target;
20 int  plat_target_init(void);
21 void plat_target_finish(void);
22 void plat_target_setup_input(void);
23
24 static __inline void plat_target_set_filter(int which)
25 {
26         if (plat_target.set_filter)
27                 plat_target.set_filter(which);
28 }
29
30 static __inline void plat_target_set_lcdrate(int is_pal)
31 {
32         if (plat_target.set_lcdrate)
33                 plat_target.set_lcdrate(is_pal);
34 }
35
36 /* menu: enter (switch bpp, etc), begin/end drawing */
37 void plat_video_menu_enter(int is_rom_loaded);
38 void plat_video_menu_begin(void);
39 void plat_video_menu_end(void);
40 void plat_video_menu_leave(void);
41
42 void plat_video_flip(void);
43 void plat_video_wait_vsync(void);
44
45 /* return the dir/ where configs, saves, bios, etc. are found */
46 int  plat_get_root_dir(char *dst, int len);
47
48 int  plat_is_dir(const char *path);
49 int  plat_wait_event(int *fds_hnds, int count, int timeout_ms);
50 void plat_sleep_ms(int ms);
51
52 void *plat_mmap(unsigned long addr, size_t size, int need_exec, int is_fixed);
53 void *plat_mremap(void *ptr, size_t oldsize, size_t newsize);
54 void  plat_munmap(void *ptr, size_t size);
55
56 /* timers, to be used for time diff and must refer to the same clock */
57 unsigned int plat_get_ticks_ms(void);
58 unsigned int plat_get_ticks_us(void);
59 void plat_wait_till_us(unsigned int us);
60
61 void plat_debug_cat(char *str);
62
63 #ifdef __cplusplus
64 } // extern "C"
65 #endif
66
67 #endif /* LIBPICOFE_PLAT_H */