summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2004-10-23 09:59:53 +0000
committerJens Arnold <amiconn@rockbox.org>2004-10-23 09:59:53 +0000
commit1c841b8c403b5ed9398e20f03c4983c386ceaca9 (patch)
treec661704c03fec3609cd96d2c923ac32e956a0dd3
parent957cffad8d8e51e51d51d5c7e81b40519774d584 (diff)
downloadrockbox-1c841b8c403b5ed9398e20f03c4983c386ceaca9.tar.gz
rockbox-1c841b8c403b5ed9398e20f03c4983c386ceaca9.zip
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
-rw-r--r--apps/plugin.c43
-rw-r--r--apps/plugin.h65
2 files changed, 53 insertions, 55 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index bf71aa11e3..ae698c3432 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -101,6 +101,7 @@ static const struct plugin_api rockbox_api = {
101#else 101#else
102 lcd_putsxy, 102 lcd_putsxy,
103 lcd_puts_style, 103 lcd_puts_style,
104 lcd_puts_scroll_style,
104 lcd_bitmap, 105 lcd_bitmap,
105 lcd_drawline, 106 lcd_drawline,
106 lcd_clearline, 107 lcd_clearline,
@@ -125,6 +126,7 @@ static const struct plugin_api rockbox_api = {
125#endif 126#endif
126 backlight_on, 127 backlight_on,
127 backlight_off, 128 backlight_off,
129 backlight_set_timeout,
128 splash, 130 splash,
129 131
130 /* button */ 132 /* button */
@@ -156,15 +158,18 @@ static const struct plugin_api rockbox_api = {
156 PREFIX(closedir), 158 PREFIX(closedir),
157 PREFIX(readdir), 159 PREFIX(readdir),
158 160
159 /* kernel */ 161 /* kernel/ system */
160 PREFIX(sleep), 162 PREFIX(sleep),
161 yield, 163 yield,
162 usb_screen,
163 &current_tick, 164 &current_tick,
164 default_event_handler, 165 default_event_handler,
166 default_event_handler_ex,
165 create_thread, 167 create_thread,
166 remove_thread, 168 remove_thread,
167 reset_poweroff_timer, 169 reset_poweroff_timer,
170#ifndef SIMULATOR
171 system_memory_guard,
172#endif
168 173
169 /* strings and memory */ 174 /* strings and memory */
170 snprintf, 175 snprintf,
@@ -174,6 +179,7 @@ static const struct plugin_api rockbox_api = {
174 strrchr, 179 strrchr,
175 strcmp, 180 strcmp,
176 strcasecmp, 181 strcasecmp,
182 strncasecmp,
177 memset, 183 memset,
178 memcpy, 184 memcpy,
179#ifndef SIMULATOR 185#ifndef SIMULATOR
@@ -204,6 +210,12 @@ static const struct plugin_api rockbox_api = {
204 mpeg_status, 210 mpeg_status,
205 mpeg_has_changed_track, 211 mpeg_has_changed_track,
206 mpeg_current_track, 212 mpeg_current_track,
213 mpeg_flush_and_reload_tracks,
214 mpeg_get_file_pos,
215 mpeg_get_last_header,
216#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
217 mpeg_set_pitch,
218#endif
207 219
208 /* MAS communication */ 220 /* MAS communication */
209#ifndef SIMULATOR 221#ifndef SIMULATOR
@@ -235,34 +247,21 @@ static const struct plugin_api rockbox_api = {
235 debugf, 247 debugf,
236#endif 248#endif
237 &global_settings, 249 &global_settings,
238 backlight_set_timeout,
239 mp3info, 250 mp3info,
240 count_mp3_frames, 251 count_mp3_frames,
241 create_xing_header, 252 create_xing_header,
253 find_next_frame,
242 battery_level, 254 battery_level,
243 255 battery_level_safe,
244 /* new stuff at the end, sort into place next time
245 the API gets incompatible */
246
247#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F) 256#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
248 mpeg_set_pitch,
249
250 peak_meter_scale_value, 257 peak_meter_scale_value,
251 peak_meter_set_use_dbfs, 258 peak_meter_set_use_dbfs,
252 peak_meter_get_use_dbfs, 259 peak_meter_get_use_dbfs,
253#endif 260#endif
254#ifdef HAVE_LCD_BITMAP 261
255 lcd_puts_scroll_style, 262 /* new stuff at the end, sort into place next time
256#endif 263 the API gets incompatible */
257 mpeg_flush_and_reload_tracks, 264
258 strncasecmp,
259 mpeg_get_file_pos,
260 find_next_frame,
261 mpeg_get_last_header,
262#ifndef SIMULATOR
263 system_memory_guard,
264#endif
265 default_event_handler_ex,
266}; 265};
267 266
268int plugin_load(const char* plugin, void* parameter) 267int plugin_load(const char* plugin, void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index 96c4f6fe55..89b9d290d5 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -60,12 +60,12 @@
60#endif 60#endif
61 61
62/* increase this every time the api struct changes */ 62/* increase this every time the api struct changes */
63#define PLUGIN_API_VERSION 28 63#define PLUGIN_API_VERSION 29
64 64
65/* update this to latest version if a change to the api struct breaks 65/* update this to latest version if a change to the api struct breaks
66 backwards compatibility (and please take the opportunity to sort in any 66 backwards compatibility (and please take the opportunity to sort in any
67 new function which are "waiting" at the end of the function table) */ 67 new function which are "waiting" at the end of the function table) */
68#define PLUGIN_MIN_API_VERSION 25 68#define PLUGIN_MIN_API_VERSION 29
69 69
70/* plugin return codes */ 70/* plugin return codes */
71enum plugin_status { 71enum plugin_status {
@@ -126,6 +126,8 @@ struct plugin_api {
126#else 126#else
127 void (*lcd_putsxy)(int x, int y, const unsigned char *string); 127 void (*lcd_putsxy)(int x, int y, const unsigned char *string);
128 void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style); 128 void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style);
129 void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string,
130 int style);
129 void (*lcd_bitmap)(const unsigned char *src, int x, int y, 131 void (*lcd_bitmap)(const unsigned char *src, int x, int y,
130 int nx, int ny, bool clear); 132 int nx, int ny, bool clear);
131 void (*lcd_drawline)(int x1, int y1, int x2, int y2); 133 void (*lcd_drawline)(int x1, int y1, int x2, int y2);
@@ -153,6 +155,7 @@ struct plugin_api {
153#endif 155#endif
154 void (*backlight_on)(void); 156 void (*backlight_on)(void);
155 void (*backlight_off)(void); 157 void (*backlight_off)(void);
158 void (*backlight_set_timeout)(int index);
156 void (*splash)(int ticks, bool center, const char *fmt, ...); 159 void (*splash)(int ticks, bool center, const char *fmt, ...);
157 160
158 /* button */ 161 /* button */
@@ -184,26 +187,30 @@ struct plugin_api {
184 int (*closedir)(DIR* dir); 187 int (*closedir)(DIR* dir);
185 struct dirent* (*readdir)(DIR* dir); 188 struct dirent* (*readdir)(DIR* dir);
186 189
187 /* kernel */ 190 /* kernel/ system */
188 void (*sleep)(int ticks); 191 void (*sleep)(int ticks);
189 void (*yield)(void); 192 void (*yield)(void);
190 void (*usb_screen)(void);
191 long* current_tick; 193 long* current_tick;
192 int (*default_event_handler)(int event); 194 int (*default_event_handler)(int event);
195 int (*default_event_handler_ex)(int event, void (*callback)(void *), void *parameter);
193 int (*create_thread)(void* function, void* stack, int stack_size, const char *name); 196 int (*create_thread)(void* function, void* stack, int stack_size, const char *name);
194 void (*remove_thread)(int threadnum); 197 void (*remove_thread)(int threadnum);
195 void (*reset_poweroff_timer)(void); 198 void (*reset_poweroff_timer)(void);
199#ifndef SIMULATOR
200 int (*system_memory_guard)(int newmode);
201#endif
196 202
197 /* strings and memory */ 203 /* strings and memory */
198 int (*snprintf)(char *buf, size_t size, const char *fmt, ...); 204 int (*snprintf)(char *buf, size_t size, const char *fmt, ...);
199 char* (*strcpy)(char *dst, const char *src); 205 char* (*strcpy)(char *dst, const char *src);
200 char *(*strncpy)(char *dst, const char *src, size_t length); 206 char* (*strncpy)(char *dst, const char *src, size_t length);
201 size_t (*strlen)(const char *str); 207 size_t (*strlen)(const char *str);
202 char * (*strrchr)(const char *s, int c); 208 char * (*strrchr)(const char *s, int c);
203 int (*strcmp)(const char *, const char *); 209 int (*strcmp)(const char *, const char *);
204 int (*strcasecmp)(const char *, const char *); 210 int (*strcasecmp)(const char *, const char *);
205 void* (*memset)(void *dst, int c, size_t length); 211 int (*strncasecmp)(const char *s1, const char *s2, size_t n);
206 void* (*memcpy)(void *out, const void *in, size_t n); 212 void* (*memset)(void *dst, int c, size_t length);
213 void* (*memcpy)(void *out, const void *in, size_t n);
207#ifndef SIMULATOR 214#ifndef SIMULATOR
208 const char *_ctype_; 215 const char *_ctype_;
209#endif 216#endif
@@ -232,6 +239,12 @@ struct plugin_api {
232 int (*mpeg_status)(void); 239 int (*mpeg_status)(void);
233 bool (*mpeg_has_changed_track)(void); 240 bool (*mpeg_has_changed_track)(void);
234 struct mp3entry* (*mpeg_current_track)(void); 241 struct mp3entry* (*mpeg_current_track)(void);
242 void (*mpeg_flush_and_reload_tracks)(void);
243 int (*mpeg_get_file_pos)(void);
244 unsigned long (*mpeg_get_last_header)(void);
245#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
246 void (*mpeg_set_pitch)(int pitch);
247#endif
235 248
236 /* MAS communication */ 249 /* MAS communication */
237#ifndef SIMULATOR 250#ifndef SIMULATOR
@@ -244,7 +257,7 @@ struct plugin_api {
244 int (*mas_codec_readreg)(int reg); 257 int (*mas_codec_readreg)(int reg);
245#endif 258#endif
246#endif 259#endif
247 260
248 /* misc */ 261 /* misc */
249 void (*srand)(unsigned int seed); 262 void (*srand)(unsigned int seed);
250 int (*rand)(void); 263 int (*rand)(void);
@@ -264,7 +277,6 @@ struct plugin_api {
264 void (*debugf)(const char *fmt, ...); 277 void (*debugf)(const char *fmt, ...);
265#endif 278#endif
266 struct user_settings* global_settings; 279 struct user_settings* global_settings;
267 void (*backlight_set_timeout)(int index);
268 bool (*mp3info)(struct mp3entry *entry, const char *filename, bool v1first); 280 bool (*mp3info)(struct mp3entry *entry, const char *filename, bool v1first);
269 int (*count_mp3_frames)(int fd, int startpos, int filesize, 281 int (*count_mp3_frames)(int fd, int startpos, int filesize,
270 void (*progressfunc)(int)); 282 void (*progressfunc)(int));
@@ -272,33 +284,20 @@ struct plugin_api {
272 unsigned char *buf, int num_frames, 284 unsigned char *buf, int num_frames,
273 unsigned long header_template, 285 unsigned long header_template,
274 void (*progressfunc)(int), bool generate_toc); 286 void (*progressfunc)(int), bool generate_toc);
275 int (*battery_level)(void); 287 unsigned long (*find_next_frame)(int fd, int *offset,
276 288 int max_offset, unsigned long last_header);
277 /* new stuff at the end, sort into place next time 289 int (*battery_level)(void);
278 the API gets incompatible */ 290 bool (*battery_level_safe)(void);
279
280#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F) 291#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
281 void (*mpeg_set_pitch)(int pitch);
282
283 unsigned short (*peak_meter_scale_value)(unsigned short val, 292 unsigned short (*peak_meter_scale_value)(unsigned short val,
284 int meterwidth); 293 int meterwidth);
285 void (*peak_meter_set_use_dbfs)(int use); 294 void (*peak_meter_set_use_dbfs)(int use);
286 int (*peak_meter_get_use_dbfs)(void); 295 int (*peak_meter_get_use_dbfs)(void);
287#endif
288#ifdef HAVE_LCD_BITMAP
289 void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string,
290 int style);
291#endif
292 void (*mpeg_flush_and_reload_tracks)(void);
293 int (*strncasecmp)(const char *s1, const char *s2, size_t n);
294 int (*mpeg_get_file_pos)(void);
295 unsigned long (*find_next_frame)(int fd, int *offset,
296 int max_offset, unsigned long last_header);
297 unsigned long (*mpeg_get_last_header)(void);
298#ifndef SIMULATOR
299 int (*system_memory_guard)(int newmode);
300#endif 296#endif
301 int (*default_event_handler_ex)(int event, void (*callback)(void *), void *parameter); 297
298 /* new stuff at the end, sort into place next time
299 the API gets incompatible */
300
302}; 301};
303 302
304/* defined by the plugin loader (plugin.c) */ 303/* defined by the plugin loader (plugin.c) */