diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-10-20 21:54:59 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-10-20 21:54:59 +0000 |
commit | d85c3ec41020a6c56b0d5d95a9ed790f57d73c6e (patch) | |
tree | 2f51ed47fee689024ed8c145634044362c8ed7d5 | |
parent | 774bacc692b4d5c7b769bb88d24e182db9e4656f (diff) | |
download | rockbox-d85c3ec41020a6c56b0d5d95a9ed790f57d73c6e.tar.gz rockbox-d85c3ec41020a6c56b0d5d95a9ed790f57d73c6e.zip |
Convert lcd_activation callbacks to use the event system to allow for multiple parallel callbacks (for custom statusbar).
Increase maximum event count as we need more (I actually had a report about it during custom statusbar testing).
Removed corresponding functions from the core and plugin api. Bump min version and sort.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23302 a1c6a512-1295-4272-9138-f99709370657
32 files changed, 57 insertions, 117 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 11ce946e98..6d9d8443dd 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c | |||
@@ -562,8 +562,9 @@ static void play_hop(int direction) | |||
562 | * we suppress updates until the wps is activated again (the lcd driver will | 562 | * we suppress updates until the wps is activated again (the lcd driver will |
563 | * call this hook to issue an instant update) | 563 | * call this hook to issue an instant update) |
564 | * */ | 564 | * */ |
565 | static void wps_lcd_activation_hook(void) | 565 | static void wps_lcd_activation_hook(void *param) |
566 | { | 566 | { |
567 | (void)param; | ||
567 | wps_state.do_full_update = true; | 568 | wps_state.do_full_update = true; |
568 | /* force timeout in wps main loop, so that the update is instantly */ | 569 | /* force timeout in wps main loop, so that the update is instantly */ |
569 | queue_post(&button_queue, BUTTON_NONE, 0); | 570 | queue_post(&button_queue, BUTTON_NONE, 0); |
@@ -585,7 +586,7 @@ static void gwps_leave_wps(void) | |||
585 | viewportmanager_set_statusbar(oldbars); | 586 | viewportmanager_set_statusbar(oldbars); |
586 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 587 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
587 | /* Play safe and unregister the hook */ | 588 | /* Play safe and unregister the hook */ |
588 | lcd_activation_set_hook(NULL); | 589 | remove_event(LCD_EVENT_ACTIVATION, wps_lcd_activation_hook); |
589 | #endif | 590 | #endif |
590 | /* unhandle statusbar update delay */ | 591 | /* unhandle statusbar update delay */ |
591 | sb_skin_set_update_delay(DEFAULT_UPDATE_DELAY); | 592 | sb_skin_set_update_delay(DEFAULT_UPDATE_DELAY); |
@@ -1164,13 +1165,9 @@ long gui_wps_show(void) | |||
1164 | FOR_NB_SCREENS(i) | 1165 | FOR_NB_SCREENS(i) |
1165 | { | 1166 | { |
1166 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 1167 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
1167 | if (lcd_active() | ||
1168 | #ifdef HAVE_REMOTE_LCD | ||
1169 | /* currently, all remotes are readable without backlight | 1168 | /* currently, all remotes are readable without backlight |
1170 | * so still update those */ | 1169 | * so still update those */ |
1171 | || (i == SCREEN_REMOTE) | 1170 | if (lcd_active() || (i != SCREEN_MAIN)) |
1172 | #endif | ||
1173 | ) | ||
1174 | #endif | 1171 | #endif |
1175 | { | 1172 | { |
1176 | skin_update(&gui_wps[i], WPS_REFRESH_NON_STATIC); | 1173 | skin_update(&gui_wps[i], WPS_REFRESH_NON_STATIC); |
@@ -1193,7 +1190,7 @@ long gui_wps_show(void) | |||
1193 | restore = false; | 1190 | restore = false; |
1194 | restoretimer = RESTORE_WPS_INSTANTLY; | 1191 | restoretimer = RESTORE_WPS_INSTANTLY; |
1195 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 1192 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
1196 | lcd_activation_set_hook(wps_lcd_activation_hook); | 1193 | add_event(LCD_EVENT_ACTIVATION, false, wps_lcd_activation_hook); |
1197 | #endif | 1194 | #endif |
1198 | /* we remove the update delay since it's not very usable in the wps, | 1195 | /* we remove the update delay since it's not very usable in the wps, |
1199 | * e.g. during volume changing or ffwd/rewind */ | 1196 | * e.g. during volume changing or ffwd/rewind */ |
diff --git a/apps/plugin.c b/apps/plugin.c index 77fb925ba2..ae889d68fd 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -155,7 +155,6 @@ static const struct plugin_api rockbox_api = { | |||
155 | lcd_set_mode, | 155 | lcd_set_mode, |
156 | #endif | 156 | #endif |
157 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 157 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
158 | lcd_activation_set_hook, | ||
159 | &button_queue, | 158 | &button_queue, |
160 | #endif | 159 | #endif |
161 | bidi_l2v, | 160 | bidi_l2v, |
@@ -255,6 +254,7 @@ static const struct plugin_api rockbox_api = { | |||
255 | button_status, | 254 | button_status, |
256 | #ifdef HAVE_BUTTON_DATA | 255 | #ifdef HAVE_BUTTON_DATA |
257 | button_get_data, | 256 | button_get_data, |
257 | button_status_wdata, | ||
258 | #endif | 258 | #endif |
259 | button_clear_queue, | 259 | button_clear_queue, |
260 | button_queue_count, | 260 | button_queue_count, |
@@ -376,6 +376,9 @@ static const struct plugin_api rockbox_api = { | |||
376 | __cyg_profile_func_enter, | 376 | __cyg_profile_func_enter, |
377 | __cyg_profile_func_exit, | 377 | __cyg_profile_func_exit, |
378 | #endif | 378 | #endif |
379 | add_event, | ||
380 | remove_event, | ||
381 | send_event, | ||
379 | 382 | ||
380 | #ifdef SIMULATOR | 383 | #ifdef SIMULATOR |
381 | /* special simulator hooks */ | 384 | /* special simulator hooks */ |
@@ -668,9 +671,6 @@ static const struct plugin_api rockbox_api = { | |||
668 | appsversion, | 671 | appsversion, |
669 | /* new stuff at the end, sort into place next time | 672 | /* new stuff at the end, sort into place next time |
670 | the API gets incompatible */ | 673 | the API gets incompatible */ |
671 | #ifdef HAVE_BUTTON_DATA | ||
672 | button_status_wdata, | ||
673 | #endif | ||
674 | }; | 674 | }; |
675 | 675 | ||
676 | int plugin_load(const char* plugin, const void* parameter) | 676 | int plugin_load(const char* plugin, const void* parameter) |
diff --git a/apps/plugin.h b/apps/plugin.h index 6ff7e7e568..7ea1943395 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -133,12 +133,12 @@ void* plugin_get_buffer(size_t *buffer_size); | |||
133 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 133 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
134 | 134 | ||
135 | /* increase this every time the api struct changes */ | 135 | /* increase this every time the api struct changes */ |
136 | #define PLUGIN_API_VERSION 172 | 136 | #define PLUGIN_API_VERSION 173 |
137 | 137 | ||
138 | /* update this to latest version if a change to the api struct breaks | 138 | /* update this to latest version if a change to the api struct breaks |
139 | backwards compatibility (and please take the opportunity to sort in any | 139 | backwards compatibility (and please take the opportunity to sort in any |
140 | new function which are "waiting" at the end of the function table) */ | 140 | new function which are "waiting" at the end of the function table) */ |
141 | #define PLUGIN_MIN_API_VERSION 172 | 141 | #define PLUGIN_MIN_API_VERSION 173 |
142 | 142 | ||
143 | /* plugin return codes */ | 143 | /* plugin return codes */ |
144 | enum plugin_status { | 144 | enum plugin_status { |
@@ -244,7 +244,6 @@ struct plugin_api { | |||
244 | #endif | 244 | #endif |
245 | 245 | ||
246 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 246 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
247 | void (*lcd_activation_set_hook)(void (*enable_hook)(void)); | ||
248 | struct event_queue *button_queue; | 247 | struct event_queue *button_queue; |
249 | #endif | 248 | #endif |
250 | unsigned short *(*bidi_l2v)( const unsigned char *str, int orientation ); | 249 | unsigned short *(*bidi_l2v)( const unsigned char *str, int orientation ); |
@@ -367,6 +366,7 @@ struct plugin_api { | |||
367 | int (*button_status)(void); | 366 | int (*button_status)(void); |
368 | #ifdef HAVE_BUTTON_DATA | 367 | #ifdef HAVE_BUTTON_DATA |
369 | intptr_t (*button_get_data)(void); | 368 | intptr_t (*button_get_data)(void); |
369 | int (*button_status_wdata)(int *pdata); | ||
370 | #endif | 370 | #endif |
371 | void (*button_clear_queue)(void); | 371 | void (*button_clear_queue)(void); |
372 | int (*button_queue_count)(void); | 372 | int (*button_queue_count)(void); |
@@ -500,6 +500,10 @@ struct plugin_api { | |||
500 | void (*profile_func_enter)(void *this_fn, void *call_site); | 500 | void (*profile_func_enter)(void *this_fn, void *call_site); |
501 | void (*profile_func_exit)(void *this_fn, void *call_site); | 501 | void (*profile_func_exit)(void *this_fn, void *call_site); |
502 | #endif | 502 | #endif |
503 | /* event api */ | ||
504 | bool (*add_event)(unsigned short id, bool oneshot, void (*handler)(void *data)); | ||
505 | void (*remove_event)(unsigned short id, void (*handler)(void *data)); | ||
506 | void (*send_event)(unsigned short id, void *data); | ||
503 | 507 | ||
504 | #ifdef SIMULATOR | 508 | #ifdef SIMULATOR |
505 | /* special simulator hooks */ | 509 | /* special simulator hooks */ |
@@ -837,10 +841,6 @@ struct plugin_api { | |||
837 | const char *appsversion; | 841 | const char *appsversion; |
838 | /* new stuff at the end, sort into place next time | 842 | /* new stuff at the end, sort into place next time |
839 | the API gets incompatible */ | 843 | the API gets incompatible */ |
840 | |||
841 | #ifdef HAVE_BUTTON_DATA | ||
842 | int (*button_status_wdata)(int *pdata); | ||
843 | #endif | ||
844 | }; | 844 | }; |
845 | 845 | ||
846 | /* plugin header */ | 846 | /* plugin header */ |
diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c index df926f4c17..eb55c1444e 100644 --- a/apps/plugins/mpegplayer/mpeg_settings.c +++ b/apps/plugins/mpegplayer/mpeg_settings.c | |||
@@ -599,8 +599,9 @@ static uint32_t increment_time(uint32_t val, int32_t amount, uint32_t range) | |||
599 | } | 599 | } |
600 | 600 | ||
601 | #if defined(HAVE_LCD_ENABLE) && defined(HAVE_LCD_COLOR) | 601 | #if defined(HAVE_LCD_ENABLE) && defined(HAVE_LCD_COLOR) |
602 | static void get_start_time_lcd_enable_hook(void) | 602 | static void get_start_time_lcd_enable_hook(void *param) |
603 | { | 603 | { |
604 | (void)param; | ||
604 | rb->queue_post(rb->button_queue, LCD_ENABLE_EVENT_0, 0); | 605 | rb->queue_post(rb->button_queue, LCD_ENABLE_EVENT_0, 0); |
605 | } | 606 | } |
606 | #endif /* HAVE_LCD_ENABLE */ | 607 | #endif /* HAVE_LCD_ENABLE */ |
@@ -619,7 +620,7 @@ static int get_start_time(uint32_t duration) | |||
619 | lcd_(update)(); | 620 | lcd_(update)(); |
620 | 621 | ||
621 | #if defined(HAVE_LCD_ENABLE) && defined(HAVE_LCD_COLOR) | 622 | #if defined(HAVE_LCD_ENABLE) && defined(HAVE_LCD_COLOR) |
622 | rb->lcd_activation_set_hook(get_start_time_lcd_enable_hook); | 623 | rb->add_event(LCD_EVENT_ACTIVATION, false, get_start_time_lcd_enable_hook); |
623 | #endif | 624 | #endif |
624 | 625 | ||
625 | draw_slider(0, 100, &rc_bound); | 626 | draw_slider(0, 100, &rc_bound); |
@@ -810,7 +811,7 @@ static int get_start_time(uint32_t duration) | |||
810 | } | 811 | } |
811 | 812 | ||
812 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 813 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
813 | rb->lcd_activation_set_hook(NULL); | 814 | rb->remove_event(LCD_EVENT_ACTIVATION, get_start_time_lcd_enable_hook); |
814 | #endif | 815 | #endif |
815 | #ifndef HAVE_LCD_COLOR | 816 | #ifndef HAVE_LCD_COLOR |
816 | stream_gray_show(false); | 817 | stream_gray_show(false); |
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index 0cb5f94d19..7c52a47260 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c | |||
@@ -652,8 +652,9 @@ static void draw_putsxy_oriented(int x, int y, const char *str) | |||
652 | 652 | ||
653 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 653 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
654 | /* So we can refresh the overlay */ | 654 | /* So we can refresh the overlay */ |
655 | static void wvs_lcd_enable_hook(void) | 655 | static void wvs_lcd_enable_hook(void* param) |
656 | { | 656 | { |
657 | (void)param; | ||
657 | rb->queue_post(rb->button_queue, LCD_ENABLE_EVENT_1, 0); | 658 | rb->queue_post(rb->button_queue, LCD_ENABLE_EVENT_1, 0); |
658 | } | 659 | } |
659 | #endif | 660 | #endif |
@@ -665,11 +666,11 @@ static void wvs_backlight_on_video_mode(bool video_on) | |||
665 | /* backlight control in lib/helper.c */ | 666 | /* backlight control in lib/helper.c */ |
666 | backlight_force_on(); | 667 | backlight_force_on(); |
667 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 668 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
668 | rb->lcd_activation_set_hook(NULL); | 669 | rb->remove_event(LCD_EVENT_ACTIVATION, wvs_lcd_enable_hook); |
669 | #endif | 670 | #endif |
670 | } else { | 671 | } else { |
671 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 672 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
672 | rb->lcd_activation_set_hook(wvs_lcd_enable_hook); | 673 | rb->add_event(LCD_EVENT_ACTIVATION, false, wvs_lcd_enable_hook); |
673 | #endif | 674 | #endif |
674 | /* Revert to user's backlight settings */ | 675 | /* Revert to user's backlight settings */ |
675 | backlight_use_settings(); | 676 | backlight_use_settings(); |
@@ -1671,7 +1672,7 @@ static void button_loop(void) | |||
1671 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 1672 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
1672 | /* Be sure hook is removed before exiting since the stop will put it | 1673 | /* Be sure hook is removed before exiting since the stop will put it |
1673 | * back because of the backlight restore. */ | 1674 | * back because of the backlight restore. */ |
1674 | rb->lcd_activation_set_hook(NULL); | 1675 | rb->remove_event(LCD_EVENT_ACTIVATION, wvs_lcd_enable_hook); |
1675 | #endif | 1676 | #endif |
1676 | 1677 | ||
1677 | rb->lcd_setfont(FONT_UI); | 1678 | rb->lcd_setfont(FONT_UI); |
diff --git a/docs/PLUGIN_API.new b/docs/PLUGIN_API.new index 876af375a2..1989386661 100644 --- a/docs/PLUGIN_API.new +++ b/docs/PLUGIN_API.new | |||
@@ -1384,11 +1384,6 @@ void lcd_set_drawmode(int mode) | |||
1384 | \param mode | 1384 | \param mode |
1385 | \description | 1385 | \description |
1386 | 1386 | ||
1387 | void lcd_activation_set_hook(void (*enable_hook)(void)) | ||
1388 | \conditions !defined(HAVE_LCD_CHARCELLS) && (defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)) | ||
1389 | \param enable_hook | ||
1390 | \description | ||
1391 | |||
1392 | void lcd_set_foreground(unsigned foreground) | 1387 | void lcd_set_foreground(unsigned foreground) |
1393 | \group lcd | 1388 | \group lcd |
1394 | \conditions !defined(HAVE_LCD_CHARCELLS) && (LCD_DEPTH > 1) | 1389 | \conditions !defined(HAVE_LCD_CHARCELLS) && (LCD_DEPTH > 1) |
diff --git a/firmware/drivers/lcd-16bit-vert.c b/firmware/drivers/lcd-16bit-vert.c index 887505766c..1e49bb354d 100644 --- a/firmware/drivers/lcd-16bit-vert.c +++ b/firmware/drivers/lcd-16bit-vert.c | |||
@@ -75,27 +75,6 @@ static struct viewport* current_vp IDATA_ATTR = &default_vp; | |||
75 | struct viewport* current_vp IDATA_ATTR = &default_vp; | 75 | struct viewport* current_vp IDATA_ATTR = &default_vp; |
76 | #endif | 76 | #endif |
77 | 77 | ||
78 | |||
79 | /*** Helpers - consolidate optional code ***/ | ||
80 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | ||
81 | static void (*lcd_activation_hook)(void) = NULL; | ||
82 | |||
83 | void lcd_activation_set_hook(void (*func)(void)) | ||
84 | { | ||
85 | lcd_activation_hook = func; | ||
86 | } | ||
87 | |||
88 | /* To be called by target driver after enabling display and refreshing it */ | ||
89 | void lcd_activation_call_hook(void) | ||
90 | { | ||
91 | void (*func)(void) = lcd_activation_hook; | ||
92 | |||
93 | if (func != NULL) | ||
94 | func(); | ||
95 | } | ||
96 | |||
97 | #endif | ||
98 | |||
99 | /* LCD init */ | 78 | /* LCD init */ |
100 | void lcd_init(void) | 79 | void lcd_init(void) |
101 | { | 80 | { |
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index 7238d7a923..d1b417a00a 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c | |||
@@ -74,27 +74,6 @@ static struct viewport* current_vp IDATA_ATTR = &default_vp; | |||
74 | struct viewport* current_vp IDATA_ATTR = &default_vp; | 74 | struct viewport* current_vp IDATA_ATTR = &default_vp; |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | |||
78 | /*** Helpers - consolidate optional code ***/ | ||
79 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | ||
80 | static void (*lcd_activation_hook)(void) = NULL; | ||
81 | |||
82 | void lcd_activation_set_hook(void (*func)(void)) | ||
83 | { | ||
84 | lcd_activation_hook = func; | ||
85 | } | ||
86 | |||
87 | /* To be called by target driver after enabling display and refreshing it */ | ||
88 | void lcd_activation_call_hook(void) | ||
89 | { | ||
90 | void (*func)(void) = lcd_activation_hook; | ||
91 | |||
92 | if (func != NULL) | ||
93 | func(); | ||
94 | } | ||
95 | |||
96 | #endif | ||
97 | |||
98 | /* LCD init */ | 77 | /* LCD init */ |
99 | void lcd_init(void) | 78 | void lcd_init(void) |
100 | { | 79 | { |
diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c index dd6c7cd354..9607f284aa 100644 --- a/firmware/drivers/lcd-1bit-vert.c +++ b/firmware/drivers/lcd-1bit-vert.c | |||
@@ -91,25 +91,6 @@ void LCDFN(init)(void) | |||
91 | #endif | 91 | #endif |
92 | } | 92 | } |
93 | 93 | ||
94 | #ifdef MAIN_LCD | ||
95 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | ||
96 | static void (*lcd_activation_hook)(void) = NULL; | ||
97 | |||
98 | void lcd_activation_set_hook(void (*func)(void)) | ||
99 | { | ||
100 | lcd_activation_hook = func; | ||
101 | } | ||
102 | |||
103 | void lcd_activation_call_hook(void) | ||
104 | { | ||
105 | void (*func)(void) = lcd_activation_hook; | ||
106 | |||
107 | if (func != NULL) | ||
108 | func(); | ||
109 | } | ||
110 | #endif | ||
111 | #endif | ||
112 | |||
113 | /*** parameter handling ***/ | 94 | /*** parameter handling ***/ |
114 | 95 | ||
115 | void LCDFN(set_drawmode)(int mode) | 96 | void LCDFN(set_drawmode)(int mode) |
diff --git a/firmware/events.c b/firmware/events.c index dca612bc7b..74172e1fa0 100644 --- a/firmware/events.c +++ b/firmware/events.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include "events.h" | 23 | #include "events.h" |
24 | #include "panic.h" | 24 | #include "panic.h" |
25 | 25 | ||
26 | #define MAX_SYS_EVENTS 20 | 26 | #define MAX_SYS_EVENTS 28 |
27 | 27 | ||
28 | struct sysevent { | 28 | struct sysevent { |
29 | unsigned short id; | 29 | unsigned short id; |
diff --git a/firmware/export/events.h b/firmware/export/events.h index 694566a43e..42ddf58441 100644 --- a/firmware/export/events.h +++ b/firmware/export/events.h | |||
@@ -37,6 +37,7 @@ | |||
37 | #define EVENT_CLASS_PLAYBACK 0x0200 | 37 | #define EVENT_CLASS_PLAYBACK 0x0200 |
38 | #define EVENT_CLASS_BUFFERING 0x0400 | 38 | #define EVENT_CLASS_BUFFERING 0x0400 |
39 | #define EVENT_CLASS_GUI 0x0800 | 39 | #define EVENT_CLASS_GUI 0x0800 |
40 | #define EVENT_CLASS_LCD 0xf000 | ||
40 | 41 | ||
41 | bool add_event(unsigned short id, bool oneshot, void (*handler)(void *data)); | 42 | bool add_event(unsigned short id, bool oneshot, void (*handler)(void *data)); |
42 | void remove_event(unsigned short id, void (*handler)(void *data)); | 43 | void remove_event(unsigned short id, void (*handler)(void *data)); |
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 91217ff76c..89f39437a0 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <stdbool.h> | 25 | #include <stdbool.h> |
26 | #include "cpu.h" | 26 | #include "cpu.h" |
27 | #include "config.h" | 27 | #include "config.h" |
28 | #include "events.h" | ||
28 | 29 | ||
29 | #define VP_FLAG_ALIGN_RIGHT 0x01 | 30 | #define VP_FLAG_ALIGN_RIGHT 0x01 |
30 | #define VP_FLAG_ALIGN_CENTER 0x02 | 31 | #define VP_FLAG_ALIGN_CENTER 0x02 |
@@ -426,13 +427,16 @@ extern void lcd_sleep(void); | |||
426 | * framebuffer data is synchronized */ | 427 | * framebuffer data is synchronized */ |
427 | /* Sansa Clip has these function in it's lcd driver, since it's the only | 428 | /* Sansa Clip has these function in it's lcd driver, since it's the only |
428 | * 1-bit display featuring lcd_active, so far */ | 429 | * 1-bit display featuring lcd_active, so far */ |
430 | |||
431 | enum { | ||
432 | LCD_EVENT_ACTIVATION = (EVENT_CLASS_LCD|1), | ||
433 | }; | ||
434 | |||
429 | extern bool lcd_active(void); | 435 | extern bool lcd_active(void); |
430 | extern void lcd_activation_set_hook(void (*enable_hook)(void)); | ||
431 | extern void lcd_activation_call_hook(void); | ||
432 | #endif | 436 | #endif |
433 | 437 | ||
434 | #ifdef HAVE_LCD_SHUTDOWN | 438 | #ifdef HAVE_LCD_SHUTDOWN |
435 | void lcd_shutdown(void); | 439 | extern void lcd_shutdown(void); |
436 | #endif | 440 | #endif |
437 | 441 | ||
438 | /* Bitmap formats */ | 442 | /* Bitmap formats */ |
diff --git a/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c b/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c index edc1d9810e..1ca26dd1a1 100644 --- a/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c +++ b/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c | |||
@@ -172,7 +172,7 @@ void lcd_enable(bool enable) | |||
172 | ascodec_write(AS3514_DCDC15, 1); | 172 | ascodec_write(AS3514_DCDC15, 1); |
173 | 173 | ||
174 | lcd_write_command(LCD_SET_DISPLAY_ON); | 174 | lcd_write_command(LCD_SET_DISPLAY_ON); |
175 | lcd_activation_call_hook(); | 175 | send_event(LCD_EVENT_ACTIVATION, NULL); |
176 | } | 176 | } |
177 | else { | 177 | else { |
178 | lcd_write_command(LCD_SET_DISPLAY_OFF); | 178 | lcd_write_command(LCD_SET_DISPLAY_OFF); |
diff --git a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c index a063ae4db8..7c3ccc2c0b 100644 --- a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c +++ b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c | |||
@@ -372,7 +372,7 @@ void lcd_enable(bool on) | |||
372 | if(on) | 372 | if(on) |
373 | { | 373 | { |
374 | _display_on(); | 374 | _display_on(); |
375 | lcd_activation_call_hook(); | 375 | send_event(LCD_EVENT_ACTIVATION, NULL); |
376 | } | 376 | } |
377 | else | 377 | else |
378 | { | 378 | { |
diff --git a/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c b/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c index d8cec6435b..21ecdf8afa 100644 --- a/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c +++ b/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c | |||
@@ -217,7 +217,7 @@ void lcd_enable(bool on) | |||
217 | lcd_write_reg(0x07, 0x17); | 217 | lcd_write_reg(0x07, 0x17); |
218 | display_on = true; | 218 | display_on = true; |
219 | lcd_update(); /* Resync display */ | 219 | lcd_update(); /* Resync display */ |
220 | lcd_activation_call_hook(); | 220 | send_event(LCD_EVENT_ACTIVATION, NULL); |
221 | sleep(0); | 221 | sleep(0); |
222 | 222 | ||
223 | } | 223 | } |
diff --git a/firmware/target/arm/imx31/gigabeat-s/lcd-imx31.c b/firmware/target/arm/imx31/gigabeat-s/lcd-imx31.c index c8d8b8a81e..fa1aed0fd6 100644 --- a/firmware/target/arm/imx31/gigabeat-s/lcd-imx31.c +++ b/firmware/target/arm/imx31/gigabeat-s/lcd-imx31.c | |||
@@ -122,7 +122,7 @@ void lcd_enable(bool state) | |||
122 | lcd_powered = true; | 122 | lcd_powered = true; |
123 | lcd_on = true; | 123 | lcd_on = true; |
124 | lcd_update(); | 124 | lcd_update(); |
125 | lcd_activation_call_hook(); | 125 | send_event(LCD_EVENT_ACTIVATION, NULL); |
126 | } | 126 | } |
127 | else | 127 | else |
128 | { | 128 | { |
diff --git a/firmware/target/arm/ipod/video/lcd-video.c b/firmware/target/arm/ipod/video/lcd-video.c index ecd28bb7c3..ea9738b3a4 100644 --- a/firmware/target/arm/ipod/video/lcd-video.c +++ b/firmware/target/arm/ipod/video/lcd-video.c | |||
@@ -618,7 +618,7 @@ void lcd_awake(void) | |||
618 | tick_add_task(&lcd_tick); | 618 | tick_add_task(&lcd_tick); |
619 | wakeup_wait(&(lcd_state.initwakeup), TIMEOUT_BLOCK); | 619 | wakeup_wait(&(lcd_state.initwakeup), TIMEOUT_BLOCK); |
620 | 620 | ||
621 | lcd_activation_call_hook(); | 621 | send_event(LCD_EVENT_ACTIVATION, NULL); |
622 | } | 622 | } |
623 | } | 623 | } |
624 | 624 | ||
diff --git a/firmware/target/arm/iriver/h10/lcd-h10_20gb.c b/firmware/target/arm/iriver/h10/lcd-h10_20gb.c index 4e6aebadd2..f6cf4cbcbb 100644 --- a/firmware/target/arm/iriver/h10/lcd-h10_20gb.c +++ b/firmware/target/arm/iriver/h10/lcd-h10_20gb.c | |||
@@ -380,7 +380,7 @@ void lcd_enable(bool on) | |||
380 | /* Probably out of sync and we don't wanna pepper the code with | 380 | /* Probably out of sync and we don't wanna pepper the code with |
381 | lcd_update() calls for this. */ | 381 | lcd_update() calls for this. */ |
382 | lcd_update(); | 382 | lcd_update(); |
383 | lcd_activation_call_hook(); | 383 | send_event(LCD_EVENT_ACTIVATION, NULL); |
384 | } | 384 | } |
385 | else | 385 | else |
386 | { | 386 | { |
diff --git a/firmware/target/arm/lcd-c200_c200v2.c b/firmware/target/arm/lcd-c200_c200v2.c index 3ba1bf0f07..62f1dc20f6 100644 --- a/firmware/target/arm/lcd-c200_c200v2.c +++ b/firmware/target/arm/lcd-c200_c200v2.c | |||
@@ -320,7 +320,7 @@ void lcd_enable(bool yesno) | |||
320 | { | 320 | { |
321 | lcd_send_command(R_STANDBY_OFF, 0); | 321 | lcd_send_command(R_STANDBY_OFF, 0); |
322 | lcd_send_command(R_DISPLAY_ON, 0); | 322 | lcd_send_command(R_DISPLAY_ON, 0); |
323 | lcd_activation_call_hook(); | 323 | send_event(LCD_EVENT_ACTIVATION, NULL); |
324 | } | 324 | } |
325 | else | 325 | else |
326 | { | 326 | { |
diff --git a/firmware/target/arm/philips/sa9200/lcd-sa9200.c b/firmware/target/arm/philips/sa9200/lcd-sa9200.c index 3937c078c6..51a3cf0f71 100755 --- a/firmware/target/arm/philips/sa9200/lcd-sa9200.c +++ b/firmware/target/arm/philips/sa9200/lcd-sa9200.c | |||
@@ -339,7 +339,7 @@ void lcd_enable(bool on) | |||
339 | /* Probably out of sync and we don't wanna pepper the code with | 339 | /* Probably out of sync and we don't wanna pepper the code with |
340 | lcd_update() calls for this. */ | 340 | lcd_update() calls for this. */ |
341 | lcd_update(); | 341 | lcd_update(); |
342 | lcd_activation_call_hook(); | 342 | send_event(LCD_EVENT_ACTIVATION, NULL); |
343 | } | 343 | } |
344 | else | 344 | else |
345 | { | 345 | { |
diff --git a/firmware/target/arm/s3c2440/lcd-s3c2440.c b/firmware/target/arm/s3c2440/lcd-s3c2440.c index b9f76b7400..d702b5713a 100644 --- a/firmware/target/arm/s3c2440/lcd-s3c2440.c +++ b/firmware/target/arm/s3c2440/lcd-s3c2440.c | |||
@@ -323,7 +323,7 @@ void lcd_enable(bool state) | |||
323 | 323 | ||
324 | lcd_on = true; | 324 | lcd_on = true; |
325 | lcd_update(); | 325 | lcd_update(); |
326 | lcd_activation_call_hook(); | 326 | send_event(LCD_EVENT_ACTIVATION, NULL); |
327 | } | 327 | } |
328 | else | 328 | else |
329 | { | 329 | { |
diff --git a/firmware/target/arm/samsung/yh820/lcd-yh820.c b/firmware/target/arm/samsung/yh820/lcd-yh820.c index 76ecdd293e..f7d971ab76 100644 --- a/firmware/target/arm/samsung/yh820/lcd-yh820.c +++ b/firmware/target/arm/samsung/yh820/lcd-yh820.c | |||
@@ -226,7 +226,7 @@ void lcd_enable(bool yesno) | |||
226 | { | 226 | { |
227 | lcd_send_command(R_STANDBY_OFF); | 227 | lcd_send_command(R_STANDBY_OFF); |
228 | lcd_send_command(R_DISPLAY_ON); | 228 | lcd_send_command(R_DISPLAY_ON); |
229 | lcd_activation_call_hook(); | 229 | send_event(LCD_EVENT_ACTIVATION, NULL); |
230 | } | 230 | } |
231 | else | 231 | else |
232 | { | 232 | { |
diff --git a/firmware/target/arm/samsung/yh925/lcd-yh925.c b/firmware/target/arm/samsung/yh925/lcd-yh925.c index 7509deff36..9ffcddf33a 100644 --- a/firmware/target/arm/samsung/yh925/lcd-yh925.c +++ b/firmware/target/arm/samsung/yh925/lcd-yh925.c | |||
@@ -492,7 +492,7 @@ void lcd_enable(bool on) | |||
492 | /* Probably out of sync and we don't wanna pepper the code with | 492 | /* Probably out of sync and we don't wanna pepper the code with |
493 | lcd_update() calls for this. */ | 493 | lcd_update() calls for this. */ |
494 | lcd_update(); | 494 | lcd_update(); |
495 | lcd_activation_call_hook(); | 495 | send_event(LCD_EVENT_ACTIVATION, NULL); |
496 | } | 496 | } |
497 | else | 497 | else |
498 | { | 498 | { |
diff --git a/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c b/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c index f31e0792a9..03f6a1b971 100644 --- a/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c +++ b/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c | |||
@@ -448,7 +448,7 @@ void lcd_enable(bool on) | |||
448 | DEV_EN |= DEV_LCD; /* Enable LCD controller */ | 448 | DEV_EN |= DEV_LCD; /* Enable LCD controller */ |
449 | lcd_display_on(); /* Turn on display */ | 449 | lcd_display_on(); /* Turn on display */ |
450 | lcd_update(); /* Resync display */ | 450 | lcd_update(); /* Resync display */ |
451 | lcd_activation_call_hook(); | 451 | send_event(LCD_EVENT_ACTIVATION, NULL); |
452 | LCD_REG_6 |= 1; /* Restart DMA */ | 452 | LCD_REG_6 |= 1; /* Restart DMA */ |
453 | sleep(HZ/50); /* Wait for a frame to be written */ | 453 | sleep(HZ/50); /* Wait for a frame to be written */ |
454 | } | 454 | } |
diff --git a/firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c b/firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c index 6da0d2c083..5d2a2b8194 100644 --- a/firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c +++ b/firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c | |||
@@ -143,7 +143,7 @@ void lcd_enable(bool on) | |||
143 | 143 | ||
144 | if (on) { | 144 | if (on) { |
145 | _display_on(); | 145 | _display_on(); |
146 | lcd_activation_call_hook(); | 146 | send_event(LCD_EVENT_ACTIVATION, NULL); |
147 | } else { | 147 | } else { |
148 | /** Off sequence according to datasheet, p. 130 **/ | 148 | /** Off sequence according to datasheet, p. 130 **/ |
149 | lcd_write_reg(R_FRAME_CYCLE_CONTROL, 0x0002); /* EQ=0, 18 clks/line */ | 149 | lcd_write_reg(R_FRAME_CYCLE_CONTROL, 0x0002); /* EQ=0, 18 clks/line */ |
diff --git a/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c b/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c index 034a53a022..d5a7e2f142 100644 --- a/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c +++ b/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c | |||
@@ -209,7 +209,7 @@ void lcd_enable(bool on) | |||
209 | lcd_display_on(); | 209 | lcd_display_on(); |
210 | LCDC_CTRL |= 1; /* controller enable */ | 210 | LCDC_CTRL |= 1; /* controller enable */ |
211 | lcd_update(); /* Resync display */ | 211 | lcd_update(); /* Resync display */ |
212 | lcd_activation_call_hook(); | 212 | send_event(LCD_EVENT_ACTIVATION, NULL); |
213 | } | 213 | } |
214 | else | 214 | else |
215 | { | 215 | { |
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c index e77c3a2311..3f1e621b54 100644 --- a/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c +++ b/firmware/target/arm/tms320dm320/creative-zvm/lcd-creativezvm.c | |||
@@ -237,7 +237,7 @@ return; | |||
237 | { | 237 | { |
238 | lcd_display_on(false); /* Turn on display */ | 238 | lcd_display_on(false); /* Turn on display */ |
239 | lcd_update(); /* Resync display */ | 239 | lcd_update(); /* Resync display */ |
240 | lcd_activation_call_hook(); | 240 | send_event(LCD_EVENT_ACTIVATION, NULL); |
241 | } | 241 | } |
242 | else | 242 | else |
243 | { | 243 | { |
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c index 201b6e8063..ac7754f5e9 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | |||
@@ -98,7 +98,7 @@ void lcd_awake(void) | |||
98 | sleep(HZ/10); | 98 | sleep(HZ/10); |
99 | 99 | ||
100 | 100 | ||
101 | lcd_activation_call_hook(); | 101 | send_event(LCD_EVENT_ACTIVATION, NULL); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | #endif | 104 | #endif |
diff --git a/firmware/target/coldfire/iaudio/x5/lcd-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-x5.c index 98eb5deb94..e1504b6e98 100644 --- a/firmware/target/coldfire/iaudio/x5/lcd-x5.c +++ b/firmware/target/coldfire/iaudio/x5/lcd-x5.c | |||
@@ -397,7 +397,7 @@ void lcd_enable(bool on) | |||
397 | /* Probably out of sync and we don't wanna pepper the code with | 397 | /* Probably out of sync and we don't wanna pepper the code with |
398 | lcd_update() calls for this. */ | 398 | lcd_update() calls for this. */ |
399 | lcd_update(); | 399 | lcd_update(); |
400 | lcd_activation_call_hook(); | 400 | send_event(LCD_EVENT_ACTIVATION, NULL); |
401 | } | 401 | } |
402 | else | 402 | else |
403 | { | 403 | { |
diff --git a/firmware/target/coldfire/iriver/h300/lcd-h300.c b/firmware/target/coldfire/iriver/h300/lcd-h300.c index 36f340eab7..ea0819aa3e 100644 --- a/firmware/target/coldfire/iriver/h300/lcd-h300.c +++ b/firmware/target/coldfire/iriver/h300/lcd-h300.c | |||
@@ -280,7 +280,7 @@ void lcd_enable(bool on) | |||
280 | if (on) | 280 | if (on) |
281 | { | 281 | { |
282 | _display_on(); | 282 | _display_on(); |
283 | lcd_activation_call_hook(); | 283 | send_event(LCD_EVENT_ACTIVATION, NULL); |
284 | } | 284 | } |
285 | else | 285 | else |
286 | { | 286 | { |
diff --git a/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c b/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c index edde538c99..99ffcf2981 100644 --- a/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c | |||
@@ -55,7 +55,7 @@ void lcd_enable(bool state) | |||
55 | { | 55 | { |
56 | lcd_on(); | 56 | lcd_on(); |
57 | #ifdef HAVE_LCD_ENABLE | 57 | #ifdef HAVE_LCD_ENABLE |
58 | lcd_activation_call_hook(); | 58 | send_event(LCD_EVENT_ACTIVATION, NULL); |
59 | #endif | 59 | #endif |
60 | } | 60 | } |
61 | else | 61 | else |
diff --git a/uisimulator/common/lcd-common.c b/uisimulator/common/lcd-common.c index 52db776856..2acf4b386d 100644 --- a/uisimulator/common/lcd-common.c +++ b/uisimulator/common/lcd-common.c | |||
@@ -22,7 +22,9 @@ | |||
22 | * | 22 | * |
23 | ****************************************************************************/ | 23 | ****************************************************************************/ |
24 | 24 | ||
25 | #include <stdbool.h> | ||
25 | #include "config.h" | 26 | #include "config.h" |
27 | #include "system.h" | ||
26 | #include "lcd.h" | 28 | #include "lcd.h" |
27 | 29 | ||
28 | #ifdef HAVE_LCD_ENABLE | 30 | #ifdef HAVE_LCD_ENABLE |
@@ -82,7 +84,7 @@ void lcd_awake(void) | |||
82 | { | 84 | { |
83 | if (lcd_sleeping) | 85 | if (lcd_sleeping) |
84 | { | 86 | { |
85 | lcd_activation_call_hook(); | 87 | send_event(LCD_EVENT_ACTIVATION, NULL); |
86 | lcd_sleeping = false; | 88 | lcd_sleeping = false; |
87 | } | 89 | } |
88 | } | 90 | } |
@@ -96,7 +98,7 @@ void lcd_enable(bool on) | |||
96 | /* lcd_awake will handle the activation call */ | 98 | /* lcd_awake will handle the activation call */ |
97 | lcd_awake(); | 99 | lcd_awake(); |
98 | #else | 100 | #else |
99 | lcd_activation_call_hook(); | 101 | send_event(LCD_EVENT_ACTIVATION, NULL); |
100 | #endif | 102 | #endif |
101 | } | 103 | } |
102 | lcd_enabled = on; | 104 | lcd_enabled = on; |