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 | |
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')
-rw-r--r-- | apps/codecs.c | 2 | ||||
-rw-r--r-- | apps/codecs.h | 6 | ||||
-rw-r--r-- | apps/debug_menu.c | 56 | ||||
-rw-r--r-- | apps/pcmbuf.c | 42 | ||||
-rw-r--r-- | apps/playback.c | 45 | ||||
-rw-r--r-- | apps/playlist.c | 4 | ||||
-rw-r--r-- | apps/plugin.c | 129 | ||||
-rw-r--r-- | apps/plugin.h | 156 | ||||
-rw-r--r-- | apps/plugins/alpine_cdc.c | 5 | ||||
-rw-r--r-- | apps/plugins/battery_bench.c | 7 | ||||
-rw-r--r-- | apps/tagcache.c | 9 |
11 files changed, 265 insertions, 196 deletions
diff --git a/apps/codecs.c b/apps/codecs.c index addb8b5e40..b4b8c9833a 100644 --- a/apps/codecs.c +++ b/apps/codecs.c | |||
@@ -123,7 +123,7 @@ struct codec_api ci = { | |||
123 | ¤t_tick, | 123 | ¤t_tick, |
124 | default_event_handler, | 124 | default_event_handler, |
125 | default_event_handler_ex, | 125 | default_event_handler_ex, |
126 | create_thread, | 126 | create_thread_on_core, |
127 | remove_thread, | 127 | remove_thread, |
128 | reset_poweroff_timer, | 128 | reset_poweroff_timer, |
129 | #ifndef SIMULATOR | 129 | #ifndef SIMULATOR |
diff --git a/apps/codecs.h b/apps/codecs.h index dde376d73c..96804a889b 100644 --- a/apps/codecs.h +++ b/apps/codecs.h | |||
@@ -196,8 +196,10 @@ struct codec_api { | |||
196 | long* current_tick; | 196 | long* current_tick; |
197 | long (*default_event_handler)(long event); | 197 | long (*default_event_handler)(long event); |
198 | long (*default_event_handler_ex)(long event, void (*callback)(void *), void *parameter); | 198 | long (*default_event_handler_ex)(long event, void (*callback)(void *), void *parameter); |
199 | int (*create_thread)(void (*function)(void), void* stack, int stack_size, const char *name); | 199 | struct thread_entry* (*create_thread)(unsigned int core, void (*function)(void), |
200 | void (*remove_thread)(int threadnum); | 200 | void* stack, int stack_size, const char *name |
201 | IF_PRIO(, int priority)); | ||
202 | void (*remove_thread)(struct thread_entry *thread); | ||
201 | void (*reset_poweroff_timer)(void); | 203 | void (*reset_poweroff_timer)(void); |
202 | #ifndef SIMULATOR | 204 | #ifndef SIMULATOR |
203 | int (*system_memory_guard)(int newmode); | 205 | int (*system_memory_guard)(int newmode); |
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 60f405ae50..bda5a5c4f0 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -80,13 +80,27 @@ extern char ata_device; | |||
80 | extern int ata_io_address; | 80 | extern int ata_io_address; |
81 | extern struct core_entry cores[NUM_CORES]; | 81 | extern struct core_entry cores[NUM_CORES]; |
82 | 82 | ||
83 | char thread_status_char(int status) | ||
84 | { | ||
85 | switch (status) | ||
86 | { | ||
87 | case STATE_RUNNING : return 'R'; | ||
88 | case STATE_BLOCKED : return 'B'; | ||
89 | case STATE_SLEEPING : return 'S'; | ||
90 | case STATE_BLOCKED_W_TMO: return 'T'; | ||
91 | } | ||
92 | |||
93 | return '?'; | ||
94 | } | ||
83 | #ifdef HAVE_LCD_BITMAP | 95 | #ifdef HAVE_LCD_BITMAP |
84 | /* Test code!!! */ | 96 | /* Test code!!! */ |
85 | bool dbg_os(void) | 97 | bool dbg_os(void) |
86 | { | 98 | { |
99 | struct thread_entry *thread; | ||
87 | char buf[32]; | 100 | char buf[32]; |
88 | int i; | 101 | int i; |
89 | int usage; | 102 | int usage; |
103 | int status; | ||
90 | #if NUM_CORES > 1 | 104 | #if NUM_CORES > 1 |
91 | unsigned int core; | 105 | unsigned int core; |
92 | int line; | 106 | int line; |
@@ -98,24 +112,54 @@ bool dbg_os(void) | |||
98 | 112 | ||
99 | while(1) | 113 | while(1) |
100 | { | 114 | { |
115 | #if 0 /* Enable to simulate UI lag. */ | ||
116 | int _x; | ||
117 | for (_x = 0; _x < 1000000L; _x++) ; | ||
118 | #endif | ||
101 | #if NUM_CORES > 1 | 119 | #if NUM_CORES > 1 |
102 | lcd_puts(0, 0, "Core and stack usage:"); | 120 | lcd_puts(0, 0, "Core and stack usage:"); |
103 | line = 0; | 121 | line = 0; |
104 | for(core = 0; core < NUM_CORES; core++) | 122 | for(core = 0; core < NUM_CORES; core++) |
105 | { | 123 | { |
106 | for(i = 0; i < num_threads[core]; i++) | 124 | for(i = 0; i < MAXTHREADS; i++) |
107 | { | 125 | { |
108 | usage = thread_stack_usage_on_core(core, i); | 126 | thread = &cores[core].threads[i]; |
109 | snprintf(buf, 32, "(%d) %s: %d%%", core, thread_name[core][i], usage); | 127 | if (thread->name == NULL) |
128 | continue; | ||
129 | |||
130 | usage = thread_stack_usage(thread); | ||
131 | status = thread_get_status(thread); | ||
132 | |||
133 | snprintf(buf, 32, "(%d) %c%c %d %s: %d%%", core, | ||
134 | (status == STATE_RUNNING) ? '*' : ' ', | ||
135 | thread_status_char(status), | ||
136 | cores[CURRENT_CORE].threads[i].priority, | ||
137 | cores[core].threads[i].name, usage); | ||
110 | lcd_puts(0, ++line, buf); | 138 | lcd_puts(0, ++line, buf); |
111 | } | 139 | } |
112 | } | 140 | } |
113 | #else | 141 | #else |
114 | lcd_puts(0, 0, "Stack usage:"); | 142 | lcd_puts(0, 0, "Stack usage:"); |
115 | for(i = 0; i < cores[CURRENT_CORE].num_threads;i++) | 143 | for(i = 0; i < MAXTHREADS; i++) |
116 | { | 144 | { |
117 | usage = thread_stack_usage(i); | 145 | thread = &cores[CURRENT_CORE].threads[i]; |
118 | snprintf(buf, 32, "%s: %d%%", cores[CURRENT_CORE].threads[i].name, usage); | 146 | if (thread->name == NULL) |
147 | continue; | ||
148 | |||
149 | usage = thread_stack_usage(thread); | ||
150 | status = thread_get_status(thread); | ||
151 | # ifdef HAVE_PRIORITY_SCHEDULING | ||
152 | snprintf(buf, 32, "%c%c %d %s: %d%%", | ||
153 | (status == STATE_RUNNING) ? '*' : ' ', | ||
154 | thread_status_char(status), | ||
155 | cores[CURRENT_CORE].threads[i].priority, | ||
156 | cores[CURRENT_CORE].threads[i].name, usage); | ||
157 | # else | ||
158 | snprintf(buf, 32, "%c%c %s: %d%%", | ||
159 | (status == STATE_RUNNING) ? '*' : ' ', | ||
160 | (status == STATE_BLOCKED) ? 'B' : ' ', | ||
161 | cores[CURRENT_CORE].threads[i].name, usage); | ||
162 | # endif | ||
119 | lcd_puts(0, 1+i, buf); | 163 | lcd_puts(0, 1+i, buf); |
120 | } | 164 | } |
121 | #endif | 165 | #endif |
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index b18d411db6..f8fd2af82a 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c | |||
@@ -35,9 +35,10 @@ | |||
35 | #include "settings.h" | 35 | #include "settings.h" |
36 | #include "audio.h" | 36 | #include "audio.h" |
37 | #include "dsp.h" | 37 | #include "dsp.h" |
38 | #include "thread.h" | ||
38 | 39 | ||
39 | /* 1.5s low mark */ | 40 | /* Keep watermark high for iPods at least (2s) */ |
40 | #define PCMBUF_WATERMARK (NATIVE_FREQUENCY * 6) | 41 | #define PCMBUF_WATERMARK (NATIVE_FREQUENCY * 8) |
41 | 42 | ||
42 | /* Structure we can use to queue pcm chunks in memory to be played | 43 | /* Structure we can use to queue pcm chunks in memory to be played |
43 | * by the driver code. */ | 44 | * by the driver code. */ |
@@ -94,6 +95,8 @@ static size_t pcmbuf_mix_sample IDATA_ATTR; | |||
94 | static bool low_latency_mode = false; | 95 | static bool low_latency_mode = false; |
95 | static bool pcmbuf_flush; | 96 | static bool pcmbuf_flush; |
96 | 97 | ||
98 | extern struct thread_entry *codec_thread_p; | ||
99 | |||
97 | /* Helpful macros for use in conditionals this assumes some of the above | 100 | /* Helpful macros for use in conditionals this assumes some of the above |
98 | * static variable names */ | 101 | * static variable names */ |
99 | #define NEED_FLUSH(position) \ | 102 | #define NEED_FLUSH(position) \ |
@@ -109,14 +112,37 @@ static bool pcmbuf_flush_fillpos(void); | |||
109 | void pcmbuf_boost(bool state) | 112 | void pcmbuf_boost(bool state) |
110 | { | 113 | { |
111 | static bool boost_state = false; | 114 | static bool boost_state = false; |
112 | 115 | #ifdef HAVE_PRIORITY_SCHEDULING | |
116 | static bool priority_modified = false; | ||
117 | #endif | ||
118 | |||
113 | if (crossfade_init || crossfade_active) | 119 | if (crossfade_init || crossfade_active) |
114 | return; | 120 | return; |
115 | 121 | ||
116 | if (state != boost_state) { | 122 | if (state != boost_state) |
123 | { | ||
117 | cpu_boost(state); | 124 | cpu_boost(state); |
118 | boost_state = state; | 125 | boost_state = state; |
119 | } | 126 | } |
127 | |||
128 | #ifdef HAVE_PRIORITY_SCHEDULING | ||
129 | if (state && LOW_DATA(2) && pcm_is_playing()) | ||
130 | { | ||
131 | if (!priority_modified) | ||
132 | { | ||
133 | /* Buffer is critically low so override UI priority. */ | ||
134 | priority_modified = true; | ||
135 | thread_set_priority(codec_thread_p, PRIORITY_REALTIME); | ||
136 | } | ||
137 | } | ||
138 | else if (priority_modified) | ||
139 | { | ||
140 | /* Set back the original priority. */ | ||
141 | thread_set_priority(codec_thread_p, PRIORITY_PLAYBACK); | ||
142 | priority_modified = false; | ||
143 | } | ||
144 | |||
145 | #endif | ||
120 | } | 146 | } |
121 | #endif | 147 | #endif |
122 | 148 | ||
@@ -244,7 +270,9 @@ static void pcmbuf_under_watermark(void) | |||
244 | pcmbuf_boost(true); | 270 | pcmbuf_boost(true); |
245 | /* Disable crossfade if < .5s of audio */ | 271 | /* Disable crossfade if < .5s of audio */ |
246 | if (LOW_DATA(2)) | 272 | if (LOW_DATA(2)) |
273 | { | ||
247 | crossfade_active = false; | 274 | crossfade_active = false; |
275 | } | ||
248 | } | 276 | } |
249 | 277 | ||
250 | void pcmbuf_set_event_handler(void (*event_handler)(void)) | 278 | void pcmbuf_set_event_handler(void (*event_handler)(void)) |
@@ -270,8 +298,8 @@ bool pcmbuf_is_lowdata(void) | |||
270 | crossfade_init || crossfade_active) | 298 | crossfade_init || crossfade_active) |
271 | return false; | 299 | return false; |
272 | 300 | ||
273 | /* 0.5 seconds of buffer is low data */ | 301 | /* 1 seconds of buffer is low data */ |
274 | return LOW_DATA(2); | 302 | return LOW_DATA(4); |
275 | } | 303 | } |
276 | 304 | ||
277 | /* Amount of bytes left in the buffer. */ | 305 | /* Amount of bytes left in the buffer. */ |
@@ -443,7 +471,7 @@ static bool pcmbuf_flush_fillpos(void) | |||
443 | pcmbuf_play_start(); | 471 | pcmbuf_play_start(); |
444 | } | 472 | } |
445 | /* Let approximately one chunk of data playback */ | 473 | /* Let approximately one chunk of data playback */ |
446 | sleep(PCMBUF_TARGET_CHUNK/(NATIVE_FREQUENCY * 4) / 5); | 474 | sleep(HZ*PCMBUF_TARGET_CHUNK/(NATIVE_FREQUENCY*4)); |
447 | } | 475 | } |
448 | pcmbuf_add_chunk(); | 476 | pcmbuf_add_chunk(); |
449 | return true; | 477 | return true; |
diff --git a/apps/playback.c b/apps/playback.c index 352c99b390..33667cc656 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -176,7 +176,7 @@ static char *voicebuf; | |||
176 | static size_t voice_remaining; | 176 | static size_t voice_remaining; |
177 | static bool voice_is_playing; | 177 | static bool voice_is_playing; |
178 | static void (*voice_getmore)(unsigned char** start, int* size); | 178 | static void (*voice_getmore)(unsigned char** start, int* size); |
179 | static int voice_thread_num = -1; | 179 | static struct thread_entry *voice_thread_p = NULL; |
180 | 180 | ||
181 | /* Is file buffer currently being refilled? */ | 181 | /* Is file buffer currently being refilled? */ |
182 | static volatile bool filling IDATA_ATTR; | 182 | static volatile bool filling IDATA_ATTR; |
@@ -267,6 +267,8 @@ static struct event_queue codec_queue; | |||
267 | static long codec_stack[(DEFAULT_STACK_SIZE + 0x2000)/sizeof(long)] | 267 | static long codec_stack[(DEFAULT_STACK_SIZE + 0x2000)/sizeof(long)] |
268 | IBSS_ATTR; | 268 | IBSS_ATTR; |
269 | static const char codec_thread_name[] = "codec"; | 269 | static const char codec_thread_name[] = "codec"; |
270 | /* For modifying thread priority later. */ | ||
271 | struct thread_entry *codec_thread_p; | ||
270 | 272 | ||
271 | /* Voice thread */ | 273 | /* Voice thread */ |
272 | static struct event_queue voice_queue; | 274 | static struct event_queue voice_queue; |
@@ -628,13 +630,13 @@ void audio_preinit(void) | |||
628 | 630 | ||
629 | mutex_init(&mutex_codecthread); | 631 | mutex_init(&mutex_codecthread); |
630 | 632 | ||
631 | queue_init(&audio_queue); | 633 | queue_init(&audio_queue, true); |
632 | queue_init(&codec_queue); | 634 | queue_init(&codec_queue, true); |
633 | /* clear, not init to create a private queue */ | 635 | /* create a private queue */ |
634 | queue_clear(&codec_callback_queue); | 636 | queue_init(&codec_callback_queue, false); |
635 | 637 | ||
636 | create_thread(audio_thread, audio_stack, sizeof(audio_stack), | 638 | create_thread(audio_thread, audio_stack, sizeof(audio_stack), |
637 | audio_thread_name); | 639 | audio_thread_name IF_PRIO(, PRIORITY_BUFFERING)); |
638 | } | 640 | } |
639 | 641 | ||
640 | void audio_init(void) | 642 | void audio_init(void) |
@@ -648,14 +650,14 @@ void voice_init(void) | |||
648 | if (!filebuf) | 650 | if (!filebuf) |
649 | return; /* Audio buffers not yet set up */ | 651 | return; /* Audio buffers not yet set up */ |
650 | 652 | ||
651 | if (voice_thread_num >= 0) | 653 | if (voice_thread_p) |
652 | { | 654 | { |
653 | logf("Terminating voice codec"); | 655 | logf("Terminating voice codec"); |
654 | remove_thread(voice_thread_num); | 656 | remove_thread(voice_thread_p); |
655 | if (current_codec == CODEC_IDX_VOICE) | 657 | if (current_codec == CODEC_IDX_VOICE) |
656 | mutex_unlock(&mutex_codecthread); | 658 | mutex_unlock(&mutex_codecthread); |
657 | queue_delete(&voice_queue); | 659 | queue_delete(&voice_queue); |
658 | voice_thread_num = -1; | 660 | voice_thread_p = NULL; |
659 | voice_codec_loaded = false; | 661 | voice_codec_loaded = false; |
660 | } | 662 | } |
661 | 663 | ||
@@ -663,9 +665,10 @@ void voice_init(void) | |||
663 | return; | 665 | return; |
664 | 666 | ||
665 | logf("Starting voice codec"); | 667 | logf("Starting voice codec"); |
666 | queue_init(&voice_queue); | 668 | queue_init(&voice_queue, true); |
667 | voice_thread_num = create_thread(voice_thread, voice_stack, | 669 | voice_thread_p = create_thread(voice_thread, voice_stack, |
668 | sizeof(voice_stack), voice_thread_name); | 670 | sizeof(voice_stack), voice_thread_name |
671 | IF_PRIO(, PRIORITY_PLAYBACK)); | ||
669 | 672 | ||
670 | while (!voice_codec_loaded) | 673 | while (!voice_codec_loaded) |
671 | yield(); | 674 | yield(); |
@@ -1740,7 +1743,7 @@ static void codec_thread(void) | |||
1740 | #endif | 1743 | #endif |
1741 | 1744 | ||
1742 | #ifndef SIMULATOR | 1745 | #ifndef SIMULATOR |
1743 | case SYS_USB_CONNECTED: | 1746 | case SYS_USB_CONNECTED: |
1744 | LOGFQUEUE("codec < SYS_USB_CONNECTED"); | 1747 | LOGFQUEUE("codec < SYS_USB_CONNECTED"); |
1745 | queue_clear(&codec_queue); | 1748 | queue_clear(&codec_queue); |
1746 | usb_acknowledge(SYS_USB_CONNECTED_ACK); | 1749 | usb_acknowledge(SYS_USB_CONNECTED_ACK); |
@@ -1982,13 +1985,15 @@ static bool audio_yield_codecs(void) | |||
1982 | { | 1985 | { |
1983 | yield(); | 1986 | yield(); |
1984 | 1987 | ||
1985 | if (!queue_empty(&audio_queue)) return true; | 1988 | if (!queue_empty(&audio_queue)) |
1989 | return true; | ||
1986 | 1990 | ||
1987 | while ((pcmbuf_is_crossfade_active() || pcmbuf_is_lowdata()) | 1991 | while ((pcmbuf_is_crossfade_active() || pcmbuf_is_lowdata()) |
1988 | && !ci.stop_codec && playing && !audio_filebuf_is_lowdata()) | 1992 | && !ci.stop_codec && playing && !audio_filebuf_is_lowdata()) |
1989 | { | 1993 | { |
1990 | sleep(1); | 1994 | sleep(1); |
1991 | if (!queue_empty(&audio_queue)) return true; | 1995 | if (!queue_empty(&audio_queue)) |
1996 | return true; | ||
1992 | } | 1997 | } |
1993 | 1998 | ||
1994 | return false; | 1999 | return false; |
@@ -3178,8 +3183,9 @@ static void audio_playback_init(void) | |||
3178 | id3_voice.frequency = 11200; | 3183 | id3_voice.frequency = 11200; |
3179 | id3_voice.length = 1000000L; | 3184 | id3_voice.length = 1000000L; |
3180 | 3185 | ||
3181 | create_thread(codec_thread, codec_stack, sizeof(codec_stack), | 3186 | codec_thread_p = create_thread(codec_thread, codec_stack, |
3182 | codec_thread_name); | 3187 | sizeof(codec_stack), |
3188 | codec_thread_name IF_PRIO(, PRIORITY_PLAYBACK)); | ||
3183 | 3189 | ||
3184 | while (1) | 3190 | while (1) |
3185 | { | 3191 | { |
@@ -3213,7 +3219,8 @@ static void audio_thread(void) | |||
3213 | /* At first initialize audio system in background. */ | 3219 | /* At first initialize audio system in background. */ |
3214 | audio_playback_init(); | 3220 | audio_playback_init(); |
3215 | 3221 | ||
3216 | while (1) { | 3222 | while (1) |
3223 | { | ||
3217 | if (filling) | 3224 | if (filling) |
3218 | { | 3225 | { |
3219 | queue_wait_w_tmo(&audio_queue, &ev, 0); | 3226 | queue_wait_w_tmo(&audio_queue, &ev, 0); |
@@ -3221,7 +3228,7 @@ static void audio_thread(void) | |||
3221 | ev.id = Q_AUDIO_FILL_BUFFER; | 3228 | ev.id = Q_AUDIO_FILL_BUFFER; |
3222 | } | 3229 | } |
3223 | else | 3230 | else |
3224 | queue_wait_w_tmo(&audio_queue, &ev, HZ); | 3231 | queue_wait_w_tmo(&audio_queue, &ev, HZ/2); |
3225 | 3232 | ||
3226 | switch (ev.id) { | 3233 | switch (ev.id) { |
3227 | case Q_AUDIO_FILL_BUFFER: | 3234 | case Q_AUDIO_FILL_BUFFER: |
diff --git a/apps/playlist.c b/apps/playlist.c index a75e32aed5..4ab98ab3c6 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -1777,8 +1777,8 @@ void playlist_init(void) | |||
1777 | memset(playlist->filenames, 0, | 1777 | memset(playlist->filenames, 0, |
1778 | playlist->max_playlist_size * sizeof(int)); | 1778 | playlist->max_playlist_size * sizeof(int)); |
1779 | create_thread(playlist_thread, playlist_stack, sizeof(playlist_stack), | 1779 | create_thread(playlist_thread, playlist_stack, sizeof(playlist_stack), |
1780 | playlist_thread_name); | 1780 | playlist_thread_name IF_PRIO(, PRIORITY_BACKGROUND)); |
1781 | queue_init(&playlist_queue); | 1781 | queue_init(&playlist_queue, true); |
1782 | #endif | 1782 | #endif |
1783 | } | 1783 | } |
1784 | 1784 | ||
diff --git a/apps/plugin.c b/apps/plugin.c index 6e2a8bca37..9ffb980300 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -108,6 +108,7 @@ static const struct plugin_api rockbox_api = { | |||
108 | PREFIX(lcd_icon), | 108 | PREFIX(lcd_icon), |
109 | lcd_double_height, | 109 | lcd_double_height, |
110 | #else | 110 | #else |
111 | lcd_setmargins, | ||
111 | lcd_set_drawmode, | 112 | lcd_set_drawmode, |
112 | lcd_get_drawmode, | 113 | lcd_get_drawmode, |
113 | lcd_setfont, | 114 | lcd_setfont, |
@@ -132,6 +133,9 @@ static const struct plugin_api rockbox_api = { | |||
132 | lcd_bitmap_transparent_part, | 133 | lcd_bitmap_transparent_part, |
133 | lcd_bitmap_transparent, | 134 | lcd_bitmap_transparent, |
134 | #endif | 135 | #endif |
136 | bidi_l2v, | ||
137 | font_get_bits, | ||
138 | font_load, | ||
135 | lcd_putsxy, | 139 | lcd_putsxy, |
136 | lcd_puts_style, | 140 | lcd_puts_style, |
137 | lcd_puts_scroll_style, | 141 | lcd_puts_scroll_style, |
@@ -178,6 +182,45 @@ static const struct plugin_api rockbox_api = { | |||
178 | remote_backlight_on, | 182 | remote_backlight_on, |
179 | remote_backlight_off, | 183 | remote_backlight_off, |
180 | #endif | 184 | #endif |
185 | #if NB_SCREENS == 2 | ||
186 | {&screens[SCREEN_MAIN], &screens[SCREEN_REMOTE]}, | ||
187 | #else | ||
188 | {&screens[SCREEN_MAIN]}, | ||
189 | #endif | ||
190 | #if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) | ||
191 | lcd_remote_set_foreground, | ||
192 | lcd_remote_get_foreground, | ||
193 | lcd_remote_set_background, | ||
194 | lcd_remote_get_background, | ||
195 | lcd_remote_bitmap_part, | ||
196 | lcd_remote_bitmap, | ||
197 | #endif | ||
198 | |||
199 | #if defined(HAVE_LCD_COLOR) && !defined(SIMULATOR) | ||
200 | lcd_yuv_blit, | ||
201 | #endif | ||
202 | /* list */ | ||
203 | gui_synclist_init, | ||
204 | gui_synclist_set_nb_items, | ||
205 | gui_synclist_set_icon_callback, | ||
206 | gui_synclist_get_nb_items, | ||
207 | gui_synclist_get_sel_pos, | ||
208 | gui_synclist_draw, | ||
209 | gui_synclist_select_item, | ||
210 | gui_synclist_select_next, | ||
211 | gui_synclist_select_previous, | ||
212 | gui_synclist_select_next_page, | ||
213 | gui_synclist_select_previous_page, | ||
214 | gui_synclist_add_item, | ||
215 | gui_synclist_del_item, | ||
216 | gui_synclist_limit_scroll, | ||
217 | gui_synclist_flash, | ||
218 | #ifdef HAVE_LCD_BITMAP | ||
219 | gui_synclist_scroll_right, | ||
220 | gui_synclist_scroll_left, | ||
221 | #endif | ||
222 | gui_synclist_do_button, | ||
223 | |||
181 | /* button */ | 224 | /* button */ |
182 | button_get, | 225 | button_get, |
183 | button_get_w_tmo, | 226 | button_get_w_tmo, |
@@ -205,12 +248,14 @@ static const struct plugin_api rockbox_api = { | |||
205 | ata_sleep, | 248 | ata_sleep, |
206 | ata_disk_is_active, | 249 | ata_disk_is_active, |
207 | #endif | 250 | #endif |
251 | reload_directory, | ||
208 | 252 | ||
209 | /* dir */ | 253 | /* dir */ |
210 | PREFIX(opendir), | 254 | PREFIX(opendir), |
211 | PREFIX(closedir), | 255 | PREFIX(closedir), |
212 | PREFIX(readdir), | 256 | PREFIX(readdir), |
213 | PREFIX(mkdir), | 257 | PREFIX(mkdir), |
258 | PREFIX(rmdir), | ||
214 | 259 | ||
215 | /* kernel/ system */ | 260 | /* kernel/ system */ |
216 | PREFIX(sleep), | 261 | PREFIX(sleep), |
@@ -253,6 +298,7 @@ static const struct plugin_api rockbox_api = { | |||
253 | 298 | ||
254 | /* strings and memory */ | 299 | /* strings and memory */ |
255 | snprintf, | 300 | snprintf, |
301 | vsnprintf, | ||
256 | strcpy, | 302 | strcpy, |
257 | strncpy, | 303 | strncpy, |
258 | strlen, | 304 | strlen, |
@@ -268,6 +314,7 @@ static const struct plugin_api rockbox_api = { | |||
268 | atoi, | 314 | atoi, |
269 | strchr, | 315 | strchr, |
270 | strcat, | 316 | strcat, |
317 | memchr, | ||
271 | memcmp, | 318 | memcmp, |
272 | strcasestr, | 319 | strcasestr, |
273 | /* unicode stuff */ | 320 | /* unicode stuff */ |
@@ -277,9 +324,12 @@ static const struct plugin_api rockbox_api = { | |||
277 | utf16BEdecode, | 324 | utf16BEdecode, |
278 | utf8encode, | 325 | utf8encode, |
279 | utf8length, | 326 | utf8length, |
327 | utf8seek, | ||
280 | 328 | ||
281 | /* sound */ | 329 | /* sound */ |
282 | sound_set, | 330 | sound_set, |
331 | set_sound, | ||
332 | |||
283 | sound_min, | 333 | sound_min, |
284 | sound_max, | 334 | sound_max, |
285 | #ifndef SIMULATOR | 335 | #ifndef SIMULATOR |
@@ -334,6 +384,9 @@ static const struct plugin_api rockbox_api = { | |||
334 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | 384 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) |
335 | mas_codec_writereg, | 385 | mas_codec_writereg, |
336 | mas_codec_readreg, | 386 | mas_codec_readreg, |
387 | i2c_begin, | ||
388 | i2c_end, | ||
389 | i2c_write, | ||
337 | #endif | 390 | #endif |
338 | #endif /* !SIMULATOR && CONFIG_CODEC != SWCODEC */ | 391 | #endif /* !SIMULATOR && CONFIG_CODEC != SWCODEC */ |
339 | 392 | ||
@@ -352,7 +405,15 @@ static const struct plugin_api rockbox_api = { | |||
352 | menu_insert, | 405 | menu_insert, |
353 | menu_set_cursor, | 406 | menu_set_cursor, |
354 | set_option, | 407 | set_option, |
408 | set_int, | ||
409 | set_bool, | ||
355 | 410 | ||
411 | /* action handling */ | ||
412 | get_custom_action, | ||
413 | get_action, | ||
414 | action_signalscreenchange, | ||
415 | action_userabort, | ||
416 | |||
356 | /* power */ | 417 | /* power */ |
357 | battery_level, | 418 | battery_level, |
358 | battery_level_safe, | 419 | battery_level_safe, |
@@ -405,74 +466,6 @@ static const struct plugin_api rockbox_api = { | |||
405 | 466 | ||
406 | /* new stuff at the end, sort into place next time | 467 | /* new stuff at the end, sort into place next time |
407 | the API gets incompatible */ | 468 | the API gets incompatible */ |
408 | set_sound, | ||
409 | #if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)) && !defined(SIMULATOR) | ||
410 | i2c_begin, | ||
411 | i2c_end, | ||
412 | i2c_write, | ||
413 | #endif | ||
414 | |||
415 | vsnprintf, | ||
416 | memchr, | ||
417 | /* list */ | ||
418 | gui_synclist_init, | ||
419 | gui_synclist_set_nb_items, | ||
420 | gui_synclist_set_icon_callback, | ||
421 | gui_synclist_get_nb_items, | ||
422 | gui_synclist_get_sel_pos, | ||
423 | gui_synclist_draw, | ||
424 | gui_synclist_select_item, | ||
425 | gui_synclist_select_next, | ||
426 | gui_synclist_select_previous, | ||
427 | gui_synclist_select_next_page, | ||
428 | gui_synclist_select_previous_page, | ||
429 | gui_synclist_add_item, | ||
430 | gui_synclist_del_item, | ||
431 | gui_synclist_limit_scroll, | ||
432 | gui_synclist_flash, | ||
433 | #ifdef HAVE_LCD_BITMAP | ||
434 | gui_synclist_scroll_right, | ||
435 | gui_synclist_scroll_left, | ||
436 | #endif | ||
437 | gui_synclist_do_button, | ||
438 | |||
439 | #ifdef HAVE_LCD_BITMAP | ||
440 | lcd_setmargins, | ||
441 | #endif | ||
442 | utf8seek, | ||
443 | |||
444 | set_int, | ||
445 | reload_directory, | ||
446 | set_bool, | ||
447 | #if NB_SCREENS == 2 | ||
448 | {&screens[SCREEN_MAIN], &screens[SCREEN_REMOTE]}, | ||
449 | #else | ||
450 | {&screens[SCREEN_MAIN]}, | ||
451 | #endif | ||
452 | #ifdef HAVE_LCD_BITMAP | ||
453 | bidi_l2v, | ||
454 | font_get_bits, | ||
455 | font_load, | ||
456 | #endif | ||
457 | #if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) | ||
458 | lcd_remote_set_foreground, | ||
459 | lcd_remote_get_foreground, | ||
460 | lcd_remote_set_background, | ||
461 | lcd_remote_get_background, | ||
462 | lcd_remote_bitmap_part, | ||
463 | lcd_remote_bitmap, | ||
464 | #endif | ||
465 | |||
466 | #if defined(HAVE_LCD_COLOR) && !defined(SIMULATOR) | ||
467 | lcd_yuv_blit, | ||
468 | #endif | ||
469 | |||
470 | PREFIX(rmdir), | ||
471 | /* action handling */ | ||
472 | get_custom_action, | ||
473 | get_action, | ||
474 | action_signalscreenchange, | ||
475 | action_userabort, | ||
476 | }; | 469 | }; |
477 | 470 | ||
478 | int plugin_load(const char* plugin, void* parameter) | 471 | int plugin_load(const char* plugin, void* parameter) |
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 */ |
diff --git a/apps/plugins/alpine_cdc.c b/apps/plugins/alpine_cdc.c index a482664d6a..134bb3dee6 100644 --- a/apps/plugins/alpine_cdc.c +++ b/apps/plugins/alpine_cdc.c | |||
@@ -202,7 +202,7 @@ struct | |||
202 | /* communication to the worker thread */ | 202 | /* communication to the worker thread */ |
203 | struct | 203 | struct |
204 | { | 204 | { |
205 | int id; /* ID of the thread */ | 205 | struct thread_entry *id; /* Pointer of the thread */ |
206 | bool foreground; /* set as long as we're owning the UI */ | 206 | bool foreground; /* set as long as we're owning the UI */ |
207 | bool exiting; /* signal to the thread that we want to exit */ | 207 | bool exiting; /* signal to the thread that we want to exit */ |
208 | bool ended; /* response from the thread, that is has exited */ | 208 | bool ended; /* response from the thread, that is has exited */ |
@@ -1169,7 +1169,8 @@ int main(void* parameter) | |||
1169 | 1169 | ||
1170 | rb->memset(&gTread, 0, sizeof(gTread)); | 1170 | rb->memset(&gTread, 0, sizeof(gTread)); |
1171 | gTread.foreground = true; | 1171 | gTread.foreground = true; |
1172 | gTread.id = rb->create_thread(thread, stack, stacksize, "CDC"); | 1172 | gTread.id = rb->create_thread(thread, stack, stacksize, "CDC" |
1173 | IF_PRIO(, PRIORITY_BACKGROUND)); | ||
1173 | 1174 | ||
1174 | #ifdef DEBUG | 1175 | #ifdef DEBUG |
1175 | do | 1176 | do |
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c index 9400bd2018..3c56f84309 100644 --- a/apps/plugins/battery_bench.c +++ b/apps/plugins/battery_bench.c | |||
@@ -102,7 +102,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
102 | 102 | ||
103 | struct | 103 | struct |
104 | { | 104 | { |
105 | int id; | 105 | struct thread_entry *id; |
106 | bool ended; | 106 | bool ended; |
107 | } s_thread; | 107 | } s_thread; |
108 | 108 | ||
@@ -454,10 +454,11 @@ int main(void) | |||
454 | rb->close(fd); | 454 | rb->close(fd); |
455 | } | 455 | } |
456 | 456 | ||
457 | rb->queue_init(&thread_q); /* put the thread's queue in the bcast list */ | 457 | rb->queue_init(&thread_q, true); /* put the thread's queue in the bcast list */ |
458 | rb->memset(&s_thread, 0, sizeof(s_thread)); /* zero the struct */ | 458 | rb->memset(&s_thread, 0, sizeof(s_thread)); /* zero the struct */ |
459 | if((s_thread.id = rb->create_thread(thread, thread_stack, | 459 | if((s_thread.id = rb->create_thread(thread, thread_stack, |
460 | sizeof(thread_stack), "Battery Benchmark"))<0) | 460 | sizeof(thread_stack), "Battery Benchmark" |
461 | IF_PRIO(, PRIORITY_BACKGROUND))) == NULL) | ||
461 | { | 462 | { |
462 | rb->splash(HZ,true,"Cannot create thread!"); | 463 | rb->splash(HZ,true,"Cannot create thread!"); |
463 | return PLUGIN_ERROR; | 464 | return PLUGIN_ERROR; |
diff --git a/apps/tagcache.c b/apps/tagcache.c index 2ed80a860b..f478598dad 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c | |||
@@ -54,6 +54,7 @@ | |||
54 | */ | 54 | */ |
55 | 55 | ||
56 | #include <stdio.h> | 56 | #include <stdio.h> |
57 | #include "config.h" | ||
57 | #include "thread.h" | 58 | #include "thread.h" |
58 | #include "kernel.h" | 59 | #include "kernel.h" |
59 | #include "system.h" | 60 | #include "system.h" |
@@ -1062,7 +1063,6 @@ static bool get_next(struct tagcache_search *tcs) | |||
1062 | 1063 | ||
1063 | if (tagcache_is_numeric_tag(tcs->type)) | 1064 | if (tagcache_is_numeric_tag(tcs->type)) |
1064 | { | 1065 | { |
1065 | logf("r:%d", tcs->position); | ||
1066 | snprintf(buf, sizeof(buf), "%d", tcs->position); | 1066 | snprintf(buf, sizeof(buf), "%d", tcs->position); |
1067 | tcs->result_seek = tcs->position; | 1067 | tcs->result_seek = tcs->position; |
1068 | tcs->result = buf; | 1068 | tcs->result = buf; |
@@ -3455,7 +3455,6 @@ static void tagcache_thread(void) | |||
3455 | sleep(HZ); | 3455 | sleep(HZ); |
3456 | stat.ready = check_all_headers(); | 3456 | stat.ready = check_all_headers(); |
3457 | 3457 | ||
3458 | |||
3459 | while (1) | 3458 | while (1) |
3460 | { | 3459 | { |
3461 | queue_wait_w_tmo(&tagcache_queue, &ev, HZ); | 3460 | queue_wait_w_tmo(&tagcache_queue, &ev, HZ); |
@@ -3503,6 +3502,7 @@ static void tagcache_thread(void) | |||
3503 | 3502 | ||
3504 | 3503 | ||
3505 | logf("tagcache check done"); | 3504 | logf("tagcache check done"); |
3505 | |||
3506 | check_done = true; | 3506 | check_done = true; |
3507 | break ; | 3507 | break ; |
3508 | 3508 | ||
@@ -3612,9 +3612,10 @@ void tagcache_init(void) | |||
3612 | current_serial = 0; | 3612 | current_serial = 0; |
3613 | write_lock = read_lock = 0; | 3613 | write_lock = read_lock = 0; |
3614 | 3614 | ||
3615 | queue_init(&tagcache_queue); | 3615 | queue_init(&tagcache_queue, true); |
3616 | create_thread(tagcache_thread, tagcache_stack, | 3616 | create_thread(tagcache_thread, tagcache_stack, |
3617 | sizeof(tagcache_stack), tagcache_thread_name); | 3617 | sizeof(tagcache_stack), tagcache_thread_name |
3618 | IF_PRIO(, PRIORITY_BACKGROUND)); | ||
3618 | } | 3619 | } |
3619 | 3620 | ||
3620 | bool tagcache_is_initialized(void) | 3621 | bool tagcache_is_initialized(void) |