summaryrefslogtreecommitdiff
path: root/firmware/target/arm/s3c2440
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2011-03-02 08:49:38 +0000
committerMichael Sevakis <jethead71@rockbox.org>2011-03-02 08:49:38 +0000
commit12375d1d3aa41f7d277a9af584c7b810b636ec95 (patch)
treefc9ce8029a6910a8dac71b3bf60c71155a01eea4 /firmware/target/arm/s3c2440
parent05e180a1308a095d51d51d0e047fcd44425ea88f (diff)
downloadrockbox-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/s3c2440')
-rw-r--r--firmware/target/arm/s3c2440/i2c-s3c2440.c8
-rw-r--r--firmware/target/arm/s3c2440/sd-s3c2440.c10
2 files changed, 9 insertions, 9 deletions
diff --git a/firmware/target/arm/s3c2440/i2c-s3c2440.c b/firmware/target/arm/s3c2440/i2c-s3c2440.c
index 155eb2f956..33c4e3180a 100644
--- a/firmware/target/arm/s3c2440/i2c-s3c2440.c
+++ b/firmware/target/arm/s3c2440/i2c-s3c2440.c
@@ -21,7 +21,7 @@
21#include "system.h" 21#include "system.h"
22#include "i2c-s3c2440.h" 22#include "i2c-s3c2440.h"
23 23
24static struct wakeup i2c_wake; /* Transfer completion signal */ 24static struct semaphore i2c_complete; /* Transfer completion signal */
25static struct mutex i2c_mtx; /* Mutual exclusion */ 25static struct mutex i2c_mtx; /* Mutual exclusion */
26static unsigned char *buf_ptr; /* Next byte to transfer */ 26static unsigned char *buf_ptr; /* Next byte to transfer */
27static int buf_count; /* Number of bytes remaining to transfer */ 27static int buf_count; /* Number of bytes remaining to transfer */
@@ -64,7 +64,7 @@ void i2c_write(int addr, const unsigned char *buf, int count)
64 /* Generate START */ 64 /* Generate START */
65 IICSTAT = I2C_MODE_MASTER | I2C_MODE_TX | I2C_START | I2C_RXTX_ENB; 65 IICSTAT = I2C_MODE_MASTER | I2C_MODE_TX | I2C_START | I2C_RXTX_ENB;
66 66
67 if (wakeup_wait(&i2c_wake, HZ) != OBJ_WAIT_SUCCEEDED) 67 if (semaphore_wait(&i2c_complete, HZ) != OBJ_WAIT_SUCCEEDED)
68 { 68 {
69 /* Something went wrong - stop transmission */ 69 /* Something went wrong - stop transmission */
70 int oldlevel = disable_irq_save(); 70 int oldlevel = disable_irq_save();
@@ -84,7 +84,7 @@ void i2c_write(int addr, const unsigned char *buf, int count)
84void i2c_init(void) 84void i2c_init(void)
85{ 85{
86 /* Init kernel objects */ 86 /* Init kernel objects */
87 wakeup_init(&i2c_wake); 87 semaphore_init(&i2c_complete, 1, 0);
88 mutex_init(&i2c_mtx); 88 mutex_init(&i2c_mtx);
89 89
90 /* Clear pending source */ 90 /* Clear pending source */
@@ -134,7 +134,7 @@ void IIC(void)
134 i2c_stop(); 134 i2c_stop();
135 135
136 /* Signal thread */ 136 /* Signal thread */
137 wakeup_signal(&i2c_wake); 137 semaphore_release(&i2c_complete);
138 break; 138 break;
139 } 139 }
140 140
diff --git a/firmware/target/arm/s3c2440/sd-s3c2440.c b/firmware/target/arm/s3c2440/sd-s3c2440.c
index 4a15835b67..0dcd900d11 100644
--- a/firmware/target/arm/s3c2440/sd-s3c2440.c
+++ b/firmware/target/arm/s3c2440/sd-s3c2440.c
@@ -119,7 +119,7 @@ static long sd_stack [(DEFAULT_STACK_SIZE*2 + 0x1c0)/sizeof(long)];
119static const char sd_thread_name[] = "sd"; 119static const char sd_thread_name[] = "sd";
120static struct mutex sd_mtx SHAREDBSS_ATTR; 120static struct mutex sd_mtx SHAREDBSS_ATTR;
121static struct event_queue sd_queue; 121static struct event_queue sd_queue;
122static struct wakeup transfer_completion_signal; 122static struct semaphore transfer_completion_signal;
123static volatile unsigned int transfer_error[NUM_VOLUMES]; 123static volatile unsigned int transfer_error[NUM_VOLUMES];
124/* align on cache line size */ 124/* align on cache line size */
125static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS * SD_BLOCK_SIZE] 125static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS * SD_BLOCK_SIZE]
@@ -223,7 +223,7 @@ void SDI (void)
223 223
224 dbgprintf ("SDI %x\n", transfer_error[curr_card]); 224 dbgprintf ("SDI %x\n", transfer_error[curr_card]);
225 225
226 wakeup_signal(&transfer_completion_signal); 226 semaphore_release(&transfer_completion_signal);
227 227
228 /* Ack the interrupt */ 228 /* Ack the interrupt */
229 SRCPND = SDI_MASK; 229 SRCPND = SDI_MASK;
@@ -242,7 +242,7 @@ void dma_callback (void)
242 SDIDSTA |= S3C2410_SDIDSTA_CLEAR_BITS; /* needed to clear int */ 242 SDIDSTA |= S3C2410_SDIDSTA_CLEAR_BITS; /* needed to clear int */
243 243
244 dbgprintf ("dma_cb\n"); 244 dbgprintf ("dma_cb\n");
245 wakeup_signal(&transfer_completion_signal); 245 semaphore_release(&transfer_completion_signal);
246} 246}
247#endif 247#endif
248 248
@@ -783,7 +783,7 @@ static int sd_transfer_sectors(int card_no, unsigned long start,
783 (9<<4) /* 2^9 = 512 */ ; 783 (9<<4) /* 2^9 = 512 */ ;
784#endif 784#endif
785 785
786 wakeup_wait(&transfer_completion_signal, 100 /*TIMEOUT_BLOCK*/); 786 semaphore_wait(&transfer_completion_signal, 100 /*TIMEOUT_BLOCK*/);
787 787
788 /* wait for DMA to finish */ 788 /* wait for DMA to finish */
789 while (DSTAT0 & DSTAT_STAT_BUSY) 789 while (DSTAT0 & DSTAT_STAT_BUSY)
@@ -928,7 +928,7 @@ int sd_init(void)
928 sd_enabled = true; 928 sd_enabled = true;
929 sd_enable(false); 929 sd_enable(false);
930#endif 930#endif
931 wakeup_init(&transfer_completion_signal); 931 semaphore_init(&transfer_completion_signal, 1, 0);
932 /* init mutex */ 932 /* init mutex */
933 mutex_init(&sd_mtx); 933 mutex_init(&sd_mtx);
934 queue_init(&sd_queue, true); 934 queue_init(&sd_queue, true);