diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2008-10-23 13:13:00 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2008-10-23 13:13:00 +0000 |
commit | effceea22915a087c1c85ff30d2e62110413edaf (patch) | |
tree | 6f1340835c950d44fc521bb17ca022e151059762 /apps | |
parent | 188e898e3c40bafa472fa038167764ebcccf713d (diff) | |
download | rockbox-effceea22915a087c1c85ff30d2e62110413edaf.tar.gz rockbox-effceea22915a087c1c85ff30d2e62110413edaf.zip |
Remove the event object in the kernel since it's rather extraneous at the moment. This makes the codecs and the plugins incompatible, so update fully.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18867 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/codecs.c | 3 | ||||
-rw-r--r-- | apps/codecs.h | 7 | ||||
-rw-r--r-- | apps/codecs/spc.c | 9 | ||||
-rw-r--r-- | apps/plugin.c | 6 | ||||
-rw-r--r-- | apps/plugin.h | 9 | ||||
-rw-r--r-- | apps/plugins/test_codec.c | 3 | ||||
-rw-r--r-- | apps/voice_thread.c | 12 |
7 files changed, 15 insertions, 34 deletions
diff --git a/apps/codecs.c b/apps/codecs.c index 8e9e55a5d4..53fa6755a8 100644 --- a/apps/codecs.c +++ b/apps/codecs.c | |||
@@ -105,9 +105,6 @@ struct codec_api ci = { | |||
105 | semaphore_init, | 105 | semaphore_init, |
106 | semaphore_wait, | 106 | semaphore_wait, |
107 | semaphore_release, | 107 | semaphore_release, |
108 | event_init, | ||
109 | event_wait, | ||
110 | event_set_state, | ||
111 | #endif | 108 | #endif |
112 | 109 | ||
113 | #ifdef CACHE_FUNCTIONS_AS_CALL | 110 | #ifdef CACHE_FUNCTIONS_AS_CALL |
diff --git a/apps/codecs.h b/apps/codecs.h index 6d8c1016a8..4194524e6d 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 26 | 85 | #define CODEC_API_VERSION 27 |
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 26 | 90 | #define CODEC_MIN_API_VERSION 27 |
91 | 91 | ||
92 | /* codec return codes */ | 92 | /* codec return codes */ |
93 | enum codec_status { | 93 | enum codec_status { |
@@ -175,9 +175,6 @@ struct codec_api { | |||
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); |
178 | void (*event_init)(struct event *e, unsigned int flags); | ||
179 | void (*event_wait)(struct event *e, unsigned int for_state); | ||
180 | void (*event_set_state)(struct event *e, unsigned int state); | ||
181 | #endif /* NUM_CORES */ | 178 | #endif /* NUM_CORES */ |
182 | 179 | ||
183 | #ifdef CACHE_FUNCTIONS_AS_CALL | 180 | #ifdef CACHE_FUNCTIONS_AS_CALL |
diff --git a/apps/codecs/spc.c b/apps/codecs/spc.c index da91eb0391..a2b6fabf99 100644 --- a/apps/codecs/spc.c +++ b/apps/codecs/spc.c | |||
@@ -230,7 +230,7 @@ static struct | |||
230 | int head, tail; | 230 | int head, tail; |
231 | struct semaphore emu_sem_head; | 231 | struct semaphore emu_sem_head; |
232 | struct semaphore emu_sem_tail; | 232 | struct semaphore emu_sem_tail; |
233 | struct event emu_evt_reply; | 233 | struct semaphore emu_evt_reply; |
234 | intptr_t retval; | 234 | intptr_t retval; |
235 | struct sample_queue_chunk wav_chunk[WAV_NUM_CHUNKS]; | 235 | struct sample_queue_chunk wav_chunk[WAV_NUM_CHUNKS]; |
236 | } sample_queue SHAREDBSS_ATTR; | 236 | } sample_queue SHAREDBSS_ATTR; |
@@ -284,7 +284,7 @@ static intptr_t emu_thread_send_msg(long id, intptr_t data) | |||
284 | 284 | ||
285 | if (id != SPC_EMU_QUIT) { | 285 | if (id != SPC_EMU_QUIT) { |
286 | /* Wait for a response */ | 286 | /* Wait for a response */ |
287 | ci->event_wait(&sample_queue.emu_evt_reply, STATE_SIGNALED); | 287 | ci->semaphore_wait(&sample_queue.emu_evt_reply); |
288 | } | 288 | } |
289 | 289 | ||
290 | return sample_queue.retval; | 290 | return sample_queue.retval; |
@@ -316,7 +316,7 @@ static bool emu_thread_process_msg(struct sample_queue_chunk *chunk) | |||
316 | } | 316 | } |
317 | 317 | ||
318 | if (id != SPC_EMU_QUIT) { | 318 | if (id != SPC_EMU_QUIT) { |
319 | ci->event_set_state(&sample_queue.emu_evt_reply, STATE_SIGNALED); | 319 | ci->semaphore_release(&sample_queue.emu_evt_reply); |
320 | } | 320 | } |
321 | 321 | ||
322 | return ret; | 322 | return ret; |
@@ -361,8 +361,7 @@ static bool spc_emu_start(void) | |||
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 |
363 | emulator before loading something */ | 363 | emulator before loading something */ |
364 | ci->event_init(&sample_queue.emu_evt_reply, | 364 | ci->semaphore_init(&sample_queue.emu_evt_reply, 1, 0); |
365 | EVENT_AUTOMATIC | STATE_NONSIGNALED); | ||
366 | ci->semaphore_init(&sample_queue.emu_sem_tail, 2, 0); | 365 | ci->semaphore_init(&sample_queue.emu_sem_tail, 2, 0); |
367 | ci->semaphore_init(&sample_queue.emu_sem_head, 2, 2); | 366 | ci->semaphore_init(&sample_queue.emu_sem_head, 2, 2); |
368 | sample_queue.head = 0; | 367 | sample_queue.head = 0; |
diff --git a/apps/plugin.c b/apps/plugin.c index 4ba1396085..a9c9a6c3f8 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -614,11 +614,7 @@ static const struct plugin_api rockbox_api = { | |||
614 | semaphore_wait, | 614 | semaphore_wait, |
615 | semaphore_release, | 615 | semaphore_release, |
616 | #endif | 616 | #endif |
617 | #ifdef HAVE_EVENT_OBJECTS | 617 | |
618 | event_init, | ||
619 | event_wait, | ||
620 | event_set_state, | ||
621 | #endif | ||
622 | appsversion, | 618 | appsversion, |
623 | /* new stuff at the end, sort into place next time | 619 | /* new stuff at the end, sort into place next time |
624 | the API gets incompatible */ | 620 | the API gets incompatible */ |
diff --git a/apps/plugin.h b/apps/plugin.h index 1029431cd1..9544b3851c 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -130,12 +130,12 @@ void* plugin_get_buffer(size_t *buffer_size); | |||
130 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 130 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
131 | 131 | ||
132 | /* increase this every time the api struct changes */ | 132 | /* increase this every time the api struct changes */ |
133 | #define PLUGIN_API_VERSION 124 | 133 | #define PLUGIN_API_VERSION 125 |
134 | 134 | ||
135 | /* update this to latest version if a change to the api struct breaks | 135 | /* update this to latest version if a change to the api struct breaks |
136 | backwards compatibility (and please take the opportunity to sort in any | 136 | backwards compatibility (and please take the opportunity to sort in any |
137 | new function which are "waiting" at the end of the function table) */ | 137 | new function which are "waiting" at the end of the function table) */ |
138 | #define PLUGIN_MIN_API_VERSION 123 | 138 | #define PLUGIN_MIN_API_VERSION 125 |
139 | 139 | ||
140 | /* plugin return codes */ | 140 | /* plugin return codes */ |
141 | enum plugin_status { | 141 | enum plugin_status { |
@@ -770,11 +770,6 @@ struct plugin_api { | |||
770 | void (*semaphore_wait)(struct semaphore *s); | 770 | void (*semaphore_wait)(struct semaphore *s); |
771 | void (*semaphore_release)(struct semaphore *s); | 771 | void (*semaphore_release)(struct semaphore *s); |
772 | #endif | 772 | #endif |
773 | #ifdef HAVE_EVENT_OBJECTS | ||
774 | void (*event_init)(struct event *e, unsigned int flags); | ||
775 | void (*event_wait)(struct event *e, unsigned int for_state); | ||
776 | void (*event_set_state)(struct event *e, unsigned int state); | ||
777 | #endif | ||
778 | 773 | ||
779 | const char *appsversion; | 774 | const char *appsversion; |
780 | /* new stuff at the end, sort into place next time | 775 | /* new stuff at the end, sort into place next time |
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index 448b512c83..3c54610a94 100644 --- a/apps/plugins/test_codec.c +++ b/apps/plugins/test_codec.c | |||
@@ -493,9 +493,6 @@ static void init_ci(void) | |||
493 | ci.semaphore_init = rb->semaphore_init; | 493 | ci.semaphore_init = rb->semaphore_init; |
494 | ci.semaphore_wait = rb->semaphore_wait; | 494 | ci.semaphore_wait = rb->semaphore_wait; |
495 | ci.semaphore_release = rb->semaphore_release; | 495 | ci.semaphore_release = rb->semaphore_release; |
496 | ci.event_init = rb->event_init; | ||
497 | ci.event_wait = rb->event_wait; | ||
498 | ci.event_set_state = rb->event_set_state; | ||
499 | #endif | 496 | #endif |
500 | 497 | ||
501 | } | 498 | } |
diff --git a/apps/voice_thread.c b/apps/voice_thread.c index aeffa5bd7c..084c3872c6 100644 --- a/apps/voice_thread.c +++ b/apps/voice_thread.c | |||
@@ -61,8 +61,8 @@ static const char voice_thread_name[] = "voice"; | |||
61 | /* Voice thread synchronization objects */ | 61 | /* Voice thread synchronization objects */ |
62 | static struct event_queue voice_queue SHAREDBSS_ATTR; | 62 | static struct event_queue voice_queue SHAREDBSS_ATTR; |
63 | static struct mutex voice_mutex SHAREDBSS_ATTR; | 63 | static struct mutex voice_mutex SHAREDBSS_ATTR; |
64 | static struct event voice_event SHAREDBSS_ATTR; | ||
65 | static struct queue_sender_list voice_queue_sender_list SHAREDBSS_ATTR; | 64 | static struct queue_sender_list voice_queue_sender_list SHAREDBSS_ATTR; |
65 | static bool voice_done SHAREDDATA_ATTR = true; | ||
66 | 66 | ||
67 | /* Buffer for decoded samples */ | 67 | /* Buffer for decoded samples */ |
68 | static spx_int16_t voice_output_buf[VOICE_FRAME_SIZE] CACHEALIGN_ATTR; | 68 | static spx_int16_t voice_output_buf[VOICE_FRAME_SIZE] CACHEALIGN_ATTR; |
@@ -189,9 +189,9 @@ void voice_wait(void) | |||
189 | /* NOTE: One problem here is that we can't tell if another thread started a | 189 | /* NOTE: One problem here is that we can't tell if another thread started a |
190 | * new clip by the time we wait. This should be resolvable if conditions | 190 | * new clip by the time we wait. This should be resolvable if conditions |
191 | * ever require knowing the very clip you requested has finished. */ | 191 | * ever require knowing the very clip you requested has finished. */ |
192 | event_wait(&voice_event, STATE_SIGNALED); | 192 | |
193 | /* Wait for PCM buffer to be exhausted. Works only if not playing. */ | 193 | /* Wait for PCM buffer to be exhausted. Works only if not playing. */ |
194 | while(!playback_is_playing() && pcm_is_playing()) | 194 | while(!voice_done || (!playback_is_playing() && pcm_is_playing())) |
195 | sleep(1); | 195 | sleep(1); |
196 | } | 196 | } |
197 | 197 | ||
@@ -219,7 +219,7 @@ static void voice_message(struct voice_thread_data *td) | |||
219 | case Q_VOICE_PLAY: | 219 | case Q_VOICE_PLAY: |
220 | LOGFQUEUE("voice < Q_VOICE_PLAY"); | 220 | LOGFQUEUE("voice < Q_VOICE_PLAY"); |
221 | /* Put up a block for completion signal */ | 221 | /* Put up a block for completion signal */ |
222 | event_set_state(&voice_event, STATE_NONSIGNALED); | 222 | voice_done = false; |
223 | 223 | ||
224 | /* Copy the clip info */ | 224 | /* Copy the clip info */ |
225 | td->vi = *(struct voice_info *)td->ev.data; | 225 | td->vi = *(struct voice_info *)td->ev.data; |
@@ -264,7 +264,7 @@ static void voice_message(struct voice_thread_data *td) | |||
264 | cancel_cpu_boost(); | 264 | cancel_cpu_boost(); |
265 | 265 | ||
266 | td->state = TSTATE_STOPPED; | 266 | td->state = TSTATE_STOPPED; |
267 | event_set_state(&voice_event, STATE_SIGNALED); | 267 | voice_done = true; |
268 | break; | 268 | break; |
269 | 269 | ||
270 | case Q_VOICE_STATE: | 270 | case Q_VOICE_STATE: |
@@ -433,7 +433,7 @@ void voice_thread_init(void) | |||
433 | logf("Starting voice thread"); | 433 | logf("Starting voice thread"); |
434 | queue_init(&voice_queue, false); | 434 | queue_init(&voice_queue, false); |
435 | mutex_init(&voice_mutex); | 435 | mutex_init(&voice_mutex); |
436 | event_init(&voice_event, STATE_SIGNALED | EVENT_MANUAL); | 436 | |
437 | voice_thread_p = create_thread(voice_thread, voice_stack, | 437 | voice_thread_p = 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)); |