1
0
Fork 0
forked from len0rd/rockbox

Removed usb_screen() from the api. All plugins should use the default event handlers instead. Added battery_level_safe(). Sorted api & bumped versions.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5328 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2004-10-23 09:59:53 +00:00
parent 957cffad8d
commit 1c841b8c40
2 changed files with 54 additions and 56 deletions

View file

@ -101,6 +101,7 @@ static const struct plugin_api rockbox_api = {
#else #else
lcd_putsxy, lcd_putsxy,
lcd_puts_style, lcd_puts_style,
lcd_puts_scroll_style,
lcd_bitmap, lcd_bitmap,
lcd_drawline, lcd_drawline,
lcd_clearline, lcd_clearline,
@ -125,6 +126,7 @@ static const struct plugin_api rockbox_api = {
#endif #endif
backlight_on, backlight_on,
backlight_off, backlight_off,
backlight_set_timeout,
splash, splash,
/* button */ /* button */
@ -156,15 +158,18 @@ static const struct plugin_api rockbox_api = {
PREFIX(closedir), PREFIX(closedir),
PREFIX(readdir), PREFIX(readdir),
/* kernel */ /* kernel/ system */
PREFIX(sleep), PREFIX(sleep),
yield, yield,
usb_screen,
&current_tick, &current_tick,
default_event_handler, default_event_handler,
default_event_handler_ex,
create_thread, create_thread,
remove_thread, remove_thread,
reset_poweroff_timer, reset_poweroff_timer,
#ifndef SIMULATOR
system_memory_guard,
#endif
/* strings and memory */ /* strings and memory */
snprintf, snprintf,
@ -174,6 +179,7 @@ static const struct plugin_api rockbox_api = {
strrchr, strrchr,
strcmp, strcmp,
strcasecmp, strcasecmp,
strncasecmp,
memset, memset,
memcpy, memcpy,
#ifndef SIMULATOR #ifndef SIMULATOR
@ -204,6 +210,12 @@ static const struct plugin_api rockbox_api = {
mpeg_status, mpeg_status,
mpeg_has_changed_track, mpeg_has_changed_track,
mpeg_current_track, mpeg_current_track,
mpeg_flush_and_reload_tracks,
mpeg_get_file_pos,
mpeg_get_last_header,
#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
mpeg_set_pitch,
#endif
/* MAS communication */ /* MAS communication */
#ifndef SIMULATOR #ifndef SIMULATOR
@ -235,34 +247,21 @@ static const struct plugin_api rockbox_api = {
debugf, debugf,
#endif #endif
&global_settings, &global_settings,
backlight_set_timeout,
mp3info, mp3info,
count_mp3_frames, count_mp3_frames,
create_xing_header, create_xing_header,
find_next_frame,
battery_level, battery_level,
battery_level_safe,
#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
peak_meter_scale_value,
peak_meter_set_use_dbfs,
peak_meter_get_use_dbfs,
#endif
/* new stuff at the end, sort into place next time /* new stuff at the end, sort into place next time
the API gets incompatible */ the API gets incompatible */
#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
mpeg_set_pitch,
peak_meter_scale_value,
peak_meter_set_use_dbfs,
peak_meter_get_use_dbfs,
#endif
#ifdef HAVE_LCD_BITMAP
lcd_puts_scroll_style,
#endif
mpeg_flush_and_reload_tracks,
strncasecmp,
mpeg_get_file_pos,
find_next_frame,
mpeg_get_last_header,
#ifndef SIMULATOR
system_memory_guard,
#endif
default_event_handler_ex,
}; };
int plugin_load(const char* plugin, void* parameter) int plugin_load(const char* plugin, void* parameter)

View file

@ -60,12 +60,12 @@
#endif #endif
/* increase this every time the api struct changes */ /* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 28 #define PLUGIN_API_VERSION 29
/* update this to latest version if a change to the api struct breaks /* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */ new function which are "waiting" at the end of the function table) */
#define PLUGIN_MIN_API_VERSION 25 #define PLUGIN_MIN_API_VERSION 29
/* plugin return codes */ /* plugin return codes */
enum plugin_status { enum plugin_status {
@ -126,6 +126,8 @@ struct plugin_api {
#else #else
void (*lcd_putsxy)(int x, int y, const unsigned char *string); void (*lcd_putsxy)(int x, int y, const unsigned char *string);
void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style); void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style);
void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string,
int style);
void (*lcd_bitmap)(const unsigned char *src, int x, int y, void (*lcd_bitmap)(const unsigned char *src, int x, int y,
int nx, int ny, bool clear); int nx, int ny, bool clear);
void (*lcd_drawline)(int x1, int y1, int x2, int y2); void (*lcd_drawline)(int x1, int y1, int x2, int y2);
@ -153,6 +155,7 @@ struct plugin_api {
#endif #endif
void (*backlight_on)(void); void (*backlight_on)(void);
void (*backlight_off)(void); void (*backlight_off)(void);
void (*backlight_set_timeout)(int index);
void (*splash)(int ticks, bool center, const char *fmt, ...); void (*splash)(int ticks, bool center, const char *fmt, ...);
/* button */ /* button */
@ -184,26 +187,30 @@ struct plugin_api {
int (*closedir)(DIR* dir); int (*closedir)(DIR* dir);
struct dirent* (*readdir)(DIR* dir); struct dirent* (*readdir)(DIR* dir);
/* kernel */ /* kernel/ system */
void (*sleep)(int ticks); void (*sleep)(int ticks);
void (*yield)(void); void (*yield)(void);
void (*usb_screen)(void);
long* current_tick; long* current_tick;
int (*default_event_handler)(int event); int (*default_event_handler)(int event);
int (*default_event_handler_ex)(int event, void (*callback)(void *), void *parameter);
int (*create_thread)(void* function, void* stack, int stack_size, const char *name); int (*create_thread)(void* function, void* stack, int stack_size, const char *name);
void (*remove_thread)(int threadnum); void (*remove_thread)(int threadnum);
void (*reset_poweroff_timer)(void); void (*reset_poweroff_timer)(void);
#ifndef SIMULATOR
int (*system_memory_guard)(int newmode);
#endif
/* strings and memory */ /* strings and memory */
int (*snprintf)(char *buf, size_t size, const char *fmt, ...); int (*snprintf)(char *buf, size_t size, const char *fmt, ...);
char* (*strcpy)(char *dst, const char *src); char* (*strcpy)(char *dst, const char *src);
char *(*strncpy)(char *dst, const char *src, size_t length); char* (*strncpy)(char *dst, const char *src, size_t length);
size_t (*strlen)(const char *str); size_t (*strlen)(const char *str);
char * (*strrchr)(const char *s, int c); char * (*strrchr)(const char *s, int c);
int (*strcmp)(const char *, const char *); int (*strcmp)(const char *, const char *);
int (*strcasecmp)(const char *, const char *); int (*strcasecmp)(const char *, const char *);
void* (*memset)(void *dst, int c, size_t length); int (*strncasecmp)(const char *s1, const char *s2, size_t n);
void* (*memcpy)(void *out, const void *in, size_t n); void* (*memset)(void *dst, int c, size_t length);
void* (*memcpy)(void *out, const void *in, size_t n);
#ifndef SIMULATOR #ifndef SIMULATOR
const char *_ctype_; const char *_ctype_;
#endif #endif
@ -232,6 +239,12 @@ struct plugin_api {
int (*mpeg_status)(void); int (*mpeg_status)(void);
bool (*mpeg_has_changed_track)(void); bool (*mpeg_has_changed_track)(void);
struct mp3entry* (*mpeg_current_track)(void); struct mp3entry* (*mpeg_current_track)(void);
void (*mpeg_flush_and_reload_tracks)(void);
int (*mpeg_get_file_pos)(void);
unsigned long (*mpeg_get_last_header)(void);
#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
void (*mpeg_set_pitch)(int pitch);
#endif
/* MAS communication */ /* MAS communication */
#ifndef SIMULATOR #ifndef SIMULATOR
@ -244,7 +257,7 @@ struct plugin_api {
int (*mas_codec_readreg)(int reg); int (*mas_codec_readreg)(int reg);
#endif #endif
#endif #endif
/* misc */ /* misc */
void (*srand)(unsigned int seed); void (*srand)(unsigned int seed);
int (*rand)(void); int (*rand)(void);
@ -264,7 +277,6 @@ struct plugin_api {
void (*debugf)(const char *fmt, ...); void (*debugf)(const char *fmt, ...);
#endif #endif
struct user_settings* global_settings; struct user_settings* global_settings;
void (*backlight_set_timeout)(int index);
bool (*mp3info)(struct mp3entry *entry, const char *filename, bool v1first); bool (*mp3info)(struct mp3entry *entry, const char *filename, bool v1first);
int (*count_mp3_frames)(int fd, int startpos, int filesize, int (*count_mp3_frames)(int fd, int startpos, int filesize,
void (*progressfunc)(int)); void (*progressfunc)(int));
@ -272,33 +284,20 @@ struct plugin_api {
unsigned char *buf, int num_frames, unsigned char *buf, int num_frames,
unsigned long header_template, unsigned long header_template,
void (*progressfunc)(int), bool generate_toc); void (*progressfunc)(int), bool generate_toc);
int (*battery_level)(void); unsigned long (*find_next_frame)(int fd, int *offset,
int max_offset, unsigned long last_header);
int (*battery_level)(void);
bool (*battery_level_safe)(void);
#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
unsigned short (*peak_meter_scale_value)(unsigned short val,
int meterwidth);
void (*peak_meter_set_use_dbfs)(int use);
int (*peak_meter_get_use_dbfs)(void);
#endif
/* new stuff at the end, sort into place next time /* new stuff at the end, sort into place next time
the API gets incompatible */ the API gets incompatible */
#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
void (*mpeg_set_pitch)(int pitch);
unsigned short (*peak_meter_scale_value)(unsigned short val,
int meterwidth);
void (*peak_meter_set_use_dbfs)(int use);
int (*peak_meter_get_use_dbfs)(void);
#endif
#ifdef HAVE_LCD_BITMAP
void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string,
int style);
#endif
void (*mpeg_flush_and_reload_tracks)(void);
int (*strncasecmp)(const char *s1, const char *s2, size_t n);
int (*mpeg_get_file_pos)(void);
unsigned long (*find_next_frame)(int fd, int *offset,
int max_offset, unsigned long last_header);
unsigned long (*mpeg_get_last_header)(void);
#ifndef SIMULATOR
int (*system_memory_guard)(int newmode);
#endif
int (*default_event_handler_ex)(int event, void (*callback)(void *), void *parameter);
}; };
/* defined by the plugin loader (plugin.c) */ /* defined by the plugin loader (plugin.c) */