summaryrefslogtreecommitdiffstats
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.tar.bz2
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 @@
#include "system.h"
#include "i2c-s3c2440.h"
-static struct wakeup i2c_wake; /* Transfer completion signal */
+static struct semaphore i2c_complete; /* Transfer completion signal */
static struct mutex i2c_mtx; /* Mutual exclusion */
static unsigned char *buf_ptr; /* Next byte to transfer */
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)
/* Generate START */
IICSTAT = I2C_MODE_MASTER | I2C_MODE_TX | I2C_START | I2C_RXTX_ENB;
- if (wakeup_wait(&i2c_wake, HZ) != OBJ_WAIT_SUCCEEDED)
+ if (semaphore_wait(&i2c_complete, HZ) != OBJ_WAIT_SUCCEEDED)
{
/* Something went wrong - stop transmission */
int oldlevel = disable_irq_save();
@@ -84,7 +84,7 @@ void i2c_write(int addr, const unsigned char *buf, int count)
void i2c_init(void)
{
/* Init kernel objects */
- wakeup_init(&i2c_wake);
+ semaphore_init(&i2c_complete, 1, 0);
mutex_init(&i2c_mtx);
/* Clear pending source */
@@ -134,7 +134,7 @@ void IIC(void)
i2c_stop();
/* Signal thread */
- wakeup_signal(&i2c_wake);
+ semaphore_release(&i2c_complete);
break;
}
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)];
static const char sd_thread_name[] = "sd";
static struct mutex sd_mtx SHAREDBSS_ATTR;
static struct event_queue sd_queue;
-static struct wakeup transfer_completion_signal;
+static struct semaphore transfer_completion_signal;
static volatile unsigned int transfer_error[NUM_VOLUMES];
/* align on cache line size */
static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS * SD_BLOCK_SIZE]
@@ -223,7 +223,7 @@ void SDI (void)
dbgprintf ("SDI %x\n", transfer_error[curr_card]);
- wakeup_signal(&transfer_completion_signal);
+ semaphore_release(&transfer_completion_signal);
/* Ack the interrupt */
SRCPND = SDI_MASK;
@@ -242,7 +242,7 @@ void dma_callback (void)
SDIDSTA |= S3C2410_SDIDSTA_CLEAR_BITS; /* needed to clear int */
dbgprintf ("dma_cb\n");
- wakeup_signal(&transfer_completion_signal);
+ semaphore_release(&transfer_completion_signal);
}
#endif
@@ -783,7 +783,7 @@ static int sd_transfer_sectors(int card_no, unsigned long start,
(9<<4) /* 2^9 = 512 */ ;
#endif
- wakeup_wait(&transfer_completion_signal, 100 /*TIMEOUT_BLOCK*/);
+ semaphore_wait(&transfer_completion_signal, 100 /*TIMEOUT_BLOCK*/);
/* wait for DMA to finish */
while (DSTAT0 & DSTAT_STAT_BUSY)
@@ -928,7 +928,7 @@ int sd_init(void)
sd_enabled = true;
sd_enable(false);
#endif
- wakeup_init(&transfer_completion_signal);
+ semaphore_init(&transfer_completion_signal, 1, 0);
/* init mutex */
mutex_init(&sd_mtx);
queue_init(&sd_queue, true);