summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/alpine_cdc.c4
-rw-r--r--apps/plugins/battery_bench.c6
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c35
-rw-r--r--apps/plugins/test_codec.c4
4 files changed, 24 insertions, 25 deletions
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 */
259static void str_get_msg(Stream *str, struct event *ev) 259static 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 */
269static bool str_look_msg(Stream *str, struct event *ev) 269static 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 */
348struct mutex stream_lock IBSS_ATTR; 348struct spinlock stream_lock IBSS_ATTR;
349static inline void init_stream_lock(void) 349static inline void init_stream_lock(void)
350 { rb->spinlock_init(&stream_lock); } 350 { rb->spinlock_init(&stream_lock, SPINLOCK_TASK_SWITCH); }
351static inline void lock_stream(void) 351static inline void lock_stream(void)
352 { rb->spinlock_lock(&stream_lock); } 352 { rb->spinlock_lock(&stream_lock); }
353static inline void unlock_stream(void) 353static 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
1499static void video_thread(void) 1499static 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;