diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugin.c | 210 | ||||
-rw-r--r-- | apps/plugin.h | 229 |
2 files changed, 239 insertions, 200 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index 7d4199a607..12bfe485e5 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -84,7 +84,7 @@ char *plugin_get_current_filename(void); | |||
84 | static void* plugin_get_audio_buffer(size_t *buffer_size); | 84 | static void* plugin_get_audio_buffer(size_t *buffer_size); |
85 | static void plugin_release_audio_buffer(void); | 85 | static void plugin_release_audio_buffer(void); |
86 | static void plugin_tsr(bool (*exit_callback)(bool)); | 86 | static void plugin_tsr(bool (*exit_callback)(bool)); |
87 | 87 | int sound_current(int setting); /*stub*/ | |
88 | 88 | ||
89 | #ifdef HAVE_PLUGIN_CHECK_OPEN_CLOSE | 89 | #ifdef HAVE_PLUGIN_CHECK_OPEN_CLOSE |
90 | /* File handle leak prophylaxis */ | 90 | /* File handle leak prophylaxis */ |
@@ -182,6 +182,8 @@ static const struct plugin_api rockbox_api = { | |||
182 | language_strings, | 182 | language_strings, |
183 | 183 | ||
184 | /* lcd */ | 184 | /* lcd */ |
185 | splash, | ||
186 | splashf, | ||
185 | #ifdef HAVE_LCD_CONTRAST | 187 | #ifdef HAVE_LCD_CONTRAST |
186 | lcd_set_contrast, | 188 | lcd_set_contrast, |
187 | #endif | 189 | #endif |
@@ -203,7 +205,7 @@ static const struct plugin_api rockbox_api = { | |||
203 | lcd_remove_cursor, | 205 | lcd_remove_cursor, |
204 | lcd_icon, | 206 | lcd_icon, |
205 | lcd_double_height, | 207 | lcd_double_height, |
206 | #else | 208 | #else /* HAVE_LCD_BITMAP */ |
207 | &lcd_static_framebuffer[0][0], | 209 | &lcd_static_framebuffer[0][0], |
208 | lcd_set_viewport, | 210 | lcd_set_viewport, |
209 | lcd_set_framebuffer, | 211 | lcd_set_framebuffer, |
@@ -274,20 +276,6 @@ static const struct plugin_api rockbox_api = { | |||
274 | gui_scrollbar_draw, | 276 | gui_scrollbar_draw, |
275 | #endif /* HAVE_LCD_BITMAP */ | 277 | #endif /* HAVE_LCD_BITMAP */ |
276 | 278 | ||
277 | backlight_on, | ||
278 | backlight_off, | ||
279 | backlight_set_timeout, | ||
280 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | ||
281 | backlight_set_brightness, | ||
282 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ | ||
283 | |||
284 | #if CONFIG_CHARGING | ||
285 | backlight_set_timeout_plugged, | ||
286 | #endif | ||
287 | is_backlight_on, | ||
288 | splash, | ||
289 | splashf, | ||
290 | |||
291 | #ifdef HAVE_REMOTE_LCD | 279 | #ifdef HAVE_REMOTE_LCD |
292 | /* remote lcd */ | 280 | /* remote lcd */ |
293 | lcd_remote_set_contrast, | 281 | lcd_remote_set_contrast, |
@@ -311,20 +299,7 @@ static const struct plugin_api rockbox_api = { | |||
311 | &lcd_remote_static_framebuffer[0][0], | 299 | &lcd_remote_static_framebuffer[0][0], |
312 | lcd_remote_update, | 300 | lcd_remote_update, |
313 | lcd_remote_update_rect, | 301 | lcd_remote_update_rect, |
314 | 302 | #if (LCD_REMOTE_DEPTH > 1) | |
315 | remote_backlight_on, | ||
316 | remote_backlight_off, | ||
317 | remote_backlight_set_timeout, | ||
318 | #if CONFIG_CHARGING | ||
319 | remote_backlight_set_timeout_plugged, | ||
320 | #endif | ||
321 | #endif /* HAVE_REMOTE_LCD */ | ||
322 | #if NB_SCREENS == 2 | ||
323 | {&screens[SCREEN_MAIN], &screens[SCREEN_REMOTE]}, | ||
324 | #else | ||
325 | {&screens[SCREEN_MAIN]}, | ||
326 | #endif | ||
327 | #if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) | ||
328 | lcd_remote_set_foreground, | 303 | lcd_remote_set_foreground, |
329 | lcd_remote_get_foreground, | 304 | lcd_remote_get_foreground, |
330 | lcd_remote_set_background, | 305 | lcd_remote_set_background, |
@@ -332,6 +307,13 @@ static const struct plugin_api rockbox_api = { | |||
332 | lcd_remote_bitmap_part, | 307 | lcd_remote_bitmap_part, |
333 | lcd_remote_bitmap, | 308 | lcd_remote_bitmap, |
334 | #endif | 309 | #endif |
310 | #endif /* HAVE_REMOTE_LCD */ | ||
311 | #if NB_SCREENS == 2 | ||
312 | {&screens[SCREEN_MAIN], &screens[SCREEN_REMOTE]}, | ||
313 | #else | ||
314 | {&screens[SCREEN_MAIN]}, | ||
315 | #endif | ||
316 | |||
335 | viewport_set_defaults, | 317 | viewport_set_defaults, |
336 | #ifdef HAVE_LCD_BITMAP | 318 | #ifdef HAVE_LCD_BITMAP |
337 | viewportmanager_theme_enable, | 319 | viewportmanager_theme_enable, |
@@ -339,6 +321,35 @@ static const struct plugin_api rockbox_api = { | |||
339 | viewport_set_fullscreen, | 321 | viewport_set_fullscreen, |
340 | #endif | 322 | #endif |
341 | 323 | ||
324 | /* lcd backlight */ | ||
325 | /* The backlight_* functions must be present in the API regardless whether | ||
326 | * HAVE_BACKLIGHT is defined or not. The reason is that the stock Ondio has | ||
327 | * no backlight but can be modded to have backlight (it's prepared on the | ||
328 | * PCB). This makes backlight an all-target feature API wise, and keeps API | ||
329 | * compatible between stock and modded Ondio. | ||
330 | * For OLED targets like the Sansa Clip, the backlight_* functions control | ||
331 | * the display enable, which has essentially the same effect. */ | ||
332 | is_backlight_on, | ||
333 | backlight_on, | ||
334 | backlight_off, | ||
335 | backlight_set_timeout, | ||
336 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | ||
337 | backlight_set_brightness, | ||
338 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ | ||
339 | |||
340 | #if CONFIG_CHARGING | ||
341 | backlight_set_timeout_plugged, | ||
342 | #endif | ||
343 | |||
344 | #ifdef HAVE_REMOTE_LCD | ||
345 | remote_backlight_on, | ||
346 | remote_backlight_off, | ||
347 | remote_backlight_set_timeout, | ||
348 | #if CONFIG_CHARGING | ||
349 | remote_backlight_set_timeout_plugged, | ||
350 | #endif | ||
351 | #endif /* HAVE_REMOTE_LCD */ | ||
352 | |||
342 | /* list */ | 353 | /* list */ |
343 | gui_synclist_init, | 354 | gui_synclist_init, |
344 | gui_synclist_set_nb_items, | 355 | gui_synclist_set_nb_items, |
@@ -358,6 +369,14 @@ static const struct plugin_api rockbox_api = { | |||
358 | simplelist_info_init, | 369 | simplelist_info_init, |
359 | simplelist_show_list, | 370 | simplelist_show_list, |
360 | 371 | ||
372 | /* action handling */ | ||
373 | get_custom_action, | ||
374 | get_action, | ||
375 | #ifdef HAVE_TOUCHSCREEN | ||
376 | action_get_touchscreen_press, | ||
377 | #endif | ||
378 | action_userabort, | ||
379 | |||
361 | /* button */ | 380 | /* button */ |
362 | button_get, | 381 | button_get, |
363 | button_get_w_tmo, | 382 | button_get_w_tmo, |
@@ -426,6 +445,11 @@ static const struct plugin_api rockbox_api = { | |||
426 | /* browsing */ | 445 | /* browsing */ |
427 | browse_context_init, | 446 | browse_context_init, |
428 | rockbox_browse, | 447 | rockbox_browse, |
448 | tree_get_context, | ||
449 | tree_get_entries, | ||
450 | tree_get_entry_at, | ||
451 | set_current_file, | ||
452 | set_dirfilter, | ||
429 | 453 | ||
430 | /* talking */ | 454 | /* talking */ |
431 | talk_id, | 455 | talk_id, |
@@ -464,8 +488,14 @@ static const struct plugin_api rockbox_api = { | |||
464 | mutex_lock, | 488 | mutex_lock, |
465 | mutex_unlock, | 489 | mutex_unlock, |
466 | #endif | 490 | #endif |
467 | 491 | #ifdef HAVE_SEMAPHORE_OBJECTS | |
492 | semaphore_init, | ||
493 | semaphore_wait, | ||
494 | semaphore_release, | ||
495 | #endif | ||
468 | reset_poweroff_timer, | 496 | reset_poweroff_timer, |
497 | set_sleeptimer_duration, /*stub*/ | ||
498 | get_sleep_timer, /*stub*/ | ||
469 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | 499 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
470 | system_memory_guard, | 500 | system_memory_guard, |
471 | &cpu_frequency, | 501 | &cpu_frequency, |
@@ -507,10 +537,7 @@ static const struct plugin_api rockbox_api = { | |||
507 | queue_send, | 537 | queue_send, |
508 | queue_reply, | 538 | queue_reply, |
509 | #endif | 539 | #endif |
510 | usb_acknowledge, | 540 | |
511 | #ifdef USB_ENABLE_HID | ||
512 | usb_hid_send, | ||
513 | #endif | ||
514 | #ifdef RB_PROFILE | 541 | #ifdef RB_PROFILE |
515 | profile_thread, | 542 | profile_thread, |
516 | profstop, | 543 | profstop, |
@@ -578,6 +605,7 @@ static const struct plugin_api rockbox_api = { | |||
578 | 605 | ||
579 | /* sound */ | 606 | /* sound */ |
580 | sound_set, | 607 | sound_set, |
608 | sound_current, /*stub*/ | ||
581 | sound_default, | 609 | sound_default, |
582 | sound_min, | 610 | sound_min, |
583 | sound_max, | 611 | sound_max, |
@@ -586,6 +614,10 @@ static const struct plugin_api rockbox_api = { | |||
586 | #ifdef AUDIOHW_HAVE_EQ | 614 | #ifdef AUDIOHW_HAVE_EQ |
587 | sound_enum_hw_eq_band_setting, | 615 | sound_enum_hw_eq_band_setting, |
588 | #endif | 616 | #endif |
617 | #if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \ | ||
618 | (CONFIG_CODEC == SWCODEC)) && defined (HAVE_PITCHCONTROL) | ||
619 | sound_set_pitch, | ||
620 | #endif | ||
589 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | 621 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
590 | mp3_play_data, | 622 | mp3_play_data, |
591 | mp3_play_pause, | 623 | mp3_play_pause, |
@@ -650,6 +682,37 @@ static const struct plugin_api rockbox_api = { | |||
650 | system_sound_play, | 682 | system_sound_play, |
651 | keyclick_click, | 683 | keyclick_click, |
652 | #endif /* CONFIG_CODEC == SWCODEC */ | 684 | #endif /* CONFIG_CODEC == SWCODEC */ |
685 | |||
686 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | ||
687 | peak_meter_scale_value, | ||
688 | peak_meter_set_use_dbfs, | ||
689 | peak_meter_get_use_dbfs, | ||
690 | #endif | ||
691 | |||
692 | |||
693 | /* metadata */ | ||
694 | get_metadata, | ||
695 | mp3info, | ||
696 | count_mp3_frames, | ||
697 | create_xing_header, | ||
698 | find_next_frame, | ||
699 | #ifdef HAVE_TAGCACHE | ||
700 | tagcache_search, | ||
701 | tagcache_search_set_uniqbuf, | ||
702 | tagcache_search_add_filter, | ||
703 | tagcache_get_next, | ||
704 | tagcache_retrieve, | ||
705 | tagcache_search_finish, | ||
706 | tagcache_get_numeric, | ||
707 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) | ||
708 | tagcache_fill_tags, | ||
709 | #endif | ||
710 | #endif /* HAVE_TAGCACHE */ | ||
711 | |||
712 | #ifdef HAVE_ALBUMART | ||
713 | search_albumart_files, | ||
714 | #endif | ||
715 | |||
653 | /* playback control */ | 716 | /* playback control */ |
654 | playlist_amount, | 717 | playlist_amount, |
655 | playlist_resume, | 718 | playlist_resume, |
@@ -677,10 +740,6 @@ static const struct plugin_api rockbox_api = { | |||
677 | #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) | 740 | #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) |
678 | mpeg_get_last_header, | 741 | mpeg_get_last_header, |
679 | #endif | 742 | #endif |
680 | #if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \ | ||
681 | (CONFIG_CODEC == SWCODEC)) && defined (HAVE_PITCHCONTROL) | ||
682 | sound_set_pitch, | ||
683 | #endif | ||
684 | 743 | ||
685 | #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) | 744 | #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) |
686 | /* MAS communication */ | 745 | /* MAS communication */ |
@@ -722,14 +781,6 @@ static const struct plugin_api rockbox_api = { | |||
722 | set_color, | 781 | set_color, |
723 | #endif | 782 | #endif |
724 | 783 | ||
725 | /* action handling */ | ||
726 | get_custom_action, | ||
727 | get_action, | ||
728 | #ifdef HAVE_TOUCHSCREEN | ||
729 | action_get_touchscreen_press, | ||
730 | #endif | ||
731 | action_userabort, | ||
732 | |||
733 | /* power */ | 784 | /* power */ |
734 | battery_level, | 785 | battery_level, |
735 | battery_level_safe, | 786 | battery_level_safe, |
@@ -741,8 +792,12 @@ static const struct plugin_api rockbox_api = { | |||
741 | charging_state, | 792 | charging_state, |
742 | # endif | 793 | # endif |
743 | #endif | 794 | #endif |
795 | /* usb */ | ||
744 | usb_inserted, | 796 | usb_inserted, |
745 | 797 | usb_acknowledge, | |
798 | #ifdef USB_ENABLE_HID | ||
799 | usb_hid_send, | ||
800 | #endif | ||
746 | /* misc */ | 801 | /* misc */ |
747 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | 802 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
748 | __errno, | 803 | __errno, |
@@ -757,14 +812,7 @@ static const struct plugin_api rockbox_api = { | |||
757 | #if CONFIG_RTC | 812 | #if CONFIG_RTC |
758 | mktime, | 813 | mktime, |
759 | #endif | 814 | #endif |
760 | plugin_get_buffer, | 815 | |
761 | plugin_get_audio_buffer, /* defined in plugin.c */ | ||
762 | plugin_release_audio_buffer, /* defined in plugin.c */ | ||
763 | plugin_tsr, /* defined in plugin.c */ | ||
764 | plugin_get_current_filename, | ||
765 | #ifdef PLUGIN_USE_IRAM | ||
766 | audio_hard_stop, | ||
767 | #endif | ||
768 | #if defined(DEBUG) || defined(SIMULATOR) | 816 | #if defined(DEBUG) || defined(SIMULATOR) |
769 | debugf, | 817 | debugf, |
770 | #endif | 818 | #endif |
@@ -781,16 +829,7 @@ static const struct plugin_api rockbox_api = { | |||
781 | remove_array_ptr, | 829 | remove_array_ptr, |
782 | round_value_to_list32, | 830 | round_value_to_list32, |
783 | #endif /* CONFIG_CODEC == SWCODEC */ | 831 | #endif /* CONFIG_CODEC == SWCODEC */ |
784 | get_metadata, | 832 | |
785 | mp3info, | ||
786 | count_mp3_frames, | ||
787 | create_xing_header, | ||
788 | find_next_frame, | ||
789 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | ||
790 | peak_meter_scale_value, | ||
791 | peak_meter_set_use_dbfs, | ||
792 | peak_meter_get_use_dbfs, | ||
793 | #endif | ||
794 | #ifdef HAVE_LCD_BITMAP | 833 | #ifdef HAVE_LCD_BITMAP |
795 | read_bmp_file, | 834 | read_bmp_file, |
796 | read_bmp_fd, | 835 | read_bmp_fd, |
@@ -801,11 +840,6 @@ static const struct plugin_api rockbox_api = { | |||
801 | screen_dump_set_hook, | 840 | screen_dump_set_hook, |
802 | #endif | 841 | #endif |
803 | show_logo, | 842 | show_logo, |
804 | tree_get_context, | ||
805 | tree_get_entries, | ||
806 | tree_get_entry_at, | ||
807 | set_current_file, | ||
808 | set_dirfilter, | ||
809 | 843 | ||
810 | #ifdef HAVE_WHEEL_POSITION | 844 | #ifdef HAVE_WHEEL_POSITION |
811 | wheel_status, | 845 | wheel_status, |
@@ -819,27 +853,15 @@ static const struct plugin_api rockbox_api = { | |||
819 | detect_flashed_romimage, | 853 | detect_flashed_romimage, |
820 | #endif | 854 | #endif |
821 | led, | 855 | led, |
822 | #ifdef HAVE_TAGCACHE | ||
823 | tagcache_search, | ||
824 | tagcache_search_set_uniqbuf, | ||
825 | tagcache_search_add_filter, | ||
826 | tagcache_get_next, | ||
827 | tagcache_retrieve, | ||
828 | tagcache_search_finish, | ||
829 | tagcache_get_numeric, | ||
830 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) | ||
831 | tagcache_fill_tags, | ||
832 | #endif | ||
833 | #endif | ||
834 | |||
835 | #ifdef HAVE_ALBUMART | ||
836 | search_albumart_files, | ||
837 | #endif | ||
838 | 856 | ||
839 | #ifdef HAVE_SEMAPHORE_OBJECTS | 857 | /*plugin*/ |
840 | semaphore_init, | 858 | plugin_get_buffer, |
841 | semaphore_wait, | 859 | plugin_get_audio_buffer, /* defined in plugin.c */ |
842 | semaphore_release, | 860 | plugin_release_audio_buffer, /* defined in plugin.c */ |
861 | plugin_tsr, /* defined in plugin.c */ | ||
862 | plugin_get_current_filename, | ||
863 | #ifdef PLUGIN_USE_IRAM | ||
864 | audio_hard_stop, | ||
843 | #endif | 865 | #endif |
844 | 866 | ||
845 | /* new stuff at the end, sort into place next time | 867 | /* new stuff at the end, sort into place next time |
@@ -1060,3 +1082,9 @@ char *plugin_get_current_filename(void) | |||
1060 | { | 1082 | { |
1061 | return current_plugin; | 1083 | return current_plugin; |
1062 | } | 1084 | } |
1085 | |||
1086 | int sound_current(int setting) /*stub*/ | ||
1087 | { | ||
1088 | (void) setting; | ||
1089 | return 0; | ||
1090 | } | ||
diff --git a/apps/plugin.h b/apps/plugin.h index 50f71914e9..083dac0335 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -189,13 +189,14 @@ enum plugin_status { | |||
189 | version | 189 | version |
190 | */ | 190 | */ |
191 | struct plugin_api { | 191 | struct plugin_api { |
192 | /* let's put these at the top */ | ||
193 | const char *rbversion; | 192 | const char *rbversion; |
194 | struct user_settings* global_settings; | 193 | struct user_settings* global_settings; |
195 | struct system_status *global_status; | 194 | struct system_status *global_status; |
196 | unsigned char **language_strings; | 195 | unsigned char **language_strings; |
197 | 196 | ||
198 | /* lcd */ | 197 | /* lcd */ |
198 | void (*splash)(int ticks, const char *str); | ||
199 | void (*splashf)(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); | ||
199 | #ifdef HAVE_LCD_CONTRAST | 200 | #ifdef HAVE_LCD_CONTRAST |
200 | void (*lcd_set_contrast)(int x); | 201 | void (*lcd_set_contrast)(int x); |
201 | #endif | 202 | #endif |
@@ -307,27 +308,6 @@ struct plugin_api { | |||
307 | int min_shown, int max_shown, | 308 | int min_shown, int max_shown, |
308 | unsigned flags); | 309 | unsigned flags); |
309 | #endif /* HAVE_LCD_BITMAP */ | 310 | #endif /* HAVE_LCD_BITMAP */ |
310 | /* backlight */ | ||
311 | /* The backlight_* functions must be present in the API regardless whether | ||
312 | * HAVE_BACKLIGHT is defined or not. The reason is that the stock Ondio has | ||
313 | * no backlight but can be modded to have backlight (it's prepared on the | ||
314 | * PCB). This makes backlight an all-target feature API wise, and keeps API | ||
315 | * compatible between stock and modded Ondio. | ||
316 | * For OLED targets like the Sansa Clip, the backlight_* functions control | ||
317 | * the display enable, which has essentially the same effect. */ | ||
318 | void (*backlight_on)(void); | ||
319 | void (*backlight_off)(void); | ||
320 | void (*backlight_set_timeout)(int index); | ||
321 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | ||
322 | void (*backlight_set_brightness)(int val); | ||
323 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ | ||
324 | |||
325 | #if CONFIG_CHARGING | ||
326 | void (*backlight_set_timeout_plugged)(int index); | ||
327 | #endif | ||
328 | bool (*is_backlight_on)(bool ignore_always_off); | ||
329 | void (*splash)(int ticks, const char *str); | ||
330 | void (*splashf)(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); | ||
331 | 311 | ||
332 | #ifdef HAVE_REMOTE_LCD | 312 | #ifdef HAVE_REMOTE_LCD |
333 | /* remote lcd */ | 313 | /* remote lcd */ |
@@ -355,16 +335,7 @@ struct plugin_api { | |||
355 | fb_remote_data* lcd_remote_framebuffer; | 335 | fb_remote_data* lcd_remote_framebuffer; |
356 | void (*lcd_remote_update)(void); | 336 | void (*lcd_remote_update)(void); |
357 | void (*lcd_remote_update_rect)(int x, int y, int width, int height); | 337 | void (*lcd_remote_update_rect)(int x, int y, int width, int height); |
358 | 338 | #if (LCD_REMOTE_DEPTH > 1) | |
359 | void (*remote_backlight_on)(void); | ||
360 | void (*remote_backlight_off)(void); | ||
361 | void (*remote_backlight_set_timeout)(int index); | ||
362 | #if CONFIG_CHARGING | ||
363 | void (*remote_backlight_set_timeout_plugged)(int index); | ||
364 | #endif | ||
365 | #endif /* HAVE_REMOTE_LCD */ | ||
366 | struct screen* screens[NB_SCREENS]; | ||
367 | #if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) | ||
368 | void (*lcd_remote_set_foreground)(unsigned foreground); | 339 | void (*lcd_remote_set_foreground)(unsigned foreground); |
369 | unsigned (*lcd_remote_get_foreground)(void); | 340 | unsigned (*lcd_remote_get_foreground)(void); |
370 | void (*lcd_remote_set_background)(unsigned background); | 341 | void (*lcd_remote_set_background)(unsigned background); |
@@ -375,6 +346,9 @@ struct plugin_api { | |||
375 | void (*lcd_remote_bitmap)(const fb_remote_data *src, int x, int y, | 346 | void (*lcd_remote_bitmap)(const fb_remote_data *src, int x, int y, |
376 | int width, int height); | 347 | int width, int height); |
377 | #endif | 348 | #endif |
349 | #endif /* HAVE_REMOTE_LCD */ | ||
350 | struct screen* screens[NB_SCREENS]; | ||
351 | |||
378 | void (*viewport_set_defaults)(struct viewport *vp, | 352 | void (*viewport_set_defaults)(struct viewport *vp, |
379 | const enum screen_type screen); | 353 | const enum screen_type screen); |
380 | #ifdef HAVE_LCD_BITMAP | 354 | #ifdef HAVE_LCD_BITMAP |
@@ -384,6 +358,36 @@ struct plugin_api { | |||
384 | void (*viewport_set_fullscreen)(struct viewport *vp, | 358 | void (*viewport_set_fullscreen)(struct viewport *vp, |
385 | const enum screen_type screen); | 359 | const enum screen_type screen); |
386 | #endif | 360 | #endif |
361 | |||
362 | /* lcd backlight */ | ||
363 | /* The backlight_* functions must be present in the API regardless whether | ||
364 | * HAVE_BACKLIGHT is defined or not. The reason is that the stock Ondio has | ||
365 | * no backlight but can be modded to have backlight (it's prepared on the | ||
366 | * PCB). This makes backlight an all-target feature API wise, and keeps API | ||
367 | * compatible between stock and modded Ondio. | ||
368 | * For OLED targets like the Sansa Clip, the backlight_* functions control | ||
369 | * the display enable, which has essentially the same effect. */ | ||
370 | bool (*is_backlight_on)(bool ignore_always_off); | ||
371 | void (*backlight_on)(void); | ||
372 | void (*backlight_off)(void); | ||
373 | void (*backlight_set_timeout)(int index); | ||
374 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | ||
375 | void (*backlight_set_brightness)(int val); | ||
376 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ | ||
377 | |||
378 | #if CONFIG_CHARGING | ||
379 | void (*backlight_set_timeout_plugged)(int index); | ||
380 | #endif | ||
381 | |||
382 | #ifdef HAVE_REMOTE_LCD | ||
383 | void (*remote_backlight_on)(void); | ||
384 | void (*remote_backlight_off)(void); | ||
385 | void (*remote_backlight_set_timeout)(int index); | ||
386 | #if CONFIG_CHARGING | ||
387 | void (*remote_backlight_set_timeout_plugged)(int index); | ||
388 | #endif | ||
389 | #endif /* HAVE_REMOTE_LCD */ | ||
390 | |||
387 | /* list */ | 391 | /* list */ |
388 | void (*gui_synclist_init)(struct gui_synclist * lists, | 392 | void (*gui_synclist_init)(struct gui_synclist * lists, |
389 | list_get_name callback_get_item_name, void * data, | 393 | list_get_name callback_get_item_name, void * data, |
@@ -413,6 +417,15 @@ struct plugin_api { | |||
413 | int count, void* data); | 417 | int count, void* data); |
414 | bool (*simplelist_show_list)(struct simplelist_info *info); | 418 | bool (*simplelist_show_list)(struct simplelist_info *info); |
415 | 419 | ||
420 | /* action handling */ | ||
421 | int (*get_custom_action)(int context,int timeout, | ||
422 | const struct button_mapping* (*get_context_map)(int)); | ||
423 | int (*get_action)(int context, int timeout); | ||
424 | #ifdef HAVE_TOUCHSCREEN | ||
425 | int (*action_get_touchscreen_press)(short *x, short *y); | ||
426 | #endif | ||
427 | bool (*action_userabort)(int timeout); | ||
428 | |||
416 | /* button */ | 429 | /* button */ |
417 | long (*button_get)(bool block); | 430 | long (*button_get)(bool block); |
418 | long (*button_get_w_tmo)(int ticks); | 431 | long (*button_get_w_tmo)(int ticks); |
@@ -486,6 +499,12 @@ struct plugin_api { | |||
486 | char *title, enum themable_icons icon, | 499 | char *title, enum themable_icons icon, |
487 | const char *root, const char *selected); | 500 | const char *root, const char *selected); |
488 | int (*rockbox_browse)(struct browse_context *browse); | 501 | int (*rockbox_browse)(struct browse_context *browse); |
502 | struct tree_context* (*tree_get_context)(void); | ||
503 | struct entry* (*tree_get_entries)(struct tree_context* t); | ||
504 | struct entry* (*tree_get_entry_at)(struct tree_context* t, int index); | ||
505 | |||
506 | void (*set_current_file)(const char* path); | ||
507 | void (*set_dirfilter)(int l_dirfilter); | ||
489 | 508 | ||
490 | /* talking */ | 509 | /* talking */ |
491 | int (*talk_id)(int32_t id, bool enqueue); | 510 | int (*talk_id)(int32_t id, bool enqueue); |
@@ -532,8 +551,14 @@ struct plugin_api { | |||
532 | void (*mutex_lock)(struct mutex *m); | 551 | void (*mutex_lock)(struct mutex *m); |
533 | void (*mutex_unlock)(struct mutex *m); | 552 | void (*mutex_unlock)(struct mutex *m); |
534 | #endif | 553 | #endif |
535 | 554 | #ifdef HAVE_SEMAPHORE_OBJECTS | |
555 | void (*semaphore_init)(struct semaphore *s, int max, int start); | ||
556 | int (*semaphore_wait)(struct semaphore *s, int timeout); | ||
557 | void (*semaphore_release)(struct semaphore *s); | ||
558 | #endif | ||
536 | void (*reset_poweroff_timer)(void); | 559 | void (*reset_poweroff_timer)(void); |
560 | void (*set_sleeptimer_duration)(int minutes); | ||
561 | int (*get_sleep_timer)(void); | ||
537 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | 562 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
538 | int (*system_memory_guard)(int newmode); | 563 | int (*system_memory_guard)(int newmode); |
539 | long *cpu_frequency; | 564 | long *cpu_frequency; |
@@ -582,10 +607,6 @@ struct plugin_api { | |||
582 | void (*queue_reply)(struct event_queue *q, intptr_t retval); | 607 | void (*queue_reply)(struct event_queue *q, intptr_t retval); |
583 | #endif /* CONFIG_CODEC == SWCODEC */ | 608 | #endif /* CONFIG_CODEC == SWCODEC */ |
584 | 609 | ||
585 | void (*usb_acknowledge)(long id); | ||
586 | #ifdef USB_ENABLE_HID | ||
587 | void (*usb_hid_send)(usage_page_t usage_page, int id); | ||
588 | #endif | ||
589 | #ifdef RB_PROFILE | 610 | #ifdef RB_PROFILE |
590 | void (*profile_thread)(void); | 611 | void (*profile_thread)(void); |
591 | void (*profstop)(void); | 612 | void (*profstop)(void); |
@@ -658,6 +679,7 @@ struct plugin_api { | |||
658 | 679 | ||
659 | /* sound */ | 680 | /* sound */ |
660 | void (*sound_set)(int setting, int value); | 681 | void (*sound_set)(int setting, int value); |
682 | int (*sound_current)(int setting); /*stub*/ | ||
661 | int (*sound_default)(int setting); | 683 | int (*sound_default)(int setting); |
662 | int (*sound_min)(int setting); | 684 | int (*sound_min)(int setting); |
663 | int (*sound_max)(int setting); | 685 | int (*sound_max)(int setting); |
@@ -667,6 +689,10 @@ struct plugin_api { | |||
667 | int (*sound_enum_hw_eq_band_setting)(unsigned int band, | 689 | int (*sound_enum_hw_eq_band_setting)(unsigned int band, |
668 | unsigned int band_setting); | 690 | unsigned int band_setting); |
669 | #endif /* AUDIOHW_HAVE_EQ */ | 691 | #endif /* AUDIOHW_HAVE_EQ */ |
692 | #if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \ | ||
693 | (CONFIG_CODEC == SWCODEC)) && defined (HAVE_PITCHCONTROL) | ||
694 | void (*sound_set_pitch)(int32_t pitch); | ||
695 | #endif | ||
670 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | 696 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
671 | void (*mp3_play_data)(const void* start, size_t size, | 697 | void (*mp3_play_data)(const void* start, size_t size, |
672 | mp3_play_callback_t get_more); | 698 | mp3_play_callback_t get_more); |
@@ -743,7 +769,48 @@ struct plugin_api { | |||
743 | void (*pcmbuf_fade)(bool fade, bool in); | 769 | void (*pcmbuf_fade)(bool fade, bool in); |
744 | void (*system_sound_play)(enum system_sound sound); | 770 | void (*system_sound_play)(enum system_sound sound); |
745 | void (*keyclick_click)(bool rawbutton, int action); | 771 | void (*keyclick_click)(bool rawbutton, int action); |
746 | #endif /* CONFIG_CODEC == SWCODC */ | 772 | #endif /* CONFIG_CODEC == SWCODEC */ |
773 | |||
774 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | ||
775 | unsigned short (*peak_meter_scale_value)(unsigned short val, | ||
776 | int meterwidth); | ||
777 | void (*peak_meter_set_use_dbfs)(bool use); | ||
778 | bool (*peak_meter_get_use_dbfs)(void); | ||
779 | #endif | ||
780 | |||
781 | /* metadata */ | ||
782 | bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname); | ||
783 | bool (*mp3info)(struct mp3entry *entry, const char *filename); | ||
784 | int (*count_mp3_frames)(int fd, int startpos, int filesize, | ||
785 | void (*progressfunc)(int), | ||
786 | unsigned char* buf, size_t buflen); | ||
787 | int (*create_xing_header)(int fd, long startpos, long filesize, | ||
788 | unsigned char *buf, unsigned long num_frames, | ||
789 | unsigned long rec_time, unsigned long header_template, | ||
790 | void (*progressfunc)(int), bool generate_toc, | ||
791 | unsigned char* tempbuf, size_t tempbuf_len); | ||
792 | unsigned long (*find_next_frame)(int fd, long *offset, | ||
793 | long max_offset, unsigned long reference_header); | ||
794 | #ifdef HAVE_TAGCACHE | ||
795 | bool (*tagcache_search)(struct tagcache_search *tcs, int tag); | ||
796 | void (*tagcache_search_set_uniqbuf)(struct tagcache_search *tcs, | ||
797 | void *buffer, long length); | ||
798 | bool (*tagcache_search_add_filter)(struct tagcache_search *tcs, | ||
799 | int tag, int seek); | ||
800 | bool (*tagcache_get_next)(struct tagcache_search *tcs); | ||
801 | bool (*tagcache_retrieve)(struct tagcache_search *tcs, int idxid, | ||
802 | int tag, char *buf, long size); | ||
803 | void (*tagcache_search_finish)(struct tagcache_search *tcs); | ||
804 | long (*tagcache_get_numeric)(const struct tagcache_search *tcs, int tag); | ||
805 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) | ||
806 | bool (*tagcache_fill_tags)(struct mp3entry *id3, const char *filename); | ||
807 | #endif | ||
808 | #endif /* HAVE_TAGCACHE */ | ||
809 | |||
810 | #ifdef HAVE_ALBUMART | ||
811 | bool (*search_albumart_files)(const struct mp3entry *id3, const char *size_string, | ||
812 | char *buf, int buflen); | ||
813 | #endif | ||
747 | 814 | ||
748 | /* playback control */ | 815 | /* playback control */ |
749 | int (*playlist_amount)(void); | 816 | int (*playlist_amount)(void); |
@@ -777,10 +844,6 @@ struct plugin_api { | |||
777 | #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) | 844 | #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) |
778 | unsigned long (*mpeg_get_last_header)(void); | 845 | unsigned long (*mpeg_get_last_header)(void); |
779 | #endif | 846 | #endif |
780 | #if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \ | ||
781 | (CONFIG_CODEC == SWCODEC)) && defined (HAVE_PITCHCONTROL) | ||
782 | void (*sound_set_pitch)(int32_t pitch); | ||
783 | #endif | ||
784 | 847 | ||
785 | /* MAS communication */ | 848 | /* MAS communication */ |
786 | #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) | 849 | #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) |
@@ -795,7 +858,7 @@ struct plugin_api { | |||
795 | void (*i2c_end)(void); | 858 | void (*i2c_end)(void); |
796 | int (*i2c_write)(int address, const unsigned char* buf, int count ); | 859 | int (*i2c_write)(int address, const unsigned char* buf, int count ); |
797 | #endif | 860 | #endif |
798 | #endif | 861 | #endif /* !SIMULATOR && CONFIG_CODEC != SWCODEC */ |
799 | 862 | ||
800 | /* menu */ | 863 | /* menu */ |
801 | struct menu_table *(*root_menu_get_options)(int *nb_options); | 864 | struct menu_table *(*root_menu_get_options)(int *nb_options); |
@@ -805,7 +868,7 @@ struct plugin_api { | |||
805 | char* (*root_menu_write_to_cfg)(void* setting, char*buf, int buf_len); | 868 | char* (*root_menu_write_to_cfg)(void* setting, char*buf, int buf_len); |
806 | void (*root_menu_load_from_cfg)(void* setting, char *value); | 869 | void (*root_menu_load_from_cfg)(void* setting, char *value); |
807 | 870 | ||
808 | /* scroll bar */ | 871 | /* statusbars */ |
809 | struct gui_syncstatusbar *statusbars; | 872 | struct gui_syncstatusbar *statusbars; |
810 | void (*gui_syncstatusbar_draw)(struct gui_syncstatusbar * bars, bool force_redraw); | 873 | void (*gui_syncstatusbar_draw)(struct gui_syncstatusbar * bars, bool force_redraw); |
811 | 874 | ||
@@ -838,14 +901,6 @@ struct plugin_api { | |||
838 | bool (*set_color)(struct screen *display, char *title, | 901 | bool (*set_color)(struct screen *display, char *title, |
839 | unsigned *color, unsigned banned_color); | 902 | unsigned *color, unsigned banned_color); |
840 | #endif | 903 | #endif |
841 | /* action handling */ | ||
842 | int (*get_custom_action)(int context,int timeout, | ||
843 | const struct button_mapping* (*get_context_map)(int)); | ||
844 | int (*get_action)(int context, int timeout); | ||
845 | #ifdef HAVE_TOUCHSCREEN | ||
846 | int (*action_get_touchscreen_press)(short *x, short *y); | ||
847 | #endif | ||
848 | bool (*action_userabort)(int timeout); | ||
849 | 904 | ||
850 | /* power */ | 905 | /* power */ |
851 | int (*battery_level)(void); | 906 | int (*battery_level)(void); |
@@ -860,7 +915,10 @@ struct plugin_api { | |||
860 | #endif | 915 | #endif |
861 | /* usb */ | 916 | /* usb */ |
862 | bool (*usb_inserted)(void); | 917 | bool (*usb_inserted)(void); |
863 | 918 | void (*usb_acknowledge)(long id); | |
919 | #ifdef USB_ENABLE_HID | ||
920 | void (*usb_hid_send)(usage_page_t usage_page, int id); | ||
921 | #endif | ||
864 | /* misc */ | 922 | /* misc */ |
865 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | 923 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
866 | int * (*__errno)(void); | 924 | int * (*__errno)(void); |
@@ -876,14 +934,7 @@ struct plugin_api { | |||
876 | #if CONFIG_RTC | 934 | #if CONFIG_RTC |
877 | time_t (*mktime)(struct tm *t); | 935 | time_t (*mktime)(struct tm *t); |
878 | #endif | 936 | #endif |
879 | void* (*plugin_get_buffer)(size_t *buffer_size); | 937 | |
880 | void* (*plugin_get_audio_buffer)(size_t *buffer_size); | ||
881 | void (*plugin_release_audio_buffer)(void); | ||
882 | void (*plugin_tsr)(bool (*exit_callback)(bool reenter)); | ||
883 | char* (*plugin_get_current_filename)(void); | ||
884 | #ifdef PLUGIN_USE_IRAM | ||
885 | void (*audio_hard_stop)(void); | ||
886 | #endif | ||
887 | #if defined(DEBUG) || defined(SIMULATOR) | 938 | #if defined(DEBUG) || defined(SIMULATOR) |
888 | void (*debugf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2); | 939 | void (*debugf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2); |
889 | #endif | 940 | #endif |
@@ -904,25 +955,7 @@ struct plugin_api { | |||
904 | int count, | 955 | int count, |
905 | bool signd); | 956 | bool signd); |
906 | #endif /* CONFIG_CODEC == SWCODEC */ | 957 | #endif /* CONFIG_CODEC == SWCODEC */ |
907 | bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname); | ||
908 | bool (*mp3info)(struct mp3entry *entry, const char *filename); | ||
909 | int (*count_mp3_frames)(int fd, int startpos, int filesize, | ||
910 | void (*progressfunc)(int), | ||
911 | unsigned char* buf, size_t buflen); | ||
912 | int (*create_xing_header)(int fd, long startpos, long filesize, | ||
913 | unsigned char *buf, unsigned long num_frames, | ||
914 | unsigned long rec_time, unsigned long header_template, | ||
915 | void (*progressfunc)(int), bool generate_toc, | ||
916 | unsigned char* tempbuf, size_t tempbuf_len); | ||
917 | unsigned long (*find_next_frame)(int fd, long *offset, | ||
918 | long max_offset, unsigned long reference_header); | ||
919 | 958 | ||
920 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | ||
921 | unsigned short (*peak_meter_scale_value)(unsigned short val, | ||
922 | int meterwidth); | ||
923 | void (*peak_meter_set_use_dbfs)(bool use); | ||
924 | bool (*peak_meter_get_use_dbfs)(void); | ||
925 | #endif | ||
926 | #ifdef HAVE_LCD_BITMAP | 959 | #ifdef HAVE_LCD_BITMAP |
927 | int (*read_bmp_file)(const char* filename, struct bitmap *bm, int maxsize, | 960 | int (*read_bmp_file)(const char* filename, struct bitmap *bm, int maxsize, |
928 | int format, const struct custom_format *cformat); | 961 | int format, const struct custom_format *cformat); |
@@ -937,12 +970,6 @@ struct plugin_api { | |||
937 | void (*screen_dump_set_hook)(void (*hook)(int fh)); | 970 | void (*screen_dump_set_hook)(void (*hook)(int fh)); |
938 | #endif | 971 | #endif |
939 | int (*show_logo)(void); | 972 | int (*show_logo)(void); |
940 | struct tree_context* (*tree_get_context)(void); | ||
941 | struct entry* (*tree_get_entries)(struct tree_context* t); | ||
942 | struct entry* (*tree_get_entry_at)(struct tree_context* t, int index); | ||
943 | |||
944 | void (*set_current_file)(const char* path); | ||
945 | void (*set_dirfilter)(int l_dirfilter); | ||
946 | 973 | ||
947 | #ifdef HAVE_WHEEL_POSITION | 974 | #ifdef HAVE_WHEEL_POSITION |
948 | int (*wheel_status)(void); | 975 | int (*wheel_status)(void); |
@@ -958,32 +985,16 @@ struct plugin_api { | |||
958 | 985 | ||
959 | void (*led)(bool on); | 986 | void (*led)(bool on); |
960 | 987 | ||
961 | #ifdef HAVE_TAGCACHE | 988 | /*plugin*/ |
962 | bool (*tagcache_search)(struct tagcache_search *tcs, int tag); | 989 | void* (*plugin_get_buffer)(size_t *buffer_size); |
963 | void (*tagcache_search_set_uniqbuf)(struct tagcache_search *tcs, | 990 | void* (*plugin_get_audio_buffer)(size_t *buffer_size); |
964 | void *buffer, long length); | 991 | void (*plugin_release_audio_buffer)(void); |
965 | bool (*tagcache_search_add_filter)(struct tagcache_search *tcs, | 992 | void (*plugin_tsr)(bool (*exit_callback)(bool reenter)); |
966 | int tag, int seek); | 993 | char* (*plugin_get_current_filename)(void); |
967 | bool (*tagcache_get_next)(struct tagcache_search *tcs); | 994 | #ifdef PLUGIN_USE_IRAM |
968 | bool (*tagcache_retrieve)(struct tagcache_search *tcs, int idxid, | 995 | void (*audio_hard_stop)(void); |
969 | int tag, char *buf, long size); | ||
970 | void (*tagcache_search_finish)(struct tagcache_search *tcs); | ||
971 | long (*tagcache_get_numeric)(const struct tagcache_search *tcs, int tag); | ||
972 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) | ||
973 | bool (*tagcache_fill_tags)(struct mp3entry *id3, const char *filename); | ||
974 | #endif | ||
975 | #endif | ||
976 | |||
977 | #ifdef HAVE_ALBUMART | ||
978 | bool (*search_albumart_files)(const struct mp3entry *id3, const char *size_string, | ||
979 | char *buf, int buflen); | ||
980 | #endif | 996 | #endif |
981 | 997 | ||
982 | #ifdef HAVE_SEMAPHORE_OBJECTS | ||
983 | void (*semaphore_init)(struct semaphore *s, int max, int start); | ||
984 | int (*semaphore_wait)(struct semaphore *s, int timeout); | ||
985 | void (*semaphore_release)(struct semaphore *s); | ||
986 | #endif | ||
987 | 998 | ||
988 | /* new stuff at the end, sort into place next time | 999 | /* new stuff at the end, sort into place next time |
989 | the API gets incompatible */ | 1000 | the API gets incompatible */ |