diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/debug_menu.c | 37 | ||||
-rw-r--r-- | apps/playback.c | 92 | ||||
-rw-r--r-- | apps/playlist.c | 6 | ||||
-rw-r--r-- | apps/plugin.c | 42 | ||||
-rw-r--r-- | apps/plugin.h | 50 | ||||
-rw-r--r-- | apps/plugins/alpine_cdc.c | 4 | ||||
-rw-r--r-- | apps/plugins/battery_bench.c | 6 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.c | 35 | ||||
-rw-r--r-- | apps/plugins/test_codec.c | 4 | ||||
-rw-r--r-- | apps/screens.c | 2 | ||||
-rw-r--r-- | apps/tagcache.c | 12 |
11 files changed, 158 insertions, 132 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index b3b6fe3eca..0dec961f3f 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -125,6 +125,8 @@ static char* dbg_listmessage_getname(int item, void * data, char *buffer) | |||
125 | #endif | 125 | #endif |
126 | 126 | ||
127 | struct action_callback_info; | 127 | struct action_callback_info; |
128 | #define DBGLIST_SHOW_SELECTION 0x1 | ||
129 | |||
128 | struct action_callback_info | 130 | struct action_callback_info |
129 | { | 131 | { |
130 | char *title; | 132 | char *title; |
@@ -137,6 +139,7 @@ struct action_callback_info | |||
137 | }; | 139 | }; |
138 | 140 | ||
139 | static char* dbg_menu_getname(int item, void * data, char *buffer); | 141 | static char* dbg_menu_getname(int item, void * data, char *buffer); |
142 | static char* threads_getname(int selected_item, void * data, char *buffer); | ||
140 | static bool dbg_list(struct action_callback_info *info) | 143 | static bool dbg_list(struct action_callback_info *info) |
141 | { | 144 | { |
142 | struct gui_synclist lists; | 145 | struct gui_synclist lists; |
@@ -149,8 +152,7 @@ static bool dbg_list(struct action_callback_info *info) | |||
149 | gui_synclist_set_title(&lists, info->title, NOICON); | 152 | gui_synclist_set_title(&lists, info->title, NOICON); |
150 | gui_synclist_set_icon_callback(&lists, NULL); | 153 | gui_synclist_set_icon_callback(&lists, NULL); |
151 | gui_synclist_set_nb_items(&lists, info->count*info->selection_size); | 154 | gui_synclist_set_nb_items(&lists, info->count*info->selection_size); |
152 | if (info->dbg_getname != dbg_menu_getname) | 155 | gui_synclist_hide_selection_marker(&lists, true); |
153 | gui_synclist_hide_selection_marker(&lists, true); | ||
154 | 156 | ||
155 | if (info->action_callback) | 157 | if (info->action_callback) |
156 | info->action_callback(ACTION_REDRAW, info); | 158 | info->action_callback(ACTION_REDRAW, info); |
@@ -179,17 +181,28 @@ static bool dbg_list(struct action_callback_info *info) | |||
179 | /*---------------------------------------------------*/ | 181 | /*---------------------------------------------------*/ |
180 | extern struct thread_entry threads[MAXTHREADS]; | 182 | extern struct thread_entry threads[MAXTHREADS]; |
181 | 183 | ||
182 | static char thread_status_char(int status) | 184 | static char thread_status_char(unsigned status) |
183 | { | 185 | { |
184 | switch (status) | 186 | static const char thread_status_chars[THREAD_NUM_STATES+1] = |
185 | { | 187 | { |
186 | case STATE_RUNNING : return 'R'; | 188 | [0 ... THREAD_NUM_STATES] = '?', |
187 | case STATE_BLOCKED : return 'B'; | 189 | [STATE_RUNNING] = 'R', |
188 | case STATE_SLEEPING : return 'S'; | 190 | [STATE_BLOCKED] = 'B', |
189 | case STATE_BLOCKED_W_TMO: return 'T'; | 191 | [STATE_SLEEPING] = 'S', |
190 | } | 192 | [STATE_BLOCKED_W_TMO] = 'T', |
193 | [STATE_FROZEN] = 'F', | ||
194 | [STATE_KILLED] = 'K', | ||
195 | }; | ||
191 | 196 | ||
192 | return '?'; | 197 | #if NUM_CORES > 1 |
198 | if (status == STATE_BUSY) /* Not a state index */ | ||
199 | return '.'; | ||
200 | #endif | ||
201 | |||
202 | if (status > THREAD_NUM_STATES) | ||
203 | status = THREAD_NUM_STATES; | ||
204 | |||
205 | return thread_status_chars[status]; | ||
193 | } | 206 | } |
194 | 207 | ||
195 | static char* threads_getname(int selected_item, void * data, char *buffer) | 208 | static char* threads_getname(int selected_item, void * data, char *buffer) |
@@ -214,7 +227,7 @@ static char* threads_getname(int selected_item, void * data, char *buffer) | |||
214 | thread = &threads[selected_item]; | 227 | thread = &threads[selected_item]; |
215 | status = thread_get_status(thread); | 228 | status = thread_get_status(thread); |
216 | 229 | ||
217 | if (thread->name == NULL) | 230 | if (status == STATE_KILLED) |
218 | { | 231 | { |
219 | snprintf(buffer, MAX_PATH, "%2d: ---", selected_item); | 232 | snprintf(buffer, MAX_PATH, "%2d: ---", selected_item); |
220 | return buffer; | 233 | return buffer; |
@@ -222,7 +235,6 @@ static char* threads_getname(int selected_item, void * data, char *buffer) | |||
222 | 235 | ||
223 | thread_get_name(name, 32, thread); | 236 | thread_get_name(name, 32, thread); |
224 | usage = thread_stack_usage(thread); | 237 | usage = thread_stack_usage(thread); |
225 | status = thread_get_status(thread); | ||
226 | 238 | ||
227 | snprintf(buffer, MAX_PATH, | 239 | snprintf(buffer, MAX_PATH, |
228 | "%2d: " IF_COP("(%d) ") "%c%c " IF_PRIO("%d ") "%2d%% %s", | 240 | "%2d: " IF_COP("(%d) ") "%c%c " IF_PRIO("%d ") "%2d%% %s", |
@@ -2329,6 +2341,7 @@ static const struct the_menu_item menuitems[] = { | |||
2329 | }; | 2341 | }; |
2330 | static int menu_action_callback(int btn, struct action_callback_info *info) | 2342 | static int menu_action_callback(int btn, struct action_callback_info *info) |
2331 | { | 2343 | { |
2344 | gui_synclist_hide_selection_marker(info->lists, false); | ||
2332 | if (btn == ACTION_STD_OK) | 2345 | if (btn == ACTION_STD_OK) |
2333 | { | 2346 | { |
2334 | menuitems[gui_synclist_get_sel_pos(info->lists)].function(); | 2347 | menuitems[gui_synclist_get_sel_pos(info->lists)].function(); |
diff --git a/apps/playback.c b/apps/playback.c index b80c68384f..0fd1c21daf 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -290,8 +290,8 @@ static void set_current_codec(int codec_idx); | |||
290 | static void set_filebuf_watermark(int seconds); | 290 | static void set_filebuf_watermark(int seconds); |
291 | 291 | ||
292 | /* Audio thread */ | 292 | /* Audio thread */ |
293 | static struct event_queue audio_queue; | 293 | static struct event_queue audio_queue NOCACHEBSS_ATTR; |
294 | static struct queue_sender_list audio_queue_sender_list; | 294 | static struct queue_sender_list audio_queue_sender_list NOCACHEBSS_ATTR; |
295 | static long audio_stack[(DEFAULT_STACK_SIZE + 0x1000)/sizeof(long)]; | 295 | static long audio_stack[(DEFAULT_STACK_SIZE + 0x1000)/sizeof(long)]; |
296 | static const char audio_thread_name[] = "audio"; | 296 | static const char audio_thread_name[] = "audio"; |
297 | 297 | ||
@@ -340,9 +340,10 @@ static unsigned char *dram_buf = NULL; | |||
340 | automatically swaps in the other and the swap when unlocking should not | 340 | automatically swaps in the other and the swap when unlocking should not |
341 | happen if the parity is even. | 341 | happen if the parity is even. |
342 | */ | 342 | */ |
343 | static bool swap_codec_parity = false; /* true=odd, false=even */ | 343 | static bool swap_codec_parity NOCACHEBSS_ATTR = false; /* true=odd, false=even */ |
344 | /* Mutex to control which codec (normal/voice) is running */ | 344 | /* Locking to control which codec (normal/voice) is running */ |
345 | static struct mutex mutex_codecthread NOCACHEBSS_ATTR; | 345 | static struct semaphore sem_codecthread NOCACHEBSS_ATTR; |
346 | static struct event event_codecthread NOCACHEBSS_ATTR; | ||
346 | 347 | ||
347 | /* Voice state */ | 348 | /* Voice state */ |
348 | static volatile bool voice_thread_start = false; /* Triggers voice playback (A/V) */ | 349 | static volatile bool voice_thread_start = false; /* Triggers voice playback (A/V) */ |
@@ -424,8 +425,7 @@ static void wait_for_voice_swap_in(void) | |||
424 | if (NULL == iram_buf) | 425 | if (NULL == iram_buf) |
425 | return; | 426 | return; |
426 | 427 | ||
427 | while (current_codec != CODEC_IDX_VOICE) | 428 | event_wait(&event_codecthread, STATE_NONSIGNALED); |
428 | yield(); | ||
429 | #endif /* PLAYBACK_VOICE */ | 429 | #endif /* PLAYBACK_VOICE */ |
430 | } | 430 | } |
431 | 431 | ||
@@ -924,21 +924,21 @@ static void swap_codec(void) | |||
924 | } | 924 | } |
925 | 925 | ||
926 | /* Release my semaphore */ | 926 | /* Release my semaphore */ |
927 | mutex_unlock(&mutex_codecthread); | 927 | semaphore_release(&sem_codecthread); |
928 | logf("unlocked: %d", my_codec); | 928 | logf("unlocked: %d", my_codec); |
929 | 929 | ||
930 | /* Loop until the other codec has locked and run */ | 930 | /* Wait for other codec */ |
931 | do { | 931 | event_wait(&event_codecthread, |
932 | /* Release my semaphore and force a task switch. */ | 932 | (my_codec == CODEC_IDX_AUDIO) ? STATE_NONSIGNALED : STATE_SIGNALED); |
933 | yield(); | ||
934 | } while (my_codec == current_codec); | ||
935 | 933 | ||
936 | /* Wait for other codec to unlock */ | 934 | /* Wait for other codec to unlock */ |
937 | mutex_lock(&mutex_codecthread); | 935 | logf("waiting for lock: %d", my_codec); |
936 | semaphore_wait(&sem_codecthread); | ||
938 | 937 | ||
939 | /* Take control */ | 938 | /* Take control */ |
940 | logf("waiting for lock: %d", my_codec); | ||
941 | set_current_codec(my_codec); | 939 | set_current_codec(my_codec); |
940 | event_set_state(&event_codecthread, | ||
941 | (my_codec == CODEC_IDX_AUDIO) ? STATE_SIGNALED : STATE_NONSIGNALED); | ||
942 | 942 | ||
943 | /* Reload our IRAM and DRAM */ | 943 | /* Reload our IRAM and DRAM */ |
944 | memswap128(iram_buf, CODEC_IRAM_ORIGIN, CODEC_IRAM_SIZE); | 944 | memswap128(iram_buf, CODEC_IRAM_ORIGIN, CODEC_IRAM_SIZE); |
@@ -1161,7 +1161,7 @@ static bool voice_on_voice_stop(bool aborting, size_t *realsize) | |||
1161 | 1161 | ||
1162 | static void* voice_request_buffer_callback(size_t *realsize, size_t reqsize) | 1162 | static void* voice_request_buffer_callback(size_t *realsize, size_t reqsize) |
1163 | { | 1163 | { |
1164 | struct event ev; | 1164 | struct queue_event ev; |
1165 | 1165 | ||
1166 | if (ci_voice.new_track) | 1166 | if (ci_voice.new_track) |
1167 | { | 1167 | { |
@@ -1332,7 +1332,8 @@ static void voice_thread(void) | |||
1332 | { | 1332 | { |
1333 | logf("Loading voice codec"); | 1333 | logf("Loading voice codec"); |
1334 | voice_codec_loaded = true; | 1334 | voice_codec_loaded = true; |
1335 | mutex_lock(&mutex_codecthread); | 1335 | semaphore_wait(&sem_codecthread); |
1336 | event_set_state(&event_codecthread, false); | ||
1336 | set_current_codec(CODEC_IDX_VOICE); | 1337 | set_current_codec(CODEC_IDX_VOICE); |
1337 | dsp_configure(DSP_RESET, 0); | 1338 | dsp_configure(DSP_RESET, 0); |
1338 | voice_remaining = 0; | 1339 | voice_remaining = 0; |
@@ -1344,9 +1345,8 @@ static void voice_thread(void) | |||
1344 | 1345 | ||
1345 | logf("Voice codec finished"); | 1346 | logf("Voice codec finished"); |
1346 | voice_codec_loaded = false; | 1347 | voice_codec_loaded = false; |
1347 | mutex_unlock(&mutex_codecthread); | ||
1348 | voice_thread_p = NULL; | 1348 | voice_thread_p = NULL; |
1349 | remove_thread(NULL); | 1349 | semaphore_release(&sem_codecthread); |
1350 | } /* voice_thread */ | 1350 | } /* voice_thread */ |
1351 | 1351 | ||
1352 | #endif /* PLAYBACK_VOICE */ | 1352 | #endif /* PLAYBACK_VOICE */ |
@@ -1968,7 +1968,7 @@ static bool codec_request_next_track_callback(void) | |||
1968 | 1968 | ||
1969 | static void codec_thread(void) | 1969 | static void codec_thread(void) |
1970 | { | 1970 | { |
1971 | struct event ev; | 1971 | struct queue_event ev; |
1972 | int status; | 1972 | int status; |
1973 | size_t wrap; | 1973 | size_t wrap; |
1974 | 1974 | ||
@@ -1988,13 +1988,14 @@ static void codec_thread(void) | |||
1988 | LOGFQUEUE("codec > voice Q_AUDIO_PLAY"); | 1988 | LOGFQUEUE("codec > voice Q_AUDIO_PLAY"); |
1989 | queue_post(&voice_queue, Q_AUDIO_PLAY, 0); | 1989 | queue_post(&voice_queue, Q_AUDIO_PLAY, 0); |
1990 | } | 1990 | } |
1991 | mutex_lock(&mutex_codecthread); | 1991 | semaphore_wait(&sem_codecthread); |
1992 | event_set_state(&event_codecthread, true); | ||
1992 | #endif | 1993 | #endif |
1993 | set_current_codec(CODEC_IDX_AUDIO); | 1994 | set_current_codec(CODEC_IDX_AUDIO); |
1994 | ci.stop_codec = false; | 1995 | ci.stop_codec = false; |
1995 | status = codec_load_file((const char *)ev.data, &ci); | 1996 | status = codec_load_file((const char *)ev.data, &ci); |
1996 | #ifdef PLAYBACK_VOICE | 1997 | #ifdef PLAYBACK_VOICE |
1997 | mutex_unlock(&mutex_codecthread); | 1998 | semaphore_release(&sem_codecthread); |
1998 | #endif | 1999 | #endif |
1999 | break; | 2000 | break; |
2000 | 2001 | ||
@@ -2019,7 +2020,8 @@ static void codec_thread(void) | |||
2019 | LOGFQUEUE("codec > voice Q_AUDIO_PLAY"); | 2020 | LOGFQUEUE("codec > voice Q_AUDIO_PLAY"); |
2020 | queue_post(&voice_queue, Q_AUDIO_PLAY, 0); | 2021 | queue_post(&voice_queue, Q_AUDIO_PLAY, 0); |
2021 | } | 2022 | } |
2022 | mutex_lock(&mutex_codecthread); | 2023 | semaphore_wait(&sem_codecthread); |
2024 | event_set_state(&event_codecthread, true); | ||
2023 | #endif | 2025 | #endif |
2024 | set_current_codec(CODEC_IDX_AUDIO); | 2026 | set_current_codec(CODEC_IDX_AUDIO); |
2025 | ci.stop_codec = false; | 2027 | ci.stop_codec = false; |
@@ -2027,7 +2029,7 @@ static void codec_thread(void) | |||
2027 | status = codec_load_ram(CUR_TI->codecbuf, CUR_TI->codecsize, | 2029 | status = codec_load_ram(CUR_TI->codecbuf, CUR_TI->codecsize, |
2028 | &filebuf[0], wrap, &ci); | 2030 | &filebuf[0], wrap, &ci); |
2029 | #ifdef PLAYBACK_VOICE | 2031 | #ifdef PLAYBACK_VOICE |
2030 | mutex_unlock(&mutex_codecthread); | 2032 | semaphore_release(&sem_codecthread); |
2031 | #endif | 2033 | #endif |
2032 | break; | 2034 | break; |
2033 | 2035 | ||
@@ -2041,14 +2043,15 @@ static void codec_thread(void) | |||
2041 | LOGFQUEUE("codec > voice Q_ENCODER_RECORD"); | 2043 | LOGFQUEUE("codec > voice Q_ENCODER_RECORD"); |
2042 | queue_post(&voice_queue, Q_ENCODER_RECORD, 0); | 2044 | queue_post(&voice_queue, Q_ENCODER_RECORD, 0); |
2043 | } | 2045 | } |
2044 | mutex_lock(&mutex_codecthread); | 2046 | semaphore_wait(&sem_codecthread); |
2047 | event_set_state(&event_codecthread, true); | ||
2045 | #endif | 2048 | #endif |
2046 | logf("loading encoder"); | 2049 | logf("loading encoder"); |
2047 | set_current_codec(CODEC_IDX_AUDIO); | 2050 | set_current_codec(CODEC_IDX_AUDIO); |
2048 | ci.stop_encoder = false; | 2051 | ci.stop_encoder = false; |
2049 | status = codec_load_file((const char *)ev.data, &ci); | 2052 | status = codec_load_file((const char *)ev.data, &ci); |
2050 | #ifdef PLAYBACK_VOICE | 2053 | #ifdef PLAYBACK_VOICE |
2051 | mutex_unlock(&mutex_codecthread); | 2054 | semaphore_release(&sem_codecthread); |
2052 | #endif | 2055 | #endif |
2053 | logf("encoder stopped"); | 2056 | logf("encoder stopped"); |
2054 | break; | 2057 | break; |
@@ -3594,13 +3597,13 @@ static bool ata_fillbuffer_callback(void) | |||
3594 | 3597 | ||
3595 | static void audio_thread(void) | 3598 | static void audio_thread(void) |
3596 | { | 3599 | { |
3597 | struct event ev; | 3600 | struct queue_event ev; |
3598 | 3601 | ||
3599 | pcm_postinit(); | 3602 | pcm_postinit(); |
3600 | 3603 | ||
3601 | #ifdef PLAYBACK_VOICE | 3604 | #ifdef PLAYBACK_VOICE |
3602 | /* Unlock mutex that init stage locks before creating this thread */ | 3605 | /* Unlock semaphore that init stage locks before creating this thread */ |
3603 | mutex_unlock(&mutex_codecthread); | 3606 | semaphore_release(&sem_codecthread); |
3604 | 3607 | ||
3605 | /* Buffers must be set up by now - should panic - really */ | 3608 | /* Buffers must be set up by now - should panic - really */ |
3606 | if (buffer_state != BUFFER_STATE_INITIALIZED) | 3609 | if (buffer_state != BUFFER_STATE_INITIALIZED) |
@@ -3764,7 +3767,9 @@ void audio_init(void) | |||
3764 | #ifdef PLAYBACK_VOICE | 3767 | #ifdef PLAYBACK_VOICE |
3765 | static bool voicetagtrue = true; | 3768 | static bool voicetagtrue = true; |
3766 | static struct mp3entry id3_voice; | 3769 | static struct mp3entry id3_voice; |
3770 | struct thread_entry *voice_thread_p = NULL; | ||
3767 | #endif | 3771 | #endif |
3772 | struct thread_entry *audio_thread_p; | ||
3768 | 3773 | ||
3769 | /* Can never do this twice */ | 3774 | /* Can never do this twice */ |
3770 | if (audio_is_initialized) | 3775 | if (audio_is_initialized) |
@@ -3779,11 +3784,11 @@ void audio_init(void) | |||
3779 | to send messages. Thread creation will be delayed however so nothing | 3784 | to send messages. Thread creation will be delayed however so nothing |
3780 | starts running until ready if something yields such as talk_init. */ | 3785 | starts running until ready if something yields such as talk_init. */ |
3781 | #ifdef PLAYBACK_VOICE | 3786 | #ifdef PLAYBACK_VOICE |
3782 | mutex_init(&mutex_codecthread); | ||
3783 | /* Take ownership of lock to prevent playback of anything before audio | 3787 | /* Take ownership of lock to prevent playback of anything before audio |
3784 | hardware is initialized - audio thread unlocks it after final init | 3788 | hardware is initialized - audio thread unlocks it after final init |
3785 | stage */ | 3789 | stage */ |
3786 | mutex_lock(&mutex_codecthread); | 3790 | semaphore_init(&sem_codecthread, 1, 0); |
3791 | event_init(&event_codecthread, EVENT_MANUAL | STATE_SIGNALED); | ||
3787 | #endif | 3792 | #endif |
3788 | queue_init(&audio_queue, true); | 3793 | queue_init(&audio_queue, true); |
3789 | queue_enable_queue_send(&audio_queue, &audio_queue_sender_list); | 3794 | queue_enable_queue_send(&audio_queue, &audio_queue_sender_list); |
@@ -3842,16 +3847,16 @@ void audio_init(void) | |||
3842 | talk first */ | 3847 | talk first */ |
3843 | talk_init(); | 3848 | talk_init(); |
3844 | 3849 | ||
3845 | /* Create the threads late now that we shouldn't be yielding again before | ||
3846 | returning */ | ||
3847 | codec_thread_p = create_thread( | 3850 | codec_thread_p = create_thread( |
3848 | codec_thread, codec_stack, sizeof(codec_stack), | 3851 | codec_thread, codec_stack, sizeof(codec_stack), |
3852 | CREATE_THREAD_FROZEN, | ||
3849 | codec_thread_name IF_PRIO(, PRIORITY_PLAYBACK) | 3853 | codec_thread_name IF_PRIO(, PRIORITY_PLAYBACK) |
3850 | IF_COP(, CPU, true)); | 3854 | IF_COP(, CPU)); |
3851 | 3855 | ||
3852 | create_thread(audio_thread, audio_stack, sizeof(audio_stack), | 3856 | audio_thread_p = create_thread(audio_thread, audio_stack, |
3857 | sizeof(audio_stack), CREATE_THREAD_FROZEN, | ||
3853 | audio_thread_name IF_PRIO(, PRIORITY_BUFFERING) | 3858 | audio_thread_name IF_PRIO(, PRIORITY_BUFFERING) |
3854 | IF_COP(, CPU, false)); | 3859 | IF_COP(, CPU)); |
3855 | 3860 | ||
3856 | #ifdef PLAYBACK_VOICE | 3861 | #ifdef PLAYBACK_VOICE |
3857 | /* TODO: Change this around when various speech codecs can be used */ | 3862 | /* TODO: Change this around when various speech codecs can be used */ |
@@ -3859,9 +3864,10 @@ void audio_init(void) | |||
3859 | { | 3864 | { |
3860 | logf("Starting voice codec"); | 3865 | logf("Starting voice codec"); |
3861 | queue_init(&voice_queue, true); | 3866 | queue_init(&voice_queue, true); |
3862 | create_thread(voice_thread, voice_stack, | 3867 | voice_thread_p = create_thread(voice_thread, voice_stack, |
3863 | sizeof(voice_stack), voice_thread_name | 3868 | sizeof(voice_stack), CREATE_THREAD_FROZEN, |
3864 | IF_PRIO(, PRIORITY_PLAYBACK) IF_COP(, CPU, false)); | 3869 | voice_thread_name |
3870 | IF_PRIO(, PRIORITY_PLAYBACK) IF_COP(, CPU)); | ||
3865 | } | 3871 | } |
3866 | #endif | 3872 | #endif |
3867 | 3873 | ||
@@ -3881,5 +3887,13 @@ void audio_init(void) | |||
3881 | #ifndef HAVE_FLASH_STORAGE | 3887 | #ifndef HAVE_FLASH_STORAGE |
3882 | audio_set_buffer_margin(global_settings.buffer_margin); | 3888 | audio_set_buffer_margin(global_settings.buffer_margin); |
3883 | #endif | 3889 | #endif |
3890 | |||
3891 | /* it's safe to let the threads run now */ | ||
3892 | thread_thaw(codec_thread_p); | ||
3893 | #ifdef PLAYBACK_VOICE | ||
3894 | if (voice_thread_p) | ||
3895 | thread_thaw(voice_thread_p); | ||
3896 | #endif | ||
3897 | thread_thaw(audio_thread_p); | ||
3884 | } /* audio_init */ | 3898 | } /* audio_init */ |
3885 | 3899 | ||
diff --git a/apps/playlist.c b/apps/playlist.c index 47a1f3730d..025e07d8a7 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -1163,7 +1163,7 @@ static int compare(const void* p1, const void* p2) | |||
1163 | */ | 1163 | */ |
1164 | static void playlist_thread(void) | 1164 | static void playlist_thread(void) |
1165 | { | 1165 | { |
1166 | struct event ev; | 1166 | struct queue_event ev; |
1167 | bool dirty_pointers = false; | 1167 | bool dirty_pointers = false; |
1168 | static char tmp[MAX_PATH+1]; | 1168 | static char tmp[MAX_PATH+1]; |
1169 | 1169 | ||
@@ -1889,8 +1889,8 @@ void playlist_init(void) | |||
1889 | memset(playlist->filenames, 0, | 1889 | memset(playlist->filenames, 0, |
1890 | playlist->max_playlist_size * sizeof(int)); | 1890 | playlist->max_playlist_size * sizeof(int)); |
1891 | create_thread(playlist_thread, playlist_stack, sizeof(playlist_stack), | 1891 | create_thread(playlist_thread, playlist_stack, sizeof(playlist_stack), |
1892 | playlist_thread_name IF_PRIO(, PRIORITY_BACKGROUND) | 1892 | 0, playlist_thread_name IF_PRIO(, PRIORITY_BACKGROUND) |
1893 | IF_COP(, CPU, false)); | 1893 | IF_COP(, CPU)); |
1894 | queue_init(&playlist_queue, true); | 1894 | queue_init(&playlist_queue, true); |
1895 | #endif | 1895 | #endif |
1896 | } | 1896 | } |
diff --git a/apps/plugin.c b/apps/plugin.c index 685dab960f..c06ae257e4 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -141,6 +141,7 @@ static const struct plugin_api rockbox_api = { | |||
141 | /* remote lcd */ | 141 | /* remote lcd */ |
142 | lcd_remote_set_contrast, | 142 | lcd_remote_set_contrast, |
143 | lcd_remote_clear_display, | 143 | lcd_remote_clear_display, |
144 | lcd_remote_setmargins, | ||
144 | lcd_remote_puts, | 145 | lcd_remote_puts, |
145 | lcd_remote_puts_scroll, | 146 | lcd_remote_puts_scroll, |
146 | lcd_remote_stop_scroll, | 147 | lcd_remote_stop_scroll, |
@@ -183,6 +184,9 @@ static const struct plugin_api rockbox_api = { | |||
183 | #if defined(HAVE_LCD_COLOR) | 184 | #if defined(HAVE_LCD_COLOR) |
184 | lcd_yuv_blit, | 185 | lcd_yuv_blit, |
185 | #endif | 186 | #endif |
187 | #if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) | ||
188 | lcd_yuv_set_options, | ||
189 | #endif | ||
186 | /* list */ | 190 | /* list */ |
187 | gui_synclist_init, | 191 | gui_synclist_init, |
188 | gui_synclist_set_nb_items, | 192 | gui_synclist_set_nb_items, |
@@ -202,6 +206,7 @@ static const struct plugin_api rockbox_api = { | |||
202 | button_get_w_tmo, | 206 | button_get_w_tmo, |
203 | button_status, | 207 | button_status, |
204 | button_clear_queue, | 208 | button_clear_queue, |
209 | button_queue_count, | ||
205 | #ifdef HAS_BUTTON_HOLD | 210 | #ifdef HAS_BUTTON_HOLD |
206 | button_hold, | 211 | button_hold, |
207 | #endif | 212 | #endif |
@@ -463,6 +468,13 @@ static const struct plugin_api rockbox_api = { | |||
463 | #endif | 468 | #endif |
464 | &global_settings, | 469 | &global_settings, |
465 | &global_status, | 470 | &global_status, |
471 | talk_disable_menus, | ||
472 | talk_enable_menus, | ||
473 | #if CONFIG_CODEC == SWCODEC | ||
474 | codec_load_file, | ||
475 | get_codec_filename, | ||
476 | get_metadata, | ||
477 | #endif | ||
466 | mp3info, | 478 | mp3info, |
467 | count_mp3_frames, | 479 | count_mp3_frames, |
468 | create_xing_header, | 480 | create_xing_header, |
@@ -492,6 +504,11 @@ static const struct plugin_api rockbox_api = { | |||
492 | detect_flashed_ramimage, | 504 | detect_flashed_ramimage, |
493 | detect_flashed_romimage, | 505 | detect_flashed_romimage, |
494 | #endif | 506 | #endif |
507 | led, | ||
508 | #ifdef CACHE_FUNCTIONS_AS_CALL | ||
509 | flush_icache, | ||
510 | invalidate_icache, | ||
511 | #endif | ||
495 | /* new stuff at the end, sort into place next time | 512 | /* new stuff at the end, sort into place next time |
496 | the API gets incompatible */ | 513 | the API gets incompatible */ |
497 | 514 | ||
@@ -499,27 +516,6 @@ static const struct plugin_api rockbox_api = { | |||
499 | spinlock_init, | 516 | spinlock_init, |
500 | spinlock_lock, | 517 | spinlock_lock, |
501 | spinlock_unlock, | 518 | spinlock_unlock, |
502 | |||
503 | codec_load_file, | ||
504 | get_codec_filename, | ||
505 | get_metadata, | ||
506 | #endif | ||
507 | led, | ||
508 | |||
509 | #if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) | ||
510 | lcd_yuv_set_options, | ||
511 | #endif | ||
512 | |||
513 | #ifdef CACHE_FUNCTIONS_AS_CALL | ||
514 | flush_icache, | ||
515 | invalidate_icache, | ||
516 | #endif | ||
517 | talk_disable_menus, | ||
518 | talk_enable_menus, | ||
519 | |||
520 | button_queue_count, | ||
521 | #ifdef HAVE_REMOTE_LCD | ||
522 | lcd_remote_setmargins, | ||
523 | #endif | 519 | #endif |
524 | }; | 520 | }; |
525 | 521 | ||
@@ -666,7 +662,11 @@ int plugin_load(const char* plugin, void* parameter) | |||
666 | #endif | 662 | #endif |
667 | lcd_remote_setmargins(rxm, rym); | 663 | lcd_remote_setmargins(rxm, rym); |
668 | lcd_remote_clear_display(); | 664 | lcd_remote_clear_display(); |
665 | |||
666 | |||
669 | lcd_remote_update(); | 667 | lcd_remote_update(); |
668 | |||
669 | |||
670 | #endif | 670 | #endif |
671 | 671 | ||
672 | if (pfn_tsr_exit == NULL) | 672 | if (pfn_tsr_exit == NULL) |
diff --git a/apps/plugin.h b/apps/plugin.h index 1a87ab6cb6..e36c99c5fd 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -112,12 +112,12 @@ | |||
112 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 112 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
113 | 113 | ||
114 | /* increase this every time the api struct changes */ | 114 | /* increase this every time the api struct changes */ |
115 | #define PLUGIN_API_VERSION 82 | 115 | #define PLUGIN_API_VERSION 83 |
116 | 116 | ||
117 | /* update this to latest version if a change to the api struct breaks | 117 | /* update this to latest version if a change to the api struct breaks |
118 | backwards compatibility (and please take the opportunity to sort in any | 118 | backwards compatibility (and please take the opportunity to sort in any |
119 | new function which are "waiting" at the end of the function table) */ | 119 | new function which are "waiting" at the end of the function table) */ |
120 | #define PLUGIN_MIN_API_VERSION 82 | 120 | #define PLUGIN_MIN_API_VERSION 83 |
121 | 121 | ||
122 | /* plugin return codes */ | 122 | /* plugin return codes */ |
123 | enum plugin_status { | 123 | enum plugin_status { |
@@ -219,6 +219,7 @@ struct plugin_api { | |||
219 | /* remote lcd */ | 219 | /* remote lcd */ |
220 | void (*lcd_remote_set_contrast)(int x); | 220 | void (*lcd_remote_set_contrast)(int x); |
221 | void (*lcd_remote_clear_display)(void); | 221 | void (*lcd_remote_clear_display)(void); |
222 | void (*lcd_remote_setmargins)(int x, int y); | ||
222 | void (*lcd_remote_puts)(int x, int y, const unsigned char *string); | 223 | void (*lcd_remote_puts)(int x, int y, const unsigned char *string); |
223 | void (*lcd_remote_lcd_puts_scroll)(int x, int y, const unsigned char* string); | 224 | void (*lcd_remote_lcd_puts_scroll)(int x, int y, const unsigned char* string); |
224 | void (*lcd_remote_lcd_stop_scroll)(void); | 225 | void (*lcd_remote_lcd_stop_scroll)(void); |
@@ -265,6 +266,10 @@ struct plugin_api { | |||
265 | int x, int y, int width, int height); | 266 | int x, int y, int width, int height); |
266 | #endif | 267 | #endif |
267 | 268 | ||
269 | #if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) | ||
270 | void (*lcd_yuv_set_options)(unsigned options); | ||
271 | #endif | ||
272 | |||
268 | /* list */ | 273 | /* list */ |
269 | void (*gui_synclist_init)(struct gui_synclist * lists, | 274 | void (*gui_synclist_init)(struct gui_synclist * lists, |
270 | list_get_name callback_get_item_name,void * data, | 275 | list_get_name callback_get_item_name,void * data, |
@@ -288,6 +293,7 @@ struct plugin_api { | |||
288 | long (*button_get_w_tmo)(int ticks); | 293 | long (*button_get_w_tmo)(int ticks); |
289 | int (*button_status)(void); | 294 | int (*button_status)(void); |
290 | void (*button_clear_queue)(void); | 295 | void (*button_clear_queue)(void); |
296 | int (*button_queue_count)(void); | ||
291 | #ifdef HAS_BUTTON_HOLD | 297 | #ifdef HAS_BUTTON_HOLD |
292 | bool (*button_hold)(void); | 298 | bool (*button_hold)(void); |
293 | #endif | 299 | #endif |
@@ -334,9 +340,10 @@ struct plugin_api { | |||
334 | long (*default_event_handler_ex)(long event, void (*callback)(void *), void *parameter); | 340 | long (*default_event_handler_ex)(long event, void (*callback)(void *), void *parameter); |
335 | struct thread_entry* threads; | 341 | struct thread_entry* threads; |
336 | struct thread_entry* (*create_thread)(void (*function)(void), void* stack, | 342 | struct thread_entry* (*create_thread)(void (*function)(void), void* stack, |
337 | int stack_size, const char *name | 343 | int stack_size, unsigned flags, |
344 | const char *name | ||
338 | IF_PRIO(, int priority) | 345 | IF_PRIO(, int priority) |
339 | IF_COP(, unsigned int core, bool fallback)); | 346 | IF_COP(, unsigned int core)); |
340 | void (*remove_thread)(struct thread_entry *thread); | 347 | void (*remove_thread)(struct thread_entry *thread); |
341 | void (*reset_poweroff_timer)(void); | 348 | void (*reset_poweroff_timer)(void); |
342 | #ifndef SIMULATOR | 349 | #ifndef SIMULATOR |
@@ -359,7 +366,7 @@ struct plugin_api { | |||
359 | void (*queue_init)(struct event_queue *q, bool register_queue); | 366 | void (*queue_init)(struct event_queue *q, bool register_queue); |
360 | void (*queue_delete)(struct event_queue *q); | 367 | void (*queue_delete)(struct event_queue *q); |
361 | void (*queue_post)(struct event_queue *q, long id, intptr_t data); | 368 | void (*queue_post)(struct event_queue *q, long id, intptr_t data); |
362 | void (*queue_wait_w_tmo)(struct event_queue *q, struct event *ev, | 369 | void (*queue_wait_w_tmo)(struct event_queue *q, struct queue_event *ev, |
363 | int ticks); | 370 | int ticks); |
364 | void (*usb_acknowledge)(long id); | 371 | void (*usb_acknowledge)(long id); |
365 | #ifdef RB_PROFILE | 372 | #ifdef RB_PROFILE |
@@ -572,6 +579,13 @@ struct plugin_api { | |||
572 | #endif | 579 | #endif |
573 | struct user_settings* global_settings; | 580 | struct user_settings* global_settings; |
574 | struct system_status *global_status; | 581 | struct system_status *global_status; |
582 | void (*talk_disable_menus)(void); | ||
583 | void (*talk_enable_menus)(void); | ||
584 | #if CONFIG_CODEC == SWCODEC | ||
585 | int (*codec_load_file)(const char* codec, struct codec_api *api); | ||
586 | const char *(*get_codec_filename)(int cod_spec); | ||
587 | bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname); | ||
588 | #endif | ||
575 | bool (*mp3info)(struct mp3entry *entry, const char *filename); | 589 | bool (*mp3info)(struct mp3entry *entry, const char *filename); |
576 | int (*count_mp3_frames)(int fd, int startpos, int filesize, | 590 | int (*count_mp3_frames)(int fd, int startpos, int filesize, |
577 | void (*progressfunc)(int)); | 591 | void (*progressfunc)(int)); |
@@ -609,35 +623,21 @@ struct plugin_api { | |||
609 | bool (*detect_flashed_ramimage)(void); | 623 | bool (*detect_flashed_ramimage)(void); |
610 | bool (*detect_flashed_romimage)(void); | 624 | bool (*detect_flashed_romimage)(void); |
611 | #endif | 625 | #endif |
612 | /* new stuff at the end, sort into place next time | ||
613 | the API gets incompatible */ | ||
614 | |||
615 | #if (CONFIG_CODEC == SWCODEC) | ||
616 | void (*spinlock_init)(struct mutex *m); | ||
617 | void (*spinlock_lock)(struct mutex *m); | ||
618 | void (*spinlock_unlock)(struct mutex *m); | ||
619 | 626 | ||
620 | int (*codec_load_file)(const char* codec, struct codec_api *api); | ||
621 | const char *(*get_codec_filename)(int cod_spec); | ||
622 | bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname); | ||
623 | #endif | ||
624 | void (*led)(bool on); | 627 | void (*led)(bool on); |
625 | 628 | ||
626 | #if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) | ||
627 | void (*lcd_yuv_set_options)(unsigned options); | ||
628 | #endif | ||
629 | |||
630 | #ifdef CACHE_FUNCTIONS_AS_CALL | 629 | #ifdef CACHE_FUNCTIONS_AS_CALL |
631 | void (*flush_icache)(void); | 630 | void (*flush_icache)(void); |
632 | void (*invalidate_icache)(void); | 631 | void (*invalidate_icache)(void); |
633 | #endif | 632 | #endif |
634 | 633 | ||
635 | void (*talk_disable_menus)(void); | 634 | /* new stuff at the end, sort into place next time |
636 | void (*talk_enable_menus)(void); | 635 | the API gets incompatible */ |
637 | 636 | ||
638 | int (*button_queue_count)(void); | 637 | #if (CONFIG_CODEC == SWCODEC) |
639 | #ifdef HAVE_REMOTE_LCD | 638 | void (*spinlock_init)(struct spinlock *l IF_COP(, unsigned int flags)); |
640 | void (*lcd_remote_setmargins)(int x, int y); | 639 | void (*spinlock_lock)(struct spinlock *l); |
640 | void (*spinlock_unlock)(struct spinlock *l); | ||
641 | #endif | 641 | #endif |
642 | }; | 642 | }; |
643 | 643 | ||
diff --git a/apps/plugins/alpine_cdc.c b/apps/plugins/alpine_cdc.c index c4b897fc3a..622338742a 100644 --- a/apps/plugins/alpine_cdc.c +++ b/apps/plugins/alpine_cdc.c | |||
@@ -1167,9 +1167,9 @@ int main(void* parameter) | |||
1167 | 1167 | ||
1168 | rb->memset(&gTread, 0, sizeof(gTread)); | 1168 | rb->memset(&gTread, 0, sizeof(gTread)); |
1169 | gTread.foreground = true; | 1169 | gTread.foreground = true; |
1170 | rb->create_thread(thread, stack, stacksize, "CDC" | 1170 | rb->create_thread(thread, stack, stacksize, 0, "CDC" |
1171 | IF_PRIO(, PRIORITY_BACKGROUND) | 1171 | IF_PRIO(, PRIORITY_BACKGROUND) |
1172 | IF_COP(, CPU, false)); | 1172 | IF_COP(, CPU)); |
1173 | 1173 | ||
1174 | #ifdef DEBUG | 1174 | #ifdef DEBUG |
1175 | do | 1175 | do |
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c index 7889f551a4..dfe9632f7b 100644 --- a/apps/plugins/battery_bench.c +++ b/apps/plugins/battery_bench.c | |||
@@ -215,7 +215,7 @@ void thread(void) | |||
215 | #endif | 215 | #endif |
216 | long sleep_time = 5 * HZ; | 216 | long sleep_time = 5 * HZ; |
217 | 217 | ||
218 | struct event ev; | 218 | struct queue_event ev; |
219 | 219 | ||
220 | buffelements = sizeof(bat)/sizeof(struct batt_info); | 220 | buffelements = sizeof(bat)/sizeof(struct batt_info); |
221 | 221 | ||
@@ -500,9 +500,9 @@ int main(void) | |||
500 | 500 | ||
501 | rb->queue_init(&thread_q, true); /* put the thread's queue in the bcast list */ | 501 | rb->queue_init(&thread_q, true); /* put the thread's queue in the bcast list */ |
502 | if(rb->create_thread(thread, thread_stack, | 502 | if(rb->create_thread(thread, thread_stack, |
503 | sizeof(thread_stack), "Battery Benchmark" | 503 | sizeof(thread_stack), 0, "Battery Benchmark" |
504 | IF_PRIO(, PRIORITY_BACKGROUND) | 504 | IF_PRIO(, PRIORITY_BACKGROUND) |
505 | IF_COP(, CPU, false)) == NULL) | 505 | IF_COP(, CPU)) == NULL) |
506 | { | 506 | { |
507 | rb->splash(HZ, "Cannot create thread!"); | 507 | rb->splash(HZ, "Cannot create thread!"); |
508 | return PLUGIN_ERROR; | 508 | return PLUGIN_ERROR; |
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index ea10411f3f..12282a3322 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c | |||
@@ -189,11 +189,11 @@ typedef struct | |||
189 | { | 189 | { |
190 | struct thread_entry *thread; /* Stream's thread */ | 190 | struct thread_entry *thread; /* Stream's thread */ |
191 | int status; /* Current stream status */ | 191 | int status; /* Current stream status */ |
192 | struct event ev; /* Event sent to steam */ | 192 | struct queue_event ev; /* Event sent to steam */ |
193 | int have_msg; /* 1=event pending */ | 193 | int have_msg; /* 1=event pending */ |
194 | int replied; /* 1=replied to last event */ | 194 | int replied; /* 1=replied to last event */ |
195 | int reply; /* reply value */ | 195 | int reply; /* reply value */ |
196 | struct mutex msg_lock; /* serialization for event senders */ | 196 | struct spinlock msg_lock; /* serialization for event senders */ |
197 | uint8_t* curr_packet; /* Current stream packet beginning */ | 197 | uint8_t* curr_packet; /* Current stream packet beginning */ |
198 | uint8_t* curr_packet_end; /* Current stream packet end */ | 198 | uint8_t* curr_packet_end; /* Current stream packet end */ |
199 | 199 | ||
@@ -256,7 +256,7 @@ static void str_wait_msg(Stream *str) | |||
256 | 256 | ||
257 | /* Returns a message waiting or blocks until one is available - removes the | 257 | /* Returns a message waiting or blocks until one is available - removes the |
258 | event */ | 258 | event */ |
259 | static void str_get_msg(Stream *str, struct event *ev) | 259 | static void str_get_msg(Stream *str, struct queue_event *ev) |
260 | { | 260 | { |
261 | str_wait_msg(str); | 261 | str_wait_msg(str); |
262 | ev->id = str->ev.id; | 262 | ev->id = str->ev.id; |
@@ -266,7 +266,7 @@ static void str_get_msg(Stream *str, struct event *ev) | |||
266 | 266 | ||
267 | /* Peeks at the current message without blocking, returns the data but | 267 | /* Peeks at the current message without blocking, returns the data but |
268 | does not remove the event */ | 268 | does not remove the event */ |
269 | static bool str_look_msg(Stream *str, struct event *ev) | 269 | static bool str_look_msg(Stream *str, struct queue_event *ev) |
270 | { | 270 | { |
271 | if (!str_have_msg(str)) | 271 | if (!str_have_msg(str)) |
272 | return false; | 272 | return false; |
@@ -345,9 +345,9 @@ static size_t file_remaining IBSS_ATTR; | |||
345 | 345 | ||
346 | #if NUM_CORES > 1 | 346 | #if NUM_CORES > 1 |
347 | /* Some stream variables are shared between cores */ | 347 | /* Some stream variables are shared between cores */ |
348 | struct mutex stream_lock IBSS_ATTR; | 348 | struct spinlock stream_lock IBSS_ATTR; |
349 | static inline void init_stream_lock(void) | 349 | static inline void init_stream_lock(void) |
350 | { rb->spinlock_init(&stream_lock); } | 350 | { rb->spinlock_init(&stream_lock, SPINLOCK_TASK_SWITCH); } |
351 | static inline void lock_stream(void) | 351 | static inline void lock_stream(void) |
352 | { rb->spinlock_lock(&stream_lock); } | 352 | { rb->spinlock_lock(&stream_lock); } |
353 | static inline void unlock_stream(void) | 353 | static inline void unlock_stream(void) |
@@ -1050,7 +1050,7 @@ static int button_loop(void) | |||
1050 | 1050 | ||
1051 | if (str_have_msg(&audio_str)) | 1051 | if (str_have_msg(&audio_str)) |
1052 | { | 1052 | { |
1053 | struct event ev; | 1053 | struct queue_event ev; |
1054 | str_get_msg(&audio_str, &ev); | 1054 | str_get_msg(&audio_str, &ev); |
1055 | 1055 | ||
1056 | if (ev.id == STREAM_QUIT) | 1056 | if (ev.id == STREAM_QUIT) |
@@ -1375,7 +1375,7 @@ static void audio_thread(void) | |||
1375 | { | 1375 | { |
1376 | if (str_have_msg(&audio_str)) | 1376 | if (str_have_msg(&audio_str)) |
1377 | { | 1377 | { |
1378 | struct event ev; | 1378 | struct queue_event ev; |
1379 | str_look_msg(&audio_str, &ev); | 1379 | str_look_msg(&audio_str, &ev); |
1380 | 1380 | ||
1381 | if (ev.id == STREAM_QUIT) | 1381 | if (ev.id == STREAM_QUIT) |
@@ -1498,7 +1498,7 @@ static uint32_t video_stack[VIDEO_STACKSIZE / sizeof(uint32_t)] IBSS_ATTR; | |||
1498 | 1498 | ||
1499 | static void video_thread(void) | 1499 | static void video_thread(void) |
1500 | { | 1500 | { |
1501 | struct event ev; | 1501 | struct queue_event ev; |
1502 | const mpeg2_info_t * info; | 1502 | const mpeg2_info_t * info; |
1503 | mpeg2_state_t state; | 1503 | mpeg2_state_t state; |
1504 | char str[80]; | 1504 | char str[80]; |
@@ -1929,9 +1929,8 @@ void display_thumb(int in_file) | |||
1929 | video_str.status = STREAM_PLAYING; | 1929 | video_str.status = STREAM_PLAYING; |
1930 | 1930 | ||
1931 | if ((video_str.thread = rb->create_thread(video_thread, | 1931 | if ((video_str.thread = rb->create_thread(video_thread, |
1932 | (uint8_t*)video_stack,VIDEO_STACKSIZE,"mpgvideo" | 1932 | (uint8_t*)video_stack,VIDEO_STACKSIZE, 0,"mpgvideo" |
1933 | IF_PRIO(,PRIORITY_PLAYBACK) | 1933 | IF_PRIO(,PRIORITY_PLAYBACK) IF_COP(, COP))) == NULL) |
1934 | IF_COP(, COP, true))) == NULL) | ||
1935 | { | 1934 | { |
1936 | rb->splash(HZ, "Cannot create video thread!"); | 1935 | rb->splash(HZ, "Cannot create video thread!"); |
1937 | } | 1936 | } |
@@ -2354,8 +2353,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
2354 | initialize_stream( &video_str, disk_buf_start, disk_buf_len, 0xe0 ); | 2353 | initialize_stream( &video_str, disk_buf_start, disk_buf_len, 0xe0 ); |
2355 | initialize_stream( &audio_str, disk_buf_start, disk_buf_len, 0xc0 ); | 2354 | initialize_stream( &audio_str, disk_buf_start, disk_buf_len, 0xc0 ); |
2356 | 2355 | ||
2357 | rb->spinlock_init(&audio_str.msg_lock); | 2356 | rb->spinlock_init(&audio_str.msg_lock IF_COP(, SPINLOCK_TASK_SWITCH)); |
2358 | rb->spinlock_init(&video_str.msg_lock); | 2357 | rb->spinlock_init(&video_str.msg_lock IF_COP(, SPINLOCK_TASK_SWITCH)); |
2359 | 2358 | ||
2360 | audio_str.status = STREAM_BUFFERING; | 2359 | audio_str.status = STREAM_BUFFERING; |
2361 | video_str.status = STREAM_PLAYING; | 2360 | video_str.status = STREAM_PLAYING; |
@@ -2372,14 +2371,14 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
2372 | 2371 | ||
2373 | /* We put the video thread on the second processor for multi-core targets. */ | 2372 | /* We put the video thread on the second processor for multi-core targets. */ |
2374 | if ((video_str.thread = rb->create_thread(video_thread, | 2373 | if ((video_str.thread = rb->create_thread(video_thread, |
2375 | (uint8_t*)video_stack,VIDEO_STACKSIZE,"mpgvideo" IF_PRIO(,PRIORITY_PLAYBACK) | 2374 | (uint8_t*)video_stack, VIDEO_STACKSIZE, 0, |
2376 | IF_COP(, COP, true))) == NULL) | 2375 | "mpgvideo" IF_PRIO(,PRIORITY_PLAYBACK) IF_COP(, COP))) == NULL) |
2377 | { | 2376 | { |
2378 | rb->splash(HZ, "Cannot create video thread!"); | 2377 | rb->splash(HZ, "Cannot create video thread!"); |
2379 | } | 2378 | } |
2380 | else if ((audio_str.thread = rb->create_thread(audio_thread, | 2379 | else if ((audio_str.thread = rb->create_thread(audio_thread, |
2381 | (uint8_t*)audio_stack,AUDIO_STACKSIZE,"mpgaudio" IF_PRIO(,PRIORITY_PLAYBACK) | 2380 | (uint8_t*)audio_stack,AUDIO_STACKSIZE, 0,"mpgaudio" |
2382 | IF_COP(, CPU, false))) == NULL) | 2381 | IF_PRIO(,PRIORITY_PLAYBACK) IF_COP(, CPU))) == NULL) |
2383 | { | 2382 | { |
2384 | rb->splash(HZ, "Cannot create audio thread!"); | 2383 | rb->splash(HZ, "Cannot create audio thread!"); |
2385 | } | 2384 | } |
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index 2918f611a1..e2f599c361 100644 --- a/apps/plugins/test_codec.c +++ b/apps/plugins/test_codec.c | |||
@@ -584,8 +584,8 @@ static enum plugin_status test_track(char* filename) | |||
584 | codec_playing = true; | 584 | codec_playing = true; |
585 | 585 | ||
586 | if ((codecthread_id = rb->create_thread(codec_thread, | 586 | if ((codecthread_id = rb->create_thread(codec_thread, |
587 | (uint8_t*)codec_stack, codec_stack_size, "testcodec" IF_PRIO(,PRIORITY_PLAYBACK) | 587 | (uint8_t*)codec_stack, codec_stack_size, 0, "testcodec" |
588 | IF_COP(, CPU, false))) == NULL) | 588 | IF_PRIO(,PRIORITY_PLAYBACK) IF_COP(, CPU))) == NULL) |
589 | { | 589 | { |
590 | log_text("Cannot create codec thread!",true); | 590 | log_text("Cannot create codec thread!",true); |
591 | goto exit; | 591 | goto exit; |
diff --git a/apps/screens.c b/apps/screens.c index b725beaa7a..ce62911624 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -153,7 +153,7 @@ void usb_screen(void) | |||
153 | #ifdef HAVE_MMC | 153 | #ifdef HAVE_MMC |
154 | int mmc_remove_request(void) | 154 | int mmc_remove_request(void) |
155 | { | 155 | { |
156 | struct event ev; | 156 | struct queue_event ev; |
157 | int i; | 157 | int i; |
158 | FOR_NB_SCREENS(i) | 158 | FOR_NB_SCREENS(i) |
159 | screens[i].clear_display(); | 159 | screens[i].clear_display(); |
diff --git a/apps/tagcache.c b/apps/tagcache.c index 4a2f107d24..2ed7574f3b 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c | |||
@@ -88,7 +88,7 @@ | |||
88 | 88 | ||
89 | #ifndef __PCTOOL__ | 89 | #ifndef __PCTOOL__ |
90 | /* Tag Cache thread. */ | 90 | /* Tag Cache thread. */ |
91 | static struct event_queue tagcache_queue; | 91 | static struct event_queue tagcache_queue NOCACHEBSS_ATTR; |
92 | static long tagcache_stack[(DEFAULT_STACK_SIZE + 0x4000)/sizeof(long)]; | 92 | static long tagcache_stack[(DEFAULT_STACK_SIZE + 0x4000)/sizeof(long)]; |
93 | static const char tagcache_thread_name[] = "tagcache"; | 93 | static const char tagcache_thread_name[] = "tagcache"; |
94 | #endif | 94 | #endif |
@@ -152,7 +152,7 @@ struct tagcache_command_entry { | |||
152 | static struct tagcache_command_entry command_queue[TAGCACHE_COMMAND_QUEUE_LENGTH]; | 152 | static struct tagcache_command_entry command_queue[TAGCACHE_COMMAND_QUEUE_LENGTH]; |
153 | static volatile int command_queue_widx = 0; | 153 | static volatile int command_queue_widx = 0; |
154 | static volatile int command_queue_ridx = 0; | 154 | static volatile int command_queue_ridx = 0; |
155 | static struct mutex command_queue_mutex; | 155 | static struct mutex command_queue_mutex NOCACHEBSS_ATTR; |
156 | /* Timestamp of the last added event, so we can wait a bit before committing the | 156 | /* Timestamp of the last added event, so we can wait a bit before committing the |
157 | * whole queue at once. */ | 157 | * whole queue at once. */ |
158 | static long command_queue_timestamp = 0; | 158 | static long command_queue_timestamp = 0; |
@@ -3377,7 +3377,7 @@ static bool delete_entry(long idx_id) | |||
3377 | */ | 3377 | */ |
3378 | static bool check_event_queue(void) | 3378 | static bool check_event_queue(void) |
3379 | { | 3379 | { |
3380 | struct event ev; | 3380 | struct queue_event ev; |
3381 | 3381 | ||
3382 | queue_wait_w_tmo(&tagcache_queue, &ev, 0); | 3382 | queue_wait_w_tmo(&tagcache_queue, &ev, 0); |
3383 | switch (ev.id) | 3383 | switch (ev.id) |
@@ -3972,7 +3972,7 @@ void tagcache_unload_ramcache(void) | |||
3972 | #ifndef __PCTOOL__ | 3972 | #ifndef __PCTOOL__ |
3973 | static void tagcache_thread(void) | 3973 | static void tagcache_thread(void) |
3974 | { | 3974 | { |
3975 | struct event ev; | 3975 | struct queue_event ev; |
3976 | bool check_done = false; | 3976 | bool check_done = false; |
3977 | 3977 | ||
3978 | /* If the previous cache build/update was interrupted, commit | 3978 | /* If the previous cache build/update was interrupted, commit |
@@ -4176,9 +4176,9 @@ void tagcache_init(void) | |||
4176 | mutex_init(&command_queue_mutex); | 4176 | mutex_init(&command_queue_mutex); |
4177 | queue_init(&tagcache_queue, true); | 4177 | queue_init(&tagcache_queue, true); |
4178 | create_thread(tagcache_thread, tagcache_stack, | 4178 | create_thread(tagcache_thread, tagcache_stack, |
4179 | sizeof(tagcache_stack), tagcache_thread_name | 4179 | sizeof(tagcache_stack), 0, tagcache_thread_name |
4180 | IF_PRIO(, PRIORITY_BACKGROUND) | 4180 | IF_PRIO(, PRIORITY_BACKGROUND) |
4181 | IF_COP(, CPU, false)); | 4181 | IF_COP(, CPU)); |
4182 | #else | 4182 | #else |
4183 | tc_stat.initialized = true; | 4183 | tc_stat.initialized = true; |
4184 | allocate_tempbuf(); | 4184 | allocate_tempbuf(); |