diff options
Diffstat (limited to 'firmware/target/arm/s3c2440')
-rw-r--r-- | firmware/target/arm/s3c2440/i2c-s3c2440.c | 8 | ||||
-rw-r--r-- | firmware/target/arm/s3c2440/sd-s3c2440.c | 10 |
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 | ||
24 | static struct wakeup i2c_wake; /* Transfer completion signal */ | 24 | static struct semaphore i2c_complete; /* Transfer completion signal */ |
25 | static struct mutex i2c_mtx; /* Mutual exclusion */ | 25 | static struct mutex i2c_mtx; /* Mutual exclusion */ |
26 | static unsigned char *buf_ptr; /* Next byte to transfer */ | 26 | static unsigned char *buf_ptr; /* Next byte to transfer */ |
27 | static int buf_count; /* Number of bytes remaining to transfer */ | 27 | static 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) | |||
84 | void i2c_init(void) | 84 | void 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)]; | |||
119 | static const char sd_thread_name[] = "sd"; | 119 | static const char sd_thread_name[] = "sd"; |
120 | static struct mutex sd_mtx SHAREDBSS_ATTR; | 120 | static struct mutex sd_mtx SHAREDBSS_ATTR; |
121 | static struct event_queue sd_queue; | 121 | static struct event_queue sd_queue; |
122 | static struct wakeup transfer_completion_signal; | 122 | static struct semaphore transfer_completion_signal; |
123 | static volatile unsigned int transfer_error[NUM_VOLUMES]; | 123 | static volatile unsigned int transfer_error[NUM_VOLUMES]; |
124 | /* align on cache line size */ | 124 | /* align on cache line size */ |
125 | static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS * SD_BLOCK_SIZE] | 125 | static 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); |