diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2011-03-02 08:49:38 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2011-03-02 08:49:38 +0000 |
commit | 12375d1d3aa41f7d277a9af584c7b810b636ec95 (patch) | |
tree | fc9ce8029a6910a8dac71b3bf60c71155a01eea4 /firmware/target/arm/imx31/gigabeat-s/headphone-gigabeat-s.c | |
parent | 05e180a1308a095d51d51d0e047fcd44425ea88f (diff) | |
download | rockbox-12375d1d3aa41f7d277a9af584c7b810b636ec95.tar.gz rockbox-12375d1d3aa41f7d277a9af584c7b810b636ec95.zip |
Merge functionality of wakeups and semaphores-- fewer APIs and object types. semaphore_wait takes a timeout now so codecs and plugins have to be made incompatible. Don't make semaphores for targets not using them.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29492 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/imx31/gigabeat-s/headphone-gigabeat-s.c')
-rw-r--r-- | firmware/target/arm/imx31/gigabeat-s/headphone-gigabeat-s.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/headphone-gigabeat-s.c b/firmware/target/arm/imx31/gigabeat-s/headphone-gigabeat-s.c index 0f8cb67a9d..6e76615308 100644 --- a/firmware/target/arm/imx31/gigabeat-s/headphone-gigabeat-s.c +++ b/firmware/target/arm/imx31/gigabeat-s/headphone-gigabeat-s.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include "adc.h" | 29 | #include "adc.h" |
30 | #include "button.h" | 30 | #include "button.h" |
31 | 31 | ||
32 | static struct wakeup headphone_wakeup; | 32 | static struct semaphore headphone_wakeup; |
33 | static unsigned int headphone_thread_id; | 33 | static unsigned int headphone_thread_id; |
34 | static int headphone_stack[200/sizeof(int)]; /* Not much stack needed */ | 34 | static int headphone_stack[200/sizeof(int)]; /* Not much stack needed */ |
35 | static const char * const headphone_thread_name = "headphone"; | 35 | static const char * const headphone_thread_name = "headphone"; |
@@ -115,7 +115,7 @@ static void headphone_thread(void) | |||
115 | 115 | ||
116 | while (1) | 116 | while (1) |
117 | { | 117 | { |
118 | int rc = wakeup_wait(&headphone_wakeup, headphone_wait_timeout); | 118 | int rc = semaphore_wait(&headphone_wakeup, headphone_wait_timeout); |
119 | unsigned int data = adc_read(ADC_HPREMOTE); | 119 | unsigned int data = adc_read(ADC_HPREMOTE); |
120 | 120 | ||
121 | if (rc == OBJ_WAIT_TIMEDOUT) | 121 | if (rc == OBJ_WAIT_TIMEDOUT) |
@@ -175,7 +175,7 @@ static void headphone_thread(void) | |||
175 | void headphone_detect_event(void) | 175 | void headphone_detect_event(void) |
176 | { | 176 | { |
177 | /* Trigger the thread immediately. */ | 177 | /* Trigger the thread immediately. */ |
178 | wakeup_signal(&headphone_wakeup); | 178 | semaphore_release(&headphone_wakeup); |
179 | } | 179 | } |
180 | 180 | ||
181 | /* Tell if anything is in the jack. */ | 181 | /* Tell if anything is in the jack. */ |
@@ -187,7 +187,7 @@ bool headphones_inserted(void) | |||
187 | void INIT_ATTR headphone_init(void) | 187 | void INIT_ATTR headphone_init(void) |
188 | { | 188 | { |
189 | /* A thread is required to monitor the remote ADC and jack state. */ | 189 | /* A thread is required to monitor the remote ADC and jack state. */ |
190 | wakeup_init(&headphone_wakeup); | 190 | semaphore_init(&headphone_wakeup, 1, 0); |
191 | headphone_thread_id = create_thread(headphone_thread, | 191 | headphone_thread_id = create_thread(headphone_thread, |
192 | headphone_stack, | 192 | headphone_stack, |
193 | sizeof(headphone_stack), | 193 | sizeof(headphone_stack), |