diff options
author | Miika Pekkarinen <miipekk@ihme.org> | 2006-09-16 16:18:11 +0000 |
---|---|---|
committer | Miika Pekkarinen <miipekk@ihme.org> | 2006-09-16 16:18:11 +0000 |
commit | a85044bf9eaa0a7206c1978d3cfd57ab2d7fae2f (patch) | |
tree | a30695ed540bf32365d577f46398f712c7a494c4 /apps/plugin.h | |
parent | baf5494341cdd6cdb9590e21d429920b9bc4a2c6 (diff) | |
download | rockbox-a85044bf9eaa0a7206c1978d3cfd57ab2d7fae2f.tar.gz rockbox-a85044bf9eaa0a7206c1978d3cfd57ab2d7fae2f.zip |
New scheduler, with priorities for swcodec platforms. Frequent task
switching should be more efficient and tasks are stored in linked
lists to eliminate unnecessary task switching to improve performance.
Audio should no longer skip on swcodec targets caused by too CPU
hungry UI thread or background threads.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10958 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugin.h')
-rw-r--r-- | apps/plugin.h | 156 |
1 files changed, 74 insertions, 82 deletions
diff --git a/apps/plugin.h b/apps/plugin.h index 9b3cec5cde..b89dfd0d81 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -105,12 +105,12 @@ | |||
105 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 105 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
106 | 106 | ||
107 | /* increase this every time the api struct changes */ | 107 | /* increase this every time the api struct changes */ |
108 | #define PLUGIN_API_VERSION 29 | 108 | #define PLUGIN_API_VERSION 30 |
109 | 109 | ||
110 | /* update this to latest version if a change to the api struct breaks | 110 | /* update this to latest version if a change to the api struct breaks |
111 | backwards compatibility (and please take the opportunity to sort in any | 111 | backwards compatibility (and please take the opportunity to sort in any |
112 | new function which are "waiting" at the end of the function table) */ | 112 | new function which are "waiting" at the end of the function table) */ |
113 | #define PLUGIN_MIN_API_VERSION 14 | 113 | #define PLUGIN_MIN_API_VERSION 30 |
114 | 114 | ||
115 | /* plugin return codes */ | 115 | /* plugin return codes */ |
116 | enum plugin_status { | 116 | enum plugin_status { |
@@ -143,6 +143,7 @@ struct plugin_api { | |||
143 | void (*PREFIX(lcd_icon))(int icon, bool enable); | 143 | void (*PREFIX(lcd_icon))(int icon, bool enable); |
144 | void (*lcd_double_height)(bool on); | 144 | void (*lcd_double_height)(bool on); |
145 | #else | 145 | #else |
146 | void (*lcd_setmargins)(int x, int y); | ||
146 | void (*lcd_set_drawmode)(int mode); | 147 | void (*lcd_set_drawmode)(int mode); |
147 | int (*lcd_get_drawmode)(void); | 148 | int (*lcd_get_drawmode)(void); |
148 | void (*lcd_setfont)(int font); | 149 | void (*lcd_setfont)(int font); |
@@ -174,6 +175,9 @@ struct plugin_api { | |||
174 | void (*lcd_bitmap_transparent)(const fb_data *src, int x, int y, | 175 | void (*lcd_bitmap_transparent)(const fb_data *src, int x, int y, |
175 | int width, int height); | 176 | int width, int height); |
176 | #endif | 177 | #endif |
178 | unsigned short *(*bidi_l2v)( const unsigned char *str, int orientation ); | ||
179 | const unsigned char *(*font_get_bits)( struct font *pf, unsigned short char_code ); | ||
180 | struct font* (*font_load)(const char *path); | ||
177 | void (*lcd_putsxy)(int x, int y, const unsigned char *string); | 181 | void (*lcd_putsxy)(int x, int y, const unsigned char *string); |
178 | void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style); | 182 | void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style); |
179 | void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string, | 183 | void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string, |
@@ -229,7 +233,50 @@ struct plugin_api { | |||
229 | void (*remote_backlight_on)(void); | 233 | void (*remote_backlight_on)(void); |
230 | void (*remote_backlight_off)(void); | 234 | void (*remote_backlight_off)(void); |
231 | #endif | 235 | #endif |
236 | struct screen* screens[NB_SCREENS]; | ||
237 | #if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) | ||
238 | void (*lcd_remote_set_foreground)(unsigned foreground); | ||
239 | unsigned (*lcd_remote_get_foreground)(void); | ||
240 | void (*lcd_remote_set_background)(unsigned foreground); | ||
241 | unsigned (*lcd_remote_get_background)(void); | ||
242 | void (*lcd_remote_bitmap_part)(const fb_remote_data *src, int src_x, int src_y, | ||
243 | int stride, int x, int y, int width, int height); | ||
244 | void (*lcd_remote_bitmap)(const fb_remote_data *src, int x, int y, int width, | ||
245 | int height); | ||
246 | #endif | ||
247 | #if defined(HAVE_LCD_COLOR) && !defined(SIMULATOR) | ||
248 | void (*lcd_yuv_blit)(unsigned char * const src[3], | ||
249 | int src_x, int src_y, int stride, | ||
250 | int x, int y, int width, int height); | ||
251 | #endif | ||
232 | 252 | ||
253 | /* list */ | ||
254 | void (*gui_synclist_init)(struct gui_synclist * lists, | ||
255 | list_get_name callback_get_item_name,void * data, | ||
256 | bool scroll_all,int selected_size); | ||
257 | void (*gui_synclist_set_nb_items)(struct gui_synclist * lists, int nb_items); | ||
258 | void (*gui_synclist_set_icon_callback)(struct gui_synclist * lists, list_get_icon icon_callback); | ||
259 | int (*gui_synclist_get_nb_items)(struct gui_synclist * lists); | ||
260 | int (*gui_synclist_get_sel_pos)(struct gui_synclist * lists); | ||
261 | void (*gui_synclist_draw)(struct gui_synclist * lists); | ||
262 | void (*gui_synclist_select_item)(struct gui_synclist * lists, | ||
263 | int item_number); | ||
264 | void (*gui_synclist_select_next)(struct gui_synclist * lists); | ||
265 | void (*gui_synclist_select_previous)(struct gui_synclist * lists); | ||
266 | void (*gui_synclist_select_next_page)(struct gui_synclist * lists, | ||
267 | enum screen_type screen); | ||
268 | void (*gui_synclist_select_previous_page)(struct gui_synclist * lists, | ||
269 | enum screen_type screen); | ||
270 | void (*gui_synclist_add_item)(struct gui_synclist * lists); | ||
271 | void (*gui_synclist_del_item)(struct gui_synclist * lists); | ||
272 | void (*gui_synclist_limit_scroll)(struct gui_synclist * lists, bool scroll); | ||
273 | void (*gui_synclist_flash)(struct gui_synclist * lists); | ||
274 | #ifdef HAVE_LCD_BITMAP | ||
275 | void (*gui_synclist_scroll_right)(struct gui_synclist * lists); | ||
276 | void (*gui_synclist_scroll_left)(struct gui_synclist * lists); | ||
277 | #endif | ||
278 | unsigned (*gui_synclist_do_button)(struct gui_synclist * lists, unsigned button); | ||
279 | |||
233 | /* button */ | 280 | /* button */ |
234 | long (*button_get)(bool block); | 281 | long (*button_get)(bool block); |
235 | long (*button_get_w_tmo)(int ticks); | 282 | long (*button_get_w_tmo)(int ticks); |
@@ -257,12 +304,14 @@ struct plugin_api { | |||
257 | void (*ata_sleep)(void); | 304 | void (*ata_sleep)(void); |
258 | bool (*ata_disk_is_active)(void); | 305 | bool (*ata_disk_is_active)(void); |
259 | #endif | 306 | #endif |
307 | void (*reload_directory)(void); | ||
260 | 308 | ||
261 | /* dir */ | 309 | /* dir */ |
262 | DIR* (*PREFIX(opendir))(const char* name); | 310 | DIR* (*PREFIX(opendir))(const char* name); |
263 | int (*PREFIX(closedir))(DIR* dir); | 311 | int (*PREFIX(closedir))(DIR* dir); |
264 | struct dirent* (*PREFIX(readdir))(DIR* dir); | 312 | struct dirent* (*PREFIX(readdir))(DIR* dir); |
265 | int (*PREFIX(mkdir))(const char *name, int mode); | 313 | int (*PREFIX(mkdir))(const char *name, int mode); |
314 | int (*PREFIX(rmdir))(const char *name); | ||
266 | 315 | ||
267 | /* kernel/ system */ | 316 | /* kernel/ system */ |
268 | void (*PREFIX(sleep))(int ticks); | 317 | void (*PREFIX(sleep))(int ticks); |
@@ -270,8 +319,10 @@ struct plugin_api { | |||
270 | long* current_tick; | 319 | long* current_tick; |
271 | long (*default_event_handler)(long event); | 320 | long (*default_event_handler)(long event); |
272 | long (*default_event_handler_ex)(long event, void (*callback)(void *), void *parameter); | 321 | long (*default_event_handler_ex)(long event, void (*callback)(void *), void *parameter); |
273 | int (*create_thread)(void (*function)(void), void* stack, int stack_size, const char *name); | 322 | struct thread_entry* (*create_thread)(void (*function)(void), void* stack, |
274 | void (*remove_thread)(int threadnum); | 323 | int stack_size, const char *name |
324 | IF_PRIO(, int priority)); | ||
325 | void (*remove_thread)(struct thread_entry *thread); | ||
275 | void (*reset_poweroff_timer)(void); | 326 | void (*reset_poweroff_timer)(void); |
276 | #ifndef SIMULATOR | 327 | #ifndef SIMULATOR |
277 | int (*system_memory_guard)(int newmode); | 328 | int (*system_memory_guard)(int newmode); |
@@ -285,7 +336,7 @@ struct plugin_api { | |||
285 | void (*timer_unregister)(void); | 336 | void (*timer_unregister)(void); |
286 | bool (*timer_set_period)(long count); | 337 | bool (*timer_set_period)(long count); |
287 | #endif | 338 | #endif |
288 | void (*queue_init)(struct event_queue *q); | 339 | void (*queue_init)(struct event_queue *q, bool register_queue); |
289 | void (*queue_delete)(struct event_queue *q); | 340 | void (*queue_delete)(struct event_queue *q); |
290 | void (*queue_post)(struct event_queue *q, long id, void *data); | 341 | void (*queue_post)(struct event_queue *q, long id, void *data); |
291 | void (*queue_wait_w_tmo)(struct event_queue *q, struct event *ev, | 342 | void (*queue_wait_w_tmo)(struct event_queue *q, struct event *ev, |
@@ -308,6 +359,7 @@ struct plugin_api { | |||
308 | 359 | ||
309 | /* strings and memory */ | 360 | /* strings and memory */ |
310 | int (*snprintf)(char *buf, size_t size, const char *fmt, ...); | 361 | int (*snprintf)(char *buf, size_t size, const char *fmt, ...); |
362 | int (*vsnprintf)(char *buf, int size, const char *fmt, va_list ap); | ||
311 | char* (*strcpy)(char *dst, const char *src); | 363 | char* (*strcpy)(char *dst, const char *src); |
312 | char* (*strncpy)(char *dst, const char *src, size_t length); | 364 | char* (*strncpy)(char *dst, const char *src, size_t length); |
313 | size_t (*strlen)(const char *str); | 365 | size_t (*strlen)(const char *str); |
@@ -323,6 +375,7 @@ struct plugin_api { | |||
323 | int (*atoi)(const char *str); | 375 | int (*atoi)(const char *str); |
324 | char *(*strchr)(const char *s, int c); | 376 | char *(*strchr)(const char *s, int c); |
325 | char *(*strcat)(char *s1, const char *s2); | 377 | char *(*strcat)(char *s1, const char *s2); |
378 | void *(*memchr)(const void *s1, int c, size_t n); | ||
326 | int (*memcmp)(const void *s1, const void *s2, size_t n); | 379 | int (*memcmp)(const void *s1, const void *s2, size_t n); |
327 | char *(*strcasestr) (const char* phaystack, const char* pneedle); | 380 | char *(*strcasestr) (const char* phaystack, const char* pneedle); |
328 | /* unicode stuff */ | 381 | /* unicode stuff */ |
@@ -332,9 +385,12 @@ struct plugin_api { | |||
332 | unsigned char* (*utf16BEdecode)(const unsigned char *utf16, unsigned char *utf8, int count); | 385 | unsigned char* (*utf16BEdecode)(const unsigned char *utf16, unsigned char *utf8, int count); |
333 | unsigned char* (*utf8encode)(unsigned long ucs, unsigned char *utf8); | 386 | unsigned char* (*utf8encode)(unsigned long ucs, unsigned char *utf8); |
334 | unsigned long (*utf8length)(const unsigned char *utf8); | 387 | unsigned long (*utf8length)(const unsigned char *utf8); |
388 | int (*utf8seek)(const unsigned char* utf8, int offset); | ||
335 | 389 | ||
336 | /* sound */ | 390 | /* sound */ |
337 | void (*sound_set)(int setting, int value); | 391 | void (*sound_set)(int setting, int value); |
392 | bool (*set_sound)(const unsigned char * string, | ||
393 | int* variable, int setting); | ||
338 | int (*sound_min)(int setting); | 394 | int (*sound_min)(int setting); |
339 | int (*sound_max)(int setting); | 395 | int (*sound_max)(int setting); |
340 | #ifndef SIMULATOR | 396 | #ifndef SIMULATOR |
@@ -390,6 +446,9 @@ struct plugin_api { | |||
390 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | 446 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) |
391 | int (*mas_codec_writereg)(int reg, unsigned int val); | 447 | int (*mas_codec_writereg)(int reg, unsigned int val); |
392 | int (*mas_codec_readreg)(int reg); | 448 | int (*mas_codec_readreg)(int reg); |
449 | void (*i2c_begin)(void); | ||
450 | void (*i2c_end)(void); | ||
451 | int (*i2c_write)(int address, unsigned char* buf, int count ); | ||
393 | #endif | 452 | #endif |
394 | #endif | 453 | #endif |
395 | 454 | ||
@@ -413,7 +472,17 @@ struct plugin_api { | |||
413 | bool (*set_option)(const char* string, void* variable, | 472 | bool (*set_option)(const char* string, void* variable, |
414 | enum optiontype type, const struct opt_items* options, | 473 | enum optiontype type, const struct opt_items* options, |
415 | int numoptions, void (*function)(int)); | 474 | int numoptions, void (*function)(int)); |
475 | bool (*set_int)(const unsigned char* string, const char* unit, int voice_unit, | ||
476 | int* variable, void (*function)(int), int step, int min, | ||
477 | int max, void (*formatter)(char*, int, int, const char*) ); | ||
478 | bool (*set_bool)(const char* string, bool* variable ); | ||
416 | 479 | ||
480 | /* action handling */ | ||
481 | int (*get_custom_action)(int context,int timeout, | ||
482 | const struct button_mapping* (*get_context_map)(int)); | ||
483 | int (*get_action)(int context, int timeout); | ||
484 | void (*action_signalscreenchange)(void); | ||
485 | bool (*action_userabort)(int timeout); | ||
417 | 486 | ||
418 | /* power */ | 487 | /* power */ |
419 | int (*battery_level)(void); | 488 | int (*battery_level)(void); |
@@ -476,83 +545,6 @@ struct plugin_api { | |||
476 | 545 | ||
477 | /* new stuff at the end, sort into place next time | 546 | /* new stuff at the end, sort into place next time |
478 | the API gets incompatible */ | 547 | the API gets incompatible */ |
479 | bool (*set_sound)(const unsigned char * string, | ||
480 | int* variable, int setting); | ||
481 | #if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)) && !defined(SIMULATOR) | ||
482 | void (*i2c_begin)(void); | ||
483 | void (*i2c_end)(void); | ||
484 | int (*i2c_write)(int address, unsigned char* buf, int count ); | ||
485 | #endif | ||
486 | |||
487 | int (*vsnprintf)(char *buf, int size, const char *fmt, va_list ap); | ||
488 | void *(*memchr)(const void *s1, int c, size_t n); | ||
489 | |||
490 | /* list */ | ||
491 | void (*gui_synclist_init)(struct gui_synclist * lists, | ||
492 | list_get_name callback_get_item_name,void * data, | ||
493 | bool scroll_all,int selected_size); | ||
494 | void (*gui_synclist_set_nb_items)(struct gui_synclist * lists, int nb_items); | ||
495 | void (*gui_synclist_set_icon_callback)(struct gui_synclist * lists, list_get_icon icon_callback); | ||
496 | int (*gui_synclist_get_nb_items)(struct gui_synclist * lists); | ||
497 | int (*gui_synclist_get_sel_pos)(struct gui_synclist * lists); | ||
498 | void (*gui_synclist_draw)(struct gui_synclist * lists); | ||
499 | void (*gui_synclist_select_item)(struct gui_synclist * lists, | ||
500 | int item_number); | ||
501 | void (*gui_synclist_select_next)(struct gui_synclist * lists); | ||
502 | void (*gui_synclist_select_previous)(struct gui_synclist * lists); | ||
503 | void (*gui_synclist_select_next_page)(struct gui_synclist * lists, | ||
504 | enum screen_type screen); | ||
505 | void (*gui_synclist_select_previous_page)(struct gui_synclist * lists, | ||
506 | enum screen_type screen); | ||
507 | void (*gui_synclist_add_item)(struct gui_synclist * lists); | ||
508 | void (*gui_synclist_del_item)(struct gui_synclist * lists); | ||
509 | void (*gui_synclist_limit_scroll)(struct gui_synclist * lists, bool scroll); | ||
510 | void (*gui_synclist_flash)(struct gui_synclist * lists); | ||
511 | #ifdef HAVE_LCD_BITMAP | ||
512 | void (*gui_synclist_scroll_right)(struct gui_synclist * lists); | ||
513 | void (*gui_synclist_scroll_left)(struct gui_synclist * lists); | ||
514 | #endif | ||
515 | unsigned (*gui_synclist_do_button)(struct gui_synclist * lists, unsigned button); | ||
516 | |||
517 | #ifdef HAVE_LCD_BITMAP | ||
518 | void (*lcd_setmargins)(int x, int y); | ||
519 | #endif | ||
520 | int (*utf8seek)(const unsigned char* utf8, int offset); | ||
521 | |||
522 | bool (*set_int)(const unsigned char* string, const char* unit, int voice_unit, | ||
523 | int* variable, void (*function)(int), int step, int min, | ||
524 | int max, void (*formatter)(char*, int, int, const char*) ); | ||
525 | void (*reload_directory)(void); | ||
526 | bool (*set_bool)(const char* string, bool* variable ); | ||
527 | struct screen* screens[NB_SCREENS]; | ||
528 | #ifdef HAVE_LCD_BITMAP | ||
529 | unsigned short *(*bidi_l2v)( const unsigned char *str, int orientation ); | ||
530 | const unsigned char *(*font_get_bits)( struct font *pf, unsigned short char_code ); | ||
531 | struct font* (*font_load)(const char *path); | ||
532 | #endif | ||
533 | #if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) | ||
534 | void (*lcd_remote_set_foreground)(unsigned foreground); | ||
535 | unsigned (*lcd_remote_get_foreground)(void); | ||
536 | void (*lcd_remote_set_background)(unsigned foreground); | ||
537 | unsigned (*lcd_remote_get_background)(void); | ||
538 | void (*lcd_remote_bitmap_part)(const fb_remote_data *src, int src_x, int src_y, | ||
539 | int stride, int x, int y, int width, int height); | ||
540 | void (*lcd_remote_bitmap)(const fb_remote_data *src, int x, int y, int width, | ||
541 | int height); | ||
542 | #endif | ||
543 | #if defined(HAVE_LCD_COLOR) && !defined(SIMULATOR) | ||
544 | void (*lcd_yuv_blit)(unsigned char * const src[3], | ||
545 | int src_x, int src_y, int stride, | ||
546 | int x, int y, int width, int height); | ||
547 | #endif | ||
548 | |||
549 | int (*PREFIX(rmdir))(const char *name); | ||
550 | /* action handling */ | ||
551 | int (*get_custom_action)(int context,int timeout, | ||
552 | const struct button_mapping* (*get_context_map)(int)); | ||
553 | int (*get_action)(int context, int timeout); | ||
554 | void (*action_signalscreenchange)(void); | ||
555 | bool (*action_userabort)(int timeout); | ||
556 | }; | 548 | }; |
557 | 549 | ||
558 | /* plugin header */ | 550 | /* plugin header */ |