summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/buffering.c8
-rw-r--r--apps/codecs.h10
-rw-r--r--apps/codecs/mpa.c8
-rw-r--r--apps/codecs/spc.c12
-rw-r--r--apps/pcmbuf.c8
-rw-r--r--apps/playback.c16
-rw-r--r--apps/plugin.c6
-rw-r--r--apps/plugin.h26
-rw-r--r--apps/plugins/alpine_cdc.c2
-rw-r--r--apps/plugins/battery_bench.c4
-rw-r--r--apps/plugins/mpegplayer/audio_thread.c6
-rw-r--r--apps/plugins/mpegplayer/disk_buf.c8
-rw-r--r--apps/plugins/mpegplayer/disk_buf.h2
-rw-r--r--apps/plugins/mpegplayer/mpeg_parser.c2
-rw-r--r--apps/plugins/mpegplayer/stream_mgr.c20
-rw-r--r--apps/plugins/mpegplayer/stream_mgr.h2
-rw-r--r--apps/plugins/mpegplayer/stream_thread.h2
-rw-r--r--apps/plugins/mpegplayer/video_thread.c6
-rw-r--r--apps/plugins/pictureflow.c4
-rw-r--r--apps/plugins/test_codec.c4
-rw-r--r--apps/plugins/test_sampr.c14
-rw-r--r--apps/recorder/pcm_record.c20
-rw-r--r--apps/voice_thread.c10
23 files changed, 100 insertions, 100 deletions
diff --git a/apps/buffering.c b/apps/buffering.c
index dfc90065d6..6160869498 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -184,7 +184,7 @@ enum {
184static void buffering_thread(void); 184static void buffering_thread(void);
185static long buffering_stack[(DEFAULT_STACK_SIZE + 0x2000)/sizeof(long)]; 185static long buffering_stack[(DEFAULT_STACK_SIZE + 0x2000)/sizeof(long)];
186static const char buffering_thread_name[] = "buffering"; 186static const char buffering_thread_name[] = "buffering";
187static struct thread_entry *buffering_thread_p; 187static unsigned int buffering_thread_id = 0;
188static struct event_queue buffering_queue; 188static struct event_queue buffering_queue;
189static struct queue_sender_list buffering_queue_sender_list; 189static struct queue_sender_list buffering_queue_sender_list;
190 190
@@ -1468,13 +1468,13 @@ void buffering_init(void)
1468 conf_watermark = BUFFERING_DEFAULT_WATERMARK; 1468 conf_watermark = BUFFERING_DEFAULT_WATERMARK;
1469 1469
1470 queue_init(&buffering_queue, true); 1470 queue_init(&buffering_queue, true);
1471 buffering_thread_p = create_thread( buffering_thread, buffering_stack, 1471 buffering_thread_id = create_thread( buffering_thread, buffering_stack,
1472 sizeof(buffering_stack), CREATE_THREAD_FROZEN, 1472 sizeof(buffering_stack), CREATE_THREAD_FROZEN,
1473 buffering_thread_name IF_PRIO(, PRIORITY_BUFFERING) 1473 buffering_thread_name IF_PRIO(, PRIORITY_BUFFERING)
1474 IF_COP(, CPU)); 1474 IF_COP(, CPU));
1475 1475
1476 queue_enable_queue_send(&buffering_queue, &buffering_queue_sender_list, 1476 queue_enable_queue_send(&buffering_queue, &buffering_queue_sender_list,
1477 buffering_thread_p); 1477 buffering_thread_id);
1478} 1478}
1479 1479
1480/* Initialise the buffering subsystem */ 1480/* Initialise the buffering subsystem */
@@ -1501,7 +1501,7 @@ bool buffering_reset(char *buf, size_t buflen)
1501 high_watermark = 3*buflen / 4; 1501 high_watermark = 3*buflen / 4;
1502#endif 1502#endif
1503 1503
1504 thread_thaw(buffering_thread_p); 1504 thread_thaw(buffering_thread_id);
1505 1505
1506 return true; 1506 return true;
1507} 1507}
diff --git a/apps/codecs.h b/apps/codecs.h
index 4194524e6d..d765daba2a 100644
--- a/apps/codecs.h
+++ b/apps/codecs.h
@@ -82,12 +82,12 @@
82#define CODEC_ENC_MAGIC 0x52454E43 /* RENC */ 82#define CODEC_ENC_MAGIC 0x52454E43 /* RENC */
83 83
84/* increase this every time the api struct changes */ 84/* increase this every time the api struct changes */
85#define CODEC_API_VERSION 27 85#define CODEC_API_VERSION 28
86 86
87/* update this to latest version if a change to the api struct breaks 87/* update this to latest version if a change to the api struct breaks
88 backwards compatibility (and please take the opportunity to sort in any 88 backwards compatibility (and please take the opportunity to sort in any
89 new function which are "waiting" at the end of the function table) */ 89 new function which are "waiting" at the end of the function table) */
90#define CODEC_MIN_API_VERSION 27 90#define CODEC_MIN_API_VERSION 28
91 91
92/* codec return codes */ 92/* codec return codes */
93enum codec_status { 93enum codec_status {
@@ -164,14 +164,14 @@ struct codec_api {
164 void (*yield)(void); 164 void (*yield)(void);
165 165
166#if NUM_CORES > 1 166#if NUM_CORES > 1
167 struct thread_entry * 167 unsigned int
168 (*create_thread)(void (*function)(void), void* stack, 168 (*create_thread)(void (*function)(void), void* stack,
169 size_t stack_size, unsigned flags, const char *name 169 size_t stack_size, unsigned flags, const char *name
170 IF_PRIO(, int priority) 170 IF_PRIO(, int priority)
171 IF_COP(, unsigned int core)); 171 IF_COP(, unsigned int core));
172 172
173 void (*thread_thaw)(struct thread_entry *thread); 173 void (*thread_thaw)(unsigned int thread_id);
174 void (*thread_wait)(struct thread_entry *thread); 174 void (*thread_wait)(unsigned int thread_id);
175 void (*semaphore_init)(struct semaphore *s, int max, int start); 175 void (*semaphore_init)(struct semaphore *s, int max, int start);
176 void (*semaphore_wait)(struct semaphore *s); 176 void (*semaphore_wait)(struct semaphore *s);
177 void (*semaphore_release)(struct semaphore *s); 177 void (*semaphore_release)(struct semaphore *s);
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c
index 7732622383..37a1afadfa 100644
--- a/apps/codecs/mpa.c
+++ b/apps/codecs/mpa.c
@@ -200,7 +200,7 @@ static void set_elapsed(struct mp3entry* id3)
200static int mad_synth_thread_stack[DEFAULT_STACK_SIZE/sizeof(int)/2] IBSS_ATTR; 200static int mad_synth_thread_stack[DEFAULT_STACK_SIZE/sizeof(int)/2] IBSS_ATTR;
201 201
202static const unsigned char * const mad_synth_thread_name = "mp3dec"; 202static const unsigned char * const mad_synth_thread_name = "mp3dec";
203static struct thread_entry *mad_synth_thread_p; 203static unsigned int mad_synth_thread_id = 0;
204 204
205 205
206static void mad_synth_thread(void) 206static void mad_synth_thread(void)
@@ -249,14 +249,14 @@ static bool mad_synth_thread_create(void)
249 ci->semaphore_init(&synth_done_sem, 1, 0); 249 ci->semaphore_init(&synth_done_sem, 1, 0);
250 ci->semaphore_init(&synth_pending_sem, 1, 0); 250 ci->semaphore_init(&synth_pending_sem, 1, 0);
251 251
252 mad_synth_thread_p = ci->create_thread(mad_synth_thread, 252 mad_synth_thread_id = ci->create_thread(mad_synth_thread,
253 mad_synth_thread_stack, 253 mad_synth_thread_stack,
254 sizeof(mad_synth_thread_stack), 0, 254 sizeof(mad_synth_thread_stack), 0,
255 mad_synth_thread_name 255 mad_synth_thread_name
256 IF_PRIO(, PRIORITY_PLAYBACK) 256 IF_PRIO(, PRIORITY_PLAYBACK)
257 IF_COP(, COP)); 257 IF_COP(, COP));
258 258
259 if (mad_synth_thread_p == NULL) 259 if (mad_synth_thread_id == 0)
260 return false; 260 return false;
261 261
262 return true; 262 return true;
@@ -267,7 +267,7 @@ static void mad_synth_thread_quit(void)
267 /*mop up COP thread*/ 267 /*mop up COP thread*/
268 die=1; 268 die=1;
269 ci->semaphore_release(&synth_pending_sem); 269 ci->semaphore_release(&synth_pending_sem);
270 ci->thread_wait(mad_synth_thread_p); 270 ci->thread_wait(mad_synth_thread_id);
271 invalidate_icache(); 271 invalidate_icache();
272} 272}
273#else 273#else
diff --git a/apps/codecs/spc.c b/apps/codecs/spc.c
index 380cfbdb8b..14d28dfca8 100644
--- a/apps/codecs/spc.c
+++ b/apps/codecs/spc.c
@@ -197,7 +197,7 @@ static int spc_emu_thread_stack[DEFAULT_STACK_SIZE/sizeof(int)]
197 CACHEALIGN_ATTR; 197 CACHEALIGN_ATTR;
198 198
199static const unsigned char * const spc_emu_thread_name = "spc emu"; 199static const unsigned char * const spc_emu_thread_name = "spc emu";
200static struct thread_entry *emu_thread_p; 200static unsigned int emu_thread_id = 0;
201 201
202enum 202enum
203{ 203{
@@ -352,11 +352,11 @@ static void spc_emu_thread(void)
352 352
353static bool spc_emu_start(void) 353static bool spc_emu_start(void)
354{ 354{
355 emu_thread_p = ci->create_thread(spc_emu_thread, spc_emu_thread_stack, 355 emu_thread_id = ci->create_thread(spc_emu_thread, spc_emu_thread_stack,
356 sizeof(spc_emu_thread_stack), CREATE_THREAD_FROZEN, 356 sizeof(spc_emu_thread_stack), CREATE_THREAD_FROZEN,
357 spc_emu_thread_name IF_PRIO(, PRIORITY_PLAYBACK), COP); 357 spc_emu_thread_name IF_PRIO(, PRIORITY_PLAYBACK), COP);
358 358
359 if (emu_thread_p == NULL) 359 if (emu_thread_id == 0)
360 return false; 360 return false;
361 361
362 /* Initialize audio queue as full to prevent emu thread from trying to run the 362 /* Initialize audio queue as full to prevent emu thread from trying to run the
@@ -368,7 +368,7 @@ static bool spc_emu_start(void)
368 sample_queue.tail = 2; 368 sample_queue.tail = 2;
369 369
370 /* Start it running */ 370 /* Start it running */
371 ci->thread_thaw(emu_thread_p); 371 ci->thread_thaw(emu_thread_id);
372 return true; 372 return true;
373} 373}
374 374
@@ -382,10 +382,10 @@ static inline int load_spc_buffer(uint8_t *buf, size_t size)
382 382
383static inline void spc_emu_quit(void) 383static inline void spc_emu_quit(void)
384{ 384{
385 if (emu_thread_p != NULL) { 385 if (emu_thread_id != 0) {
386 emu_thread_send_msg(SPC_EMU_QUIT, 0); 386 emu_thread_send_msg(SPC_EMU_QUIT, 0);
387 /* Wait for emu thread to be killed */ 387 /* Wait for emu thread to be killed */
388 ci->thread_wait(emu_thread_p); 388 ci->thread_wait(emu_thread_id);
389 invalidate_icache(); 389 invalidate_icache();
390 } 390 }
391} 391}
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c
index c7db4d3101..9ca5fbf5cf 100644
--- a/apps/pcmbuf.c
+++ b/apps/pcmbuf.c
@@ -115,7 +115,7 @@ static bool pcmbuf_flush;
115static int codec_thread_priority = PRIORITY_PLAYBACK; 115static int codec_thread_priority = PRIORITY_PLAYBACK;
116#endif 116#endif
117 117
118extern struct thread_entry *codec_thread_p; 118extern uintptr_t codec_thread_id;
119 119
120/* Helpful macros for use in conditionals this assumes some of the above 120/* Helpful macros for use in conditionals this assumes some of the above
121 * static variable names */ 121 * static variable names */
@@ -258,13 +258,13 @@ static void boost_codec_thread(bool boost)
258 if (priority != codec_thread_priority) 258 if (priority != codec_thread_priority)
259 { 259 {
260 codec_thread_priority = priority; 260 codec_thread_priority = priority;
261 thread_set_priority(codec_thread_p, priority); 261 thread_set_priority(codec_thread_id, priority);
262 voice_thread_set_priority(priority); 262 voice_thread_set_priority(priority);
263 } 263 }
264 } 264 }
265 else if (codec_thread_priority != PRIORITY_PLAYBACK) 265 else if (codec_thread_priority != PRIORITY_PLAYBACK)
266 { 266 {
267 thread_set_priority(codec_thread_p, PRIORITY_PLAYBACK); 267 thread_set_priority(codec_thread_id, PRIORITY_PLAYBACK);
268 voice_thread_set_priority(PRIORITY_PLAYBACK); 268 voice_thread_set_priority(PRIORITY_PLAYBACK);
269 codec_thread_priority = PRIORITY_PLAYBACK; 269 codec_thread_priority = PRIORITY_PLAYBACK;
270 } 270 }
@@ -276,7 +276,7 @@ static void pcmbuf_under_watermark(void)
276 /* Only codec thread initiates boost - voice boosts the cpu when playing 276 /* Only codec thread initiates boost - voice boosts the cpu when playing
277 a clip */ 277 a clip */
278#ifndef SIMULATOR 278#ifndef SIMULATOR
279 if (thread_get_current() == codec_thread_p) 279 if (thread_get_current() == codec_thread_id)
280#endif /* SIMULATOR */ 280#endif /* SIMULATOR */
281 { 281 {
282#ifdef HAVE_PRIORITY_SCHEDULING 282#ifdef HAVE_PRIORITY_SCHEDULING
diff --git a/apps/playback.c b/apps/playback.c
index 50c4017200..3aed12e918 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -299,7 +299,7 @@ static struct queue_sender_list codec_queue_sender_list;
299static long codec_stack[(DEFAULT_STACK_SIZE + 0x2000)/sizeof(long)] 299static long codec_stack[(DEFAULT_STACK_SIZE + 0x2000)/sizeof(long)]
300IBSS_ATTR; 300IBSS_ATTR;
301static const char codec_thread_name[] = "codec"; 301static const char codec_thread_name[] = "codec";
302struct thread_entry *codec_thread_p; /* For modifying thread priority later. */ 302unsigned int codec_thread_id; /* For modifying thread priority later. */
303 303
304/* PCM buffer messaging */ 304/* PCM buffer messaging */
305static struct event_queue pcmbuf_queue SHAREDBSS_ATTR; 305static struct event_queue pcmbuf_queue SHAREDBSS_ATTR;
@@ -2499,7 +2499,7 @@ static void audio_thread(void)
2499 */ 2499 */
2500void audio_init(void) 2500void audio_init(void)
2501{ 2501{
2502 struct thread_entry *audio_thread_p; 2502 unsigned int audio_thread_id;
2503 2503
2504 /* Can never do this twice */ 2504 /* Can never do this twice */
2505 if (audio_is_initialized) 2505 if (audio_is_initialized)
@@ -2543,22 +2543,22 @@ void audio_init(void)
2543 talk first */ 2543 talk first */
2544 talk_init(); 2544 talk_init();
2545 2545
2546 codec_thread_p = create_thread( 2546 codec_thread_id = create_thread(
2547 codec_thread, codec_stack, sizeof(codec_stack), 2547 codec_thread, codec_stack, sizeof(codec_stack),
2548 CREATE_THREAD_FROZEN, 2548 CREATE_THREAD_FROZEN,
2549 codec_thread_name IF_PRIO(, PRIORITY_PLAYBACK) 2549 codec_thread_name IF_PRIO(, PRIORITY_PLAYBACK)
2550 IF_COP(, CPU)); 2550 IF_COP(, CPU));
2551 2551
2552 queue_enable_queue_send(&codec_queue, &codec_queue_sender_list, 2552 queue_enable_queue_send(&codec_queue, &codec_queue_sender_list,
2553 codec_thread_p); 2553 codec_thread_id);
2554 2554
2555 audio_thread_p = create_thread(audio_thread, audio_stack, 2555 audio_thread_id = create_thread(audio_thread, audio_stack,
2556 sizeof(audio_stack), CREATE_THREAD_FROZEN, 2556 sizeof(audio_stack), CREATE_THREAD_FROZEN,
2557 audio_thread_name IF_PRIO(, PRIORITY_USER_INTERFACE) 2557 audio_thread_name IF_PRIO(, PRIORITY_USER_INTERFACE)
2558 IF_COP(, CPU)); 2558 IF_COP(, CPU));
2559 2559
2560 queue_enable_queue_send(&audio_queue, &audio_queue_sender_list, 2560 queue_enable_queue_send(&audio_queue, &audio_queue_sender_list,
2561 audio_thread_p); 2561 audio_thread_id);
2562 2562
2563#ifdef PLAYBACK_VOICE 2563#ifdef PLAYBACK_VOICE
2564 voice_thread_init(); 2564 voice_thread_init();
@@ -2599,8 +2599,8 @@ void audio_init(void)
2599#ifdef PLAYBACK_VOICE 2599#ifdef PLAYBACK_VOICE
2600 voice_thread_resume(); 2600 voice_thread_resume();
2601#endif 2601#endif
2602 thread_thaw(codec_thread_p); 2602 thread_thaw(codec_thread_id);
2603 thread_thaw(audio_thread_p); 2603 thread_thaw(audio_thread_id);
2604 2604
2605} /* audio_init */ 2605} /* audio_init */
2606 2606
diff --git a/apps/plugin.c b/apps/plugin.c
index de2dd3f7c7..e55ecd46a7 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -146,7 +146,8 @@ static const struct plugin_api rockbox_api = {
146 font_get_width, 146 font_get_width,
147 screen_clear_area, 147 screen_clear_area,
148 gui_scrollbar_draw, 148 gui_scrollbar_draw,
149#endif 149#endif /* HAVE_LCD_BITMAP */
150 get_codepage_name,
150 151
151 backlight_on, 152 backlight_on,
152 backlight_off, 153 backlight_off,
@@ -482,6 +483,7 @@ static const struct plugin_api rockbox_api = {
482 &statusbars, 483 &statusbars,
483 gui_syncstatusbar_draw, 484 gui_syncstatusbar_draw,
484 /* options */ 485 /* options */
486 get_settings_list,
485 find_setting, 487 find_setting,
486 option_screen, 488 option_screen,
487 set_option, 489 set_option,
@@ -619,8 +621,6 @@ static const struct plugin_api rockbox_api = {
619 appsversion, 621 appsversion,
620 /* new stuff at the end, sort into place next time 622 /* new stuff at the end, sort into place next time
621 the API gets incompatible */ 623 the API gets incompatible */
622 get_settings_list,
623 get_codepage_name,
624}; 624};
625 625
626int plugin_load(const char* plugin, const void* parameter) 626int plugin_load(const char* plugin, const void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index fd01e15bbd..e91c866098 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -7,7 +7,7 @@
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2002 Björn Stenberg 10 * Copyright (C) 2002 Björn Stenberg
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
@@ -131,12 +131,12 @@ void* plugin_get_buffer(size_t *buffer_size);
131#define PLUGIN_MAGIC 0x526F634B /* RocK */ 131#define PLUGIN_MAGIC 0x526F634B /* RocK */
132 132
133/* increase this every time the api struct changes */ 133/* increase this every time the api struct changes */
134#define PLUGIN_API_VERSION 128 134#define PLUGIN_API_VERSION 129
135 135
136/* update this to latest version if a change to the api struct breaks 136/* update this to latest version if a change to the api struct breaks
137 backwards compatibility (and please take the opportunity to sort in any 137 backwards compatibility (and please take the opportunity to sort in any
138 new function which are "waiting" at the end of the function table) */ 138 new function which are "waiting" at the end of the function table) */
139#define PLUGIN_MIN_API_VERSION 127 139#define PLUGIN_MIN_API_VERSION 129
140 140
141/* plugin return codes */ 141/* plugin return codes */
142enum plugin_status { 142enum plugin_status {
@@ -244,6 +244,7 @@ struct plugin_api {
244 int min_shown, int max_shown, 244 int min_shown, int max_shown,
245 unsigned flags); 245 unsigned flags);
246#endif /* HAVE_LCD_BITMAP */ 246#endif /* HAVE_LCD_BITMAP */
247 const char* (*get_codepage_name)(int cp);
247 248
248 /* backlight */ 249 /* backlight */
249 /* The backlight_* functions must be present in the API regardless whether 250 /* The backlight_* functions must be present in the API regardless whether
@@ -408,13 +409,13 @@ struct plugin_api {
408 long (*default_event_handler)(long event); 409 long (*default_event_handler)(long event);
409 long (*default_event_handler_ex)(long event, void (*callback)(void *), void *parameter); 410 long (*default_event_handler_ex)(long event, void (*callback)(void *), void *parameter);
410 struct thread_entry* threads; 411 struct thread_entry* threads;
411 struct thread_entry* (*create_thread)(void (*function)(void), void* stack, 412 unsigned int (*create_thread)(void (*function)(void), void* stack,
412 size_t stack_size, unsigned flags, 413 size_t stack_size, unsigned flags,
413 const char *name 414 const char *name
414 IF_PRIO(, int priority) 415 IF_PRIO(, int priority)
415 IF_COP(, unsigned int core)); 416 IF_COP(, unsigned int core));
416 void (*thread_exit)(void); 417 void (*thread_exit)(void);
417 void (*thread_wait)(struct thread_entry *thread); 418 void (*thread_wait)(unsigned int thread_id);
418#if CONFIG_CODEC == SWCODEC 419#if CONFIG_CODEC == SWCODEC
419 void (*mutex_init)(struct mutex *m); 420 void (*mutex_init)(struct mutex *m);
420 void (*mutex_lock)(struct mutex *m); 421 void (*mutex_lock)(struct mutex *m);
@@ -456,7 +457,7 @@ struct plugin_api {
456#if CONFIG_CODEC == SWCODEC 457#if CONFIG_CODEC == SWCODEC
457 void (*queue_enable_queue_send)(struct event_queue *q, 458 void (*queue_enable_queue_send)(struct event_queue *q,
458 struct queue_sender_list *send, 459 struct queue_sender_list *send,
459 struct thread_entry *owner); 460 unsigned int thread_id);
460 bool (*queue_empty)(const struct event_queue *q); 461 bool (*queue_empty)(const struct event_queue *q);
461 void (*queue_wait)(struct event_queue *q, struct queue_event *ev); 462 void (*queue_wait)(struct event_queue *q, struct queue_event *ev);
462 intptr_t (*queue_send)(struct event_queue *q, long id, 463 intptr_t (*queue_send)(struct event_queue *q, long id,
@@ -616,6 +617,7 @@ struct plugin_api {
616 void (*gui_syncstatusbar_draw)(struct gui_syncstatusbar * bars, bool force_redraw); 617 void (*gui_syncstatusbar_draw)(struct gui_syncstatusbar * bars, bool force_redraw);
617 618
618 /* options */ 619 /* options */
620 const struct settings_list* (*get_settings_list)(int*count);
619 const struct settings_list* (*find_setting)(const void* variable, int *id); 621 const struct settings_list* (*find_setting)(const void* variable, int *id);
620 bool (*option_screen)(const struct settings_list *setting, 622 bool (*option_screen)(const struct settings_list *setting,
621 struct viewport parent[NB_SCREENS], 623 struct viewport parent[NB_SCREENS],
@@ -771,7 +773,7 @@ struct plugin_api {
771 char *buf, int buflen); 773 char *buf, int buflen);
772#endif 774#endif
773 775
774 void (*thread_thaw)(struct thread_entry *thread); 776 void (*thread_thaw)(unsigned int thread_id);
775 777
776#ifdef HAVE_SEMAPHORE_OBJECTS 778#ifdef HAVE_SEMAPHORE_OBJECTS
777 void (*semaphore_init)(struct semaphore *s, int max, int start); 779 void (*semaphore_init)(struct semaphore *s, int max, int start);
@@ -782,8 +784,6 @@ struct plugin_api {
782 const char *appsversion; 784 const char *appsversion;
783 /* new stuff at the end, sort into place next time 785 /* new stuff at the end, sort into place next time
784 the API gets incompatible */ 786 the API gets incompatible */
785 const struct settings_list* (*get_settings_list)(int*count);
786 const char* (*get_codepage_name)(int cp);
787}; 787};
788 788
789/* plugin header */ 789/* plugin header */
diff --git a/apps/plugins/alpine_cdc.c b/apps/plugins/alpine_cdc.c
index dfffc3b3cd..d15e26ae36 100644
--- a/apps/plugins/alpine_cdc.c
+++ b/apps/plugins/alpine_cdc.c
@@ -206,7 +206,7 @@ struct
206{ 206{
207 bool foreground; /* set as long as we're owning the UI */ 207 bool foreground; /* set as long as we're owning the UI */
208 bool exiting; /* signal to the thread that we want to exit */ 208 bool exiting; /* signal to the thread that we want to exit */
209 struct thread_entry *thread; /* worker thread id */ 209 unsigned int thread; /* worker thread id */
210} gTread; 210} gTread;
211 211
212static const struct plugin_api* rb; /* here is the global API struct pointer */ 212static const struct plugin_api* rb; /* here is the global API struct pointer */
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index b951b01432..0c30ebabc3 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -216,7 +216,7 @@ struct batt_info
216 216
217#define BUF_ELEMENTS (sizeof(bat)/sizeof(struct batt_info)) 217#define BUF_ELEMENTS (sizeof(bat)/sizeof(struct batt_info))
218 218
219static struct thread_entry *thread_id; 219static unsigned int thread_id;
220static struct event_queue thread_q; 220static struct event_queue thread_q;
221static bool in_usb_mode; 221static bool in_usb_mode;
222static unsigned int buf_idx; 222static unsigned int buf_idx;
@@ -537,7 +537,7 @@ int main(void)
537 if ((thread_id = rb->create_thread(thread, thread_stack, 537 if ((thread_id = rb->create_thread(thread, thread_stack,
538 sizeof(thread_stack), 0, "Battery Benchmark" 538 sizeof(thread_stack), 0, "Battery Benchmark"
539 IF_PRIO(, PRIORITY_BACKGROUND) 539 IF_PRIO(, PRIORITY_BACKGROUND)
540 IF_COP(, CPU))) == NULL) 540 IF_COP(, CPU))) == 0)
541 { 541 {
542 rb->splash(HZ, "Cannot create thread!"); 542 rb->splash(HZ, "Cannot create thread!");
543 return PLUGIN_ERROR; 543 return PLUGIN_ERROR;
diff --git a/apps/plugins/mpegplayer/audio_thread.c b/apps/plugins/mpegplayer/audio_thread.c
index 45226575c9..2fb46efd56 100644
--- a/apps/plugins/mpegplayer/audio_thread.c
+++ b/apps/plugins/mpegplayer/audio_thread.c
@@ -732,7 +732,7 @@ bool audio_thread_init(void)
732 rb->queue_enable_queue_send(audio_str.hdr.q, &audio_str_queue_send, 732 rb->queue_enable_queue_send(audio_str.hdr.q, &audio_str_queue_send,
733 audio_str.thread); 733 audio_str.thread);
734 734
735 if (audio_str.thread == NULL) 735 if (audio_str.thread == 0)
736 return false; 736 return false;
737 737
738 /* Wait for thread to initialize */ 738 /* Wait for thread to initialize */
@@ -744,11 +744,11 @@ bool audio_thread_init(void)
744/* Stops the audio thread */ 744/* Stops the audio thread */
745void audio_thread_exit(void) 745void audio_thread_exit(void)
746{ 746{
747 if (audio_str.thread != NULL) 747 if (audio_str.thread != 0)
748 { 748 {
749 str_post_msg(&audio_str, STREAM_QUIT, 0); 749 str_post_msg(&audio_str, STREAM_QUIT, 0);
750 rb->thread_wait(audio_str.thread); 750 rb->thread_wait(audio_str.thread);
751 audio_str.thread = NULL; 751 audio_str.thread = 0;
752 } 752 }
753 753
754#ifndef SIMULATOR 754#ifndef SIMULATOR
diff --git a/apps/plugins/mpegplayer/disk_buf.c b/apps/plugins/mpegplayer/disk_buf.c
index df5e005b50..c008139356 100644
--- a/apps/plugins/mpegplayer/disk_buf.c
+++ b/apps/plugins/mpegplayer/disk_buf.c
@@ -835,7 +835,7 @@ void disk_buf_reply_msg(intptr_t retval)
835 835
836bool disk_buf_init(void) 836bool disk_buf_init(void)
837{ 837{
838 disk_buf.thread = NULL; 838 disk_buf.thread = 0;
839 list_initialize(&nf_list); 839 list_initialize(&nf_list);
840 840
841 rb->mutex_init(&disk_buf_mtx); 841 rb->mutex_init(&disk_buf_mtx);
@@ -893,7 +893,7 @@ bool disk_buf_init(void)
893 rb->queue_enable_queue_send(disk_buf.q, &disk_buf_queue_send, 893 rb->queue_enable_queue_send(disk_buf.q, &disk_buf_queue_send,
894 disk_buf.thread); 894 disk_buf.thread);
895 895
896 if (disk_buf.thread == NULL) 896 if (disk_buf.thread == 0)
897 return false; 897 return false;
898 898
899 /* Wait for thread to initialize */ 899 /* Wait for thread to initialize */
@@ -904,10 +904,10 @@ bool disk_buf_init(void)
904 904
905void disk_buf_exit(void) 905void disk_buf_exit(void)
906{ 906{
907 if (disk_buf.thread != NULL) 907 if (disk_buf.thread != 0)
908 { 908 {
909 rb->queue_post(disk_buf.q, STREAM_QUIT, 0); 909 rb->queue_post(disk_buf.q, STREAM_QUIT, 0);
910 rb->thread_wait(disk_buf.thread); 910 rb->thread_wait(disk_buf.thread);
911 disk_buf.thread = NULL; 911 disk_buf.thread = 0;
912 } 912 }
913} 913}
diff --git a/apps/plugins/mpegplayer/disk_buf.h b/apps/plugins/mpegplayer/disk_buf.h
index b6399c81d1..e16939a92e 100644
--- a/apps/plugins/mpegplayer/disk_buf.h
+++ b/apps/plugins/mpegplayer/disk_buf.h
@@ -62,7 +62,7 @@ struct dbuf_range
62 * playback events as well as buffering */ 62 * playback events as well as buffering */
63struct disk_buf 63struct disk_buf
64{ 64{
65 struct thread_entry *thread; 65 unsigned int thread;
66 struct event_queue *q; 66 struct event_queue *q;
67 uint8_t *start; /* Start pointer */ 67 uint8_t *start; /* Start pointer */
68 uint8_t *end; /* End of buffer pointer less MPEG_GUARDBUF_SIZE. The 68 uint8_t *end; /* End of buffer pointer less MPEG_GUARDBUF_SIZE. The
diff --git a/apps/plugins/mpegplayer/mpeg_parser.c b/apps/plugins/mpegplayer/mpeg_parser.c
index 54a6f23d92..42c388b375 100644
--- a/apps/plugins/mpegplayer/mpeg_parser.c
+++ b/apps/plugins/mpegplayer/mpeg_parser.c
@@ -1027,7 +1027,7 @@ intptr_t parser_send_video_msg(long id, intptr_t data)
1027{ 1027{
1028 intptr_t retval = 0; 1028 intptr_t retval = 0;
1029 1029
1030 if (video_str.thread != NULL && disk_buf.in_file >= 0) 1030 if (video_str.thread != 0 && disk_buf.in_file >= 0)
1031 { 1031 {
1032 /* Hook certain messages since they involve multiple operations 1032 /* Hook certain messages since they involve multiple operations
1033 * behind the scenes */ 1033 * behind the scenes */
diff --git a/apps/plugins/mpegplayer/stream_mgr.c b/apps/plugins/mpegplayer/stream_mgr.c
index 424d2fe503..222ffb7d6b 100644
--- a/apps/plugins/mpegplayer/stream_mgr.c
+++ b/apps/plugins/mpegplayer/stream_mgr.c
@@ -908,7 +908,7 @@ static void stream_mgr_thread(void)
908/* Opens a new file */ 908/* Opens a new file */
909int stream_open(const char *filename) 909int stream_open(const char *filename)
910{ 910{
911 if (stream_mgr.thread != NULL) 911 if (stream_mgr.thread != 0)
912 return stream_mgr_send_msg(STREAM_OPEN, (intptr_t)filename); 912 return stream_mgr_send_msg(STREAM_OPEN, (intptr_t)filename);
913 return STREAM_ERROR; 913 return STREAM_ERROR;
914} 914}
@@ -916,7 +916,7 @@ int stream_open(const char *filename)
916/* Plays the current file starting at time 'start' */ 916/* Plays the current file starting at time 'start' */
917int stream_play(void) 917int stream_play(void)
918{ 918{
919 if (stream_mgr.thread != NULL) 919 if (stream_mgr.thread != 0)
920 return stream_mgr_send_msg(STREAM_PLAY, 0); 920 return stream_mgr_send_msg(STREAM_PLAY, 0);
921 return STREAM_ERROR; 921 return STREAM_ERROR;
922} 922}
@@ -924,7 +924,7 @@ int stream_play(void)
924/* Pauses playback if playing */ 924/* Pauses playback if playing */
925int stream_pause(void) 925int stream_pause(void)
926{ 926{
927 if (stream_mgr.thread != NULL) 927 if (stream_mgr.thread != 0)
928 return stream_mgr_send_msg(STREAM_PAUSE, false); 928 return stream_mgr_send_msg(STREAM_PAUSE, false);
929 return STREAM_ERROR; 929 return STREAM_ERROR;
930} 930}
@@ -932,7 +932,7 @@ int stream_pause(void)
932/* Resumes playback if paused */ 932/* Resumes playback if paused */
933int stream_resume(void) 933int stream_resume(void)
934{ 934{
935 if (stream_mgr.thread != NULL) 935 if (stream_mgr.thread != 0)
936 return stream_mgr_send_msg(STREAM_PAUSE, true); 936 return stream_mgr_send_msg(STREAM_PAUSE, true);
937 return STREAM_ERROR; 937 return STREAM_ERROR;
938} 938}
@@ -940,7 +940,7 @@ int stream_resume(void)
940/* Stops playback if not stopped */ 940/* Stops playback if not stopped */
941int stream_stop(void) 941int stream_stop(void)
942{ 942{
943 if (stream_mgr.thread != NULL) 943 if (stream_mgr.thread != 0)
944 return stream_mgr_send_msg(STREAM_STOP, 0); 944 return stream_mgr_send_msg(STREAM_STOP, 0);
945 return STREAM_ERROR; 945 return STREAM_ERROR;
946} 946}
@@ -950,7 +950,7 @@ int stream_seek(uint32_t time, int whence)
950{ 950{
951 int ret; 951 int ret;
952 952
953 if (stream_mgr.thread == NULL) 953 if (stream_mgr.thread == 0)
954 return STREAM_ERROR; 954 return STREAM_ERROR;
955 955
956 stream_mgr_lock(); 956 stream_mgr_lock();
@@ -968,7 +968,7 @@ int stream_seek(uint32_t time, int whence)
968/* Closes the current file */ 968/* Closes the current file */
969int stream_close(void) 969int stream_close(void)
970{ 970{
971 if (stream_mgr.thread != NULL) 971 if (stream_mgr.thread != 0)
972 return stream_mgr_send_msg(STREAM_CLOSE, 0); 972 return stream_mgr_send_msg(STREAM_CLOSE, 0);
973 return STREAM_ERROR; 973 return STREAM_ERROR;
974} 974}
@@ -1018,7 +1018,7 @@ int stream_init(void)
1018 rb->queue_enable_queue_send(stream_mgr.q, &stream_mgr_queue_send, 1018 rb->queue_enable_queue_send(stream_mgr.q, &stream_mgr_queue_send,
1019 stream_mgr.thread); 1019 stream_mgr.thread);
1020 1020
1021 if (stream_mgr.thread == NULL) 1021 if (stream_mgr.thread == 0)
1022 { 1022 {
1023 rb->splash(HZ, "Could not create stream manager thread!"); 1023 rb->splash(HZ, "Could not create stream manager thread!");
1024 return STREAM_ERROR; 1024 return STREAM_ERROR;
@@ -1073,11 +1073,11 @@ void stream_exit(void)
1073 disk_buf_exit(); 1073 disk_buf_exit();
1074 pcm_output_exit(); 1074 pcm_output_exit();
1075 1075
1076 if (stream_mgr.thread != NULL) 1076 if (stream_mgr.thread != 0)
1077 { 1077 {
1078 stream_mgr_post_msg(STREAM_QUIT, 0); 1078 stream_mgr_post_msg(STREAM_QUIT, 0);
1079 rb->thread_wait(stream_mgr.thread); 1079 rb->thread_wait(stream_mgr.thread);
1080 stream_mgr.thread = NULL; 1080 stream_mgr.thread = 0;
1081 } 1081 }
1082 1082
1083#ifndef HAVE_LCD_COLOR 1083#ifndef HAVE_LCD_COLOR
diff --git a/apps/plugins/mpegplayer/stream_mgr.h b/apps/plugins/mpegplayer/stream_mgr.h
index e3ea9207e6..a00b39f189 100644
--- a/apps/plugins/mpegplayer/stream_mgr.h
+++ b/apps/plugins/mpegplayer/stream_mgr.h
@@ -27,7 +27,7 @@
27 * coordination with assistance from the parser */ 27 * coordination with assistance from the parser */
28struct stream_mgr 28struct stream_mgr
29{ 29{
30 struct thread_entry *thread; /* Playback control thread */ 30 unsigned int thread; /* Playback control thread */
31 struct event_queue *q; /* event queue for control thread */ 31 struct event_queue *q; /* event queue for control thread */
32 const char *filename; /* Current filename */ 32 const char *filename; /* Current filename */
33 uint32_t resume_time; /* The stream tick where playback was 33 uint32_t resume_time; /* The stream tick where playback was
diff --git a/apps/plugins/mpegplayer/stream_thread.h b/apps/plugins/mpegplayer/stream_thread.h
index d6e42d274f..30bf46e6ff 100644
--- a/apps/plugins/mpegplayer/stream_thread.h
+++ b/apps/plugins/mpegplayer/stream_thread.h
@@ -45,7 +45,7 @@ struct stream_hdr
45struct stream 45struct stream
46{ 46{
47 struct stream_hdr hdr; /* Base stream data */ 47 struct stream_hdr hdr; /* Base stream data */
48 struct thread_entry *thread; /* Stream's thread */ 48 unsigned int thread; /* Stream's thread */
49 uint8_t* curr_packet; /* Current stream packet beginning */ 49 uint8_t* curr_packet; /* Current stream packet beginning */
50 uint8_t* curr_packet_end; /* Current stream packet end */ 50 uint8_t* curr_packet_end; /* Current stream packet end */
51 struct list_item l; /* List of streams - either reserve pool 51 struct list_item l; /* List of streams - either reserve pool
diff --git a/apps/plugins/mpegplayer/video_thread.c b/apps/plugins/mpegplayer/video_thread.c
index 100904b01b..8b84686a3b 100644
--- a/apps/plugins/mpegplayer/video_thread.c
+++ b/apps/plugins/mpegplayer/video_thread.c
@@ -1009,7 +1009,7 @@ bool video_thread_init(void)
1009 rb->queue_enable_queue_send(video_str.hdr.q, &video_str_queue_send, 1009 rb->queue_enable_queue_send(video_str.hdr.q, &video_str_queue_send,
1010 video_str.thread); 1010 video_str.thread);
1011 1011
1012 if (video_str.thread == NULL) 1012 if (video_str.thread == 0)
1013 return false; 1013 return false;
1014 1014
1015 /* Wait for thread to initialize */ 1015 /* Wait for thread to initialize */
@@ -1022,11 +1022,11 @@ bool video_thread_init(void)
1022/* Terminates the video thread */ 1022/* Terminates the video thread */
1023void video_thread_exit(void) 1023void video_thread_exit(void)
1024{ 1024{
1025 if (video_str.thread != NULL) 1025 if (video_str.thread != 0)
1026 { 1026 {
1027 str_post_msg(&video_str, STREAM_QUIT, 0); 1027 str_post_msg(&video_str, STREAM_QUIT, 0);
1028 rb->thread_wait(video_str.thread); 1028 rb->thread_wait(video_str.thread);
1029 IF_COP(invalidate_icache()); 1029 IF_COP(invalidate_icache());
1030 video_str.thread = NULL; 1030 video_str.thread = 0;
1031 } 1031 }
1032} 1032}
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c
index 29e8a749d5..232c3f6bc4 100644
--- a/apps/plugins/pictureflow.c
+++ b/apps/plugins/pictureflow.c
@@ -218,7 +218,7 @@ struct mutex slide_cache_stack_lock;
218 218
219static int empty_slide_hid; 219static int empty_slide_hid;
220 220
221struct thread_entry *thread_id; 221unsigned int thread_id;
222struct event_queue thread_q; 222struct event_queue thread_q;
223 223
224static char tmp_path_name[MAX_PATH]; 224static char tmp_path_name[MAX_PATH];
@@ -831,7 +831,7 @@ bool create_pf_thread(void)
831 IF_PRIO(, PRIORITY_BACKGROUND) 831 IF_PRIO(, PRIORITY_BACKGROUND)
832 IF_COP(, CPU) 832 IF_COP(, CPU)
833 ) 833 )
834 ) == NULL) { 834 ) == 0) {
835 return false; 835 return false;
836 } 836 }
837 thread_is_running = true; 837 thread_is_running = true;
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c
index b1f5aff385..17effd8dfd 100644
--- a/apps/plugins/test_codec.c
+++ b/apps/plugins/test_codec.c
@@ -525,7 +525,7 @@ static enum plugin_status test_track(const char* filename)
525 long ticks; 525 long ticks;
526 unsigned long speed; 526 unsigned long speed;
527 unsigned long duration; 527 unsigned long duration;
528 struct thread_entry* codecthread_id; 528 unsigned int codecthread_id;
529 const char* ch; 529 const char* ch;
530 530
531 /* Display filename (excluding any path)*/ 531 /* Display filename (excluding any path)*/
@@ -590,7 +590,7 @@ static enum plugin_status test_track(const char* filename)
590 590
591 if ((codecthread_id = rb->create_thread(codec_thread, 591 if ((codecthread_id = rb->create_thread(codec_thread,
592 codec_stack, codec_stack_size, 0, "testcodec" 592 codec_stack, codec_stack_size, 0, "testcodec"
593 IF_PRIO(,PRIORITY_PLAYBACK) IF_COP(, CPU))) == NULL) 593 IF_PRIO(,PRIORITY_PLAYBACK) IF_COP(, CPU))) == 0)
594 { 594 {
595 log_text("Cannot create codec thread!",true); 595 log_text("Cannot create codec thread!",true);
596 goto exit; 596 goto exit;
diff --git a/apps/plugins/test_sampr.c b/apps/plugins/test_sampr.c
index 77f9b8a779..1131a7a989 100644
--- a/apps/plugins/test_sampr.c
+++ b/apps/plugins/test_sampr.c
@@ -39,7 +39,7 @@ static unsigned long hw_sampr IDATA_ATTR = HW_SAMPR_DEFAULT;
39 39
40static int gen_thread_stack[DEFAULT_STACK_SIZE/sizeof(int)] IBSS_ATTR; 40static int gen_thread_stack[DEFAULT_STACK_SIZE/sizeof(int)] IBSS_ATTR;
41static bool gen_quit IBSS_ATTR; 41static bool gen_quit IBSS_ATTR;
42static struct thread_entry *gen_thread_p; 42static unsigned int gen_thread_id;
43 43
44#define OUTPUT_CHUNK_COUNT (1 << 1) 44#define OUTPUT_CHUNK_COUNT (1 << 1)
45#define OUTPUT_CHUNK_MASK (OUTPUT_CHUNK_COUNT-1) 45#define OUTPUT_CHUNK_MASK (OUTPUT_CHUNK_COUNT-1)
@@ -233,11 +233,11 @@ static void play_tone(bool volume_set)
233 output_clear(); 233 output_clear();
234 update_gen_step(); 234 update_gen_step();
235 235
236 gen_thread_p = rb->create_thread(gen_thread_func, gen_thread_stack, 236 gen_thread_id = rb->create_thread(gen_thread_func, gen_thread_stack,
237 sizeof(gen_thread_stack), 0, 237 sizeof(gen_thread_stack), 0,
238 "test_sampr generator" 238 "test_sampr generator"
239 IF_PRIO(, PRIORITY_PLAYBACK) 239 IF_PRIO(, PRIORITY_PLAYBACK)
240 IF_COP(, CPU)); 240 IF_COP(, CPU));
241 241
242 rb->pcm_play_data(get_more, NULL, 0); 242 rb->pcm_play_data(get_more, NULL, 0);
243 243
@@ -260,7 +260,7 @@ static void play_tone(bool volume_set)
260 260
261 gen_quit = true; 261 gen_quit = true;
262 262
263 rb->thread_wait(gen_thread_p); 263 rb->thread_wait(gen_thread_id);
264 264
265 rb->pcm_play_stop(); 265 rb->pcm_play_stop();
266 266
diff --git a/apps/recorder/pcm_record.c b/apps/recorder/pcm_record.c
index dbbc6901ec..9ceb68c796 100644
--- a/apps/recorder/pcm_record.c
+++ b/apps/recorder/pcm_record.c
@@ -37,7 +37,7 @@
37 37
38/***************************************************************************/ 38/***************************************************************************/
39 39
40extern struct thread_entry *codec_thread_p; 40extern uintptr_t codec_thread_id;
41 41
42/** General recording state **/ 42/** General recording state **/
43static bool is_recording; /* We are recording */ 43static bool is_recording; /* We are recording */
@@ -220,7 +220,7 @@ static struct event_queue pcmrec_queue SHAREDBSS_ATTR;
220static struct queue_sender_list pcmrec_queue_send SHAREDBSS_ATTR; 220static struct queue_sender_list pcmrec_queue_send SHAREDBSS_ATTR;
221static long pcmrec_stack[3*DEFAULT_STACK_SIZE/sizeof(long)]; 221static long pcmrec_stack[3*DEFAULT_STACK_SIZE/sizeof(long)];
222static const char pcmrec_thread_name[] = "pcmrec"; 222static const char pcmrec_thread_name[] = "pcmrec";
223static struct thread_entry *pcmrec_thread_p; 223static unsigned int pcmrec_thread_id = 0;
224 224
225static void pcmrec_thread(void); 225static void pcmrec_thread(void);
226 226
@@ -365,12 +365,12 @@ unsigned long pcm_rec_sample_rate(void)
365void pcm_rec_init(void) 365void pcm_rec_init(void)
366{ 366{
367 queue_init(&pcmrec_queue, true); 367 queue_init(&pcmrec_queue, true);
368 pcmrec_thread_p = 368 pcmrec_thread_id =
369 create_thread(pcmrec_thread, pcmrec_stack, sizeof(pcmrec_stack), 369 create_thread(pcmrec_thread, pcmrec_stack, sizeof(pcmrec_stack),
370 0, pcmrec_thread_name IF_PRIO(, PRIORITY_RECORDING) 370 0, pcmrec_thread_name IF_PRIO(, PRIORITY_RECORDING)
371 IF_COP(, CPU)); 371 IF_COP(, CPU));
372 queue_enable_queue_send(&pcmrec_queue, &pcmrec_queue_send, 372 queue_enable_queue_send(&pcmrec_queue, &pcmrec_queue_send,
373 pcmrec_thread_p); 373 pcmrec_thread_id);
374} /* pcm_rec_init */ 374} /* pcm_rec_init */
375 375
376/** audio_* group **/ 376/** audio_* group **/
@@ -878,10 +878,10 @@ static void pcmrec_flush(unsigned flush_num)
878 priority until finished */ 878 priority until finished */
879 logf("pcmrec: boost (%s)", 879 logf("pcmrec: boost (%s)",
880 num >= flood_watermark ? "num" : "time"); 880 num >= flood_watermark ? "num" : "time");
881 prio_pcmrec = thread_set_priority(NULL, 881 prio_pcmrec = thread_set_priority(THREAD_ID_CURRENT,
882 thread_get_priority(NULL) - 4); 882 thread_get_priority(THREAD_ID_CURRENT) - 4);
883 prio_codec = thread_set_priority(codec_thread_p, 883 prio_codec = thread_set_priority(codec_thread_id,
884 thread_get_priority(codec_thread_p) - 4); 884 thread_get_priority(codec_thread_id) - 4);
885 } 885 }
886#endif 886#endif
887 887
@@ -931,8 +931,8 @@ static void pcmrec_flush(unsigned flush_num)
931 { 931 {
932 /* return to original priorities */ 932 /* return to original priorities */
933 logf("pcmrec: unboost priority"); 933 logf("pcmrec: unboost priority");
934 thread_set_priority(NULL, prio_pcmrec); 934 thread_set_priority(THREAD_ID_CURRENT, prio_pcmrec);
935 thread_set_priority(codec_thread_p, prio_codec); 935 thread_set_priority(codec_thread_id, prio_codec);
936 } 936 }
937 937
938 last_flush_tick = current_tick; /* save tick when we left */ 938 last_flush_tick = current_tick; /* save tick when we left */
diff --git a/apps/voice_thread.c b/apps/voice_thread.c
index 084c3872c6..86e80cece3 100644
--- a/apps/voice_thread.c
+++ b/apps/voice_thread.c
@@ -54,7 +54,7 @@
54#define VOICE_SAMPLE_DEPTH 16 /* Sample depth in bits */ 54#define VOICE_SAMPLE_DEPTH 16 /* Sample depth in bits */
55 55
56/* Voice thread variables */ 56/* Voice thread variables */
57static struct thread_entry *voice_thread_p = NULL; 57static unsigned int voice_thread_id = 0;
58static long voice_stack[0x7c0/sizeof(long)] IBSS_ATTR_VOICE_STACK; 58static long voice_stack[0x7c0/sizeof(long)] IBSS_ATTR_VOICE_STACK;
59static const char voice_thread_name[] = "voice"; 59static const char voice_thread_name[] = "voice";
60 60
@@ -434,25 +434,25 @@ void voice_thread_init(void)
434 queue_init(&voice_queue, false); 434 queue_init(&voice_queue, false);
435 mutex_init(&voice_mutex); 435 mutex_init(&voice_mutex);
436 436
437 voice_thread_p = create_thread(voice_thread, voice_stack, 437 voice_thread_id = create_thread(voice_thread, voice_stack,
438 sizeof(voice_stack), CREATE_THREAD_FROZEN, 438 sizeof(voice_stack), CREATE_THREAD_FROZEN,
439 voice_thread_name IF_PRIO(, PRIORITY_PLAYBACK) IF_COP(, CPU)); 439 voice_thread_name IF_PRIO(, PRIORITY_PLAYBACK) IF_COP(, CPU));
440 440
441 queue_enable_queue_send(&voice_queue, &voice_queue_sender_list, 441 queue_enable_queue_send(&voice_queue, &voice_queue_sender_list,
442 voice_thread_p); 442 voice_thread_id);
443} /* voice_thread_init */ 443} /* voice_thread_init */
444 444
445/* Unfreeze the voice thread */ 445/* Unfreeze the voice thread */
446void voice_thread_resume(void) 446void voice_thread_resume(void)
447{ 447{
448 logf("Thawing voice thread"); 448 logf("Thawing voice thread");
449 thread_thaw(voice_thread_p); 449 thread_thaw(voice_thread_id);
450} 450}
451 451
452#ifdef HAVE_PRIORITY_SCHEDULING 452#ifdef HAVE_PRIORITY_SCHEDULING
453/* Set the voice thread priority */ 453/* Set the voice thread priority */
454void voice_thread_set_priority(int priority) 454void voice_thread_set_priority(int priority)
455{ 455{
456 thread_set_priority(voice_thread_p, priority); 456 thread_set_priority(voice_thread_id, priority);
457} 457}
458#endif 458#endif