X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=plat.h;h=54436cd671acf2605aa158ed70948afdfa3a44ca;hb=c54d04fd84f59c60c6ecdbd2502fbda5de735b4b;hp=1fb87676b8a4e3abd7f6cd5ff124d47a1e4d55e5;hpb=a86e9a3e58f55bf49d99dfd5e5d6413e17149593;p=libpicofe.git diff --git a/plat.h b/plat.h index 1fb8767..54436cd 100644 --- a/plat.h +++ b/plat.h @@ -1,33 +1,87 @@ +#ifndef LIBPICOFE_PLAT_H +#define LIBPICOFE_PLAT_H + +#include + #ifdef __cplusplus extern "C" { #endif -/* stuff to be implemented by platform code */ -extern const char *renderer_names[]; -extern const char *renderer_names32x[]; +/* target device, everything is optional */ +struct plat_target { + int (*cpu_clock_get)(void); + int (*cpu_clock_set)(int clock); + int (*bat_capacity_get)(void); + int (*hwfilter_set)(int which); + int (*lcdrate_set)(int is_pal); + int (*gamma_set)(int val, int black_level); + int (*step_volume)(int is_up); + const char **vout_methods; + int vout_method; + int vout_fullscreen; + const char **hwfilters; + int hwfilter; +}; -void pemu_prep_defconfig(void); -void pemu_validate_config(void); -void pemu_loop_prep(void); -void pemu_loop_end(void); -void pemu_forced_frame(int no_scale, int do_emu); // ..to g_menubg_src_ptr -void pemu_finalize_frame(const char *fps, const char *notice_msg); +extern struct plat_target plat_target; +int plat_target_init(void); +void plat_target_finish(void); +void plat_target_setup_input(void); -void pemu_sound_start(void); -void pemu_sound_stop(void); -void pemu_sound_wait(void); +/* CPU clock in MHz */ +static __inline int plat_target_cpu_clock_get(void) +{ + if (plat_target.cpu_clock_get) + return plat_target.cpu_clock_get(); + return -1; +} -void plat_early_init(void); -void plat_init(void); -void plat_finish(void); +static __inline int plat_target_cpu_clock_set(int mhz) +{ + if (plat_target.cpu_clock_set) + return plat_target.cpu_clock_set(mhz); + return -1; +} -/* return the dir/ where configs, saves, bios, etc. are found */ -int plat_get_root_dir(char *dst, int len); +/* battery capacity (0-100) */ +static __inline int plat_target_bat_capacity_get(void) +{ + if (plat_target.bat_capacity_get) + return plat_target.bat_capacity_get(); + return -1; +} + +/* set some hardware-specific video filter, 0 for none */ +static __inline int plat_target_hwfilter_set(int which) +{ + if (plat_target.hwfilter_set) + return plat_target.hwfilter_set(which); + return -1; +} -/* used before things blocking for a while (these funcs redraw on return) */ -void plat_status_msg_busy_first(const char *msg); -void plat_status_msg_busy_next(const char *msg); -void plat_status_msg_clear(void); +/* set device LCD rate, is_pal 0 for NTSC, 1 for PAL compatible */ +static __inline int plat_target_lcdrate_set(int is_pal) +{ + if (plat_target.lcdrate_set) + return plat_target.lcdrate_set(is_pal); + return -1; +} + +/* set device LCD rate, is_pal 0 for NTSC, 1 for PAL compatible */ +static __inline int plat_target_gamma_set(int val, int black_level) +{ + if (plat_target.gamma_set) + return plat_target.gamma_set(val, black_level); + return -1; +} + +/* step sound volume up or down */ +static __inline int plat_target_step_volume(int is_up) +{ + if (plat_target.step_volume) + return plat_target.step_volume(is_up); + return -1; +} /* menu: enter (switch bpp, etc), begin/end drawing */ void plat_video_menu_enter(int is_rom_loaded); @@ -37,9 +91,9 @@ void plat_video_menu_leave(void); void plat_video_flip(void); void plat_video_wait_vsync(void); -void plat_video_toggle_renderer(int change, int menu_call); -void plat_update_volume(int has_changed, int is_up); +/* return the dir/ where configs, saves, bios, etc. are found */ +int plat_get_root_dir(char *dst, int len); int plat_is_dir(const char *path); int plat_wait_event(int *fds_hnds, int count, int timeout_ms); @@ -48,6 +102,7 @@ void plat_sleep_ms(int ms); void *plat_mmap(unsigned long addr, size_t size, int need_exec, int is_fixed); void *plat_mremap(void *ptr, size_t oldsize, size_t newsize); void plat_munmap(void *ptr, size_t size); +int plat_mem_set_exec(void *ptr, size_t size); /* timers, to be used for time diff and must refer to the same clock */ unsigned int plat_get_ticks_ms(void); @@ -60,3 +115,4 @@ void plat_debug_cat(char *str); } // extern "C" #endif +#endif /* LIBPICOFE_PLAT_H */