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