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/ata-imx31.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/ata-imx31.c')
-rw-r--r-- | firmware/target/arm/imx31/ata-imx31.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/firmware/target/arm/imx31/ata-imx31.c b/firmware/target/arm/imx31/ata-imx31.c index d539282e70..8a40c924ff 100644 --- a/firmware/target/arm/imx31/ata-imx31.c +++ b/firmware/target/arm/imx31/ata-imx31.c | |||
@@ -246,7 +246,7 @@ static const struct ata_udma_timings | |||
246 | 246 | ||
247 | /** Threading **/ | 247 | /** Threading **/ |
248 | /* Signal to tell thread when DMA is done */ | 248 | /* Signal to tell thread when DMA is done */ |
249 | static struct wakeup ata_dma_wakeup; | 249 | static struct semaphore ata_dma_complete; |
250 | 250 | ||
251 | /** SDMA **/ | 251 | /** SDMA **/ |
252 | /* Array of buffer descriptors for large transfers and alignnment */ | 252 | /* Array of buffer descriptors for large transfers and alignnment */ |
@@ -445,7 +445,7 @@ static void ata_dma_callback(void) | |||
445 | ATA_INTERRUPT_CLEAR = ATA_INTERRUPT_PENDING; | 445 | ATA_INTERRUPT_CLEAR = ATA_INTERRUPT_PENDING; |
446 | 446 | ||
447 | ata_set_intrq(false); /* Return INTRQ to MCU */ | 447 | ata_set_intrq(false); /* Return INTRQ to MCU */ |
448 | wakeup_signal(&ata_dma_wakeup); /* Signal waiting thread */ | 448 | semaphore_release(&ata_dma_complete); /* Signal waiting thread */ |
449 | } | 449 | } |
450 | 450 | ||
451 | bool ata_dma_setup(void *addr, unsigned long bytes, bool write) | 451 | bool ata_dma_setup(void *addr, unsigned long bytes, bool write) |
@@ -580,7 +580,8 @@ bool ata_dma_finish(void) | |||
580 | { | 580 | { |
581 | int oldirq; | 581 | int oldirq; |
582 | 582 | ||
583 | if (LIKELY(wakeup_wait(&ata_dma_wakeup, HZ/2) == OBJ_WAIT_SUCCEEDED)) | 583 | if (LIKELY(semaphore_wait(&ata_dma_complete, HZ/2) |
584 | == OBJ_WAIT_SUCCEEDED)) | ||
584 | break; | 585 | break; |
585 | 586 | ||
586 | ata_keep_active(); | 587 | ata_keep_active(); |
@@ -594,7 +595,8 @@ bool ata_dma_finish(void) | |||
594 | sdma_channel_stop(channel); /* Stop DMA */ | 595 | sdma_channel_stop(channel); /* Stop DMA */ |
595 | restore_irq(oldirq); | 596 | restore_irq(oldirq); |
596 | 597 | ||
597 | if (wakeup_wait(&ata_dma_wakeup, TIMEOUT_NOBLOCK) == OBJ_WAIT_SUCCEEDED) | 598 | if (semaphore_wait(&ata_dma_complete, TIMEOUT_NOBLOCK) |
599 | == OBJ_WAIT_SUCCEEDED) | ||
598 | break; /* DMA really did finish after timeout */ | 600 | break; /* DMA really did finish after timeout */ |
599 | 601 | ||
600 | sdma_channel_reset(channel); /* Reset everything + clear error */ | 602 | sdma_channel_reset(channel); /* Reset everything + clear error */ |
@@ -716,7 +718,7 @@ void ata_device_init(void) | |||
716 | ata_dma_selected = ATA_DMA_PIO; | 718 | ata_dma_selected = ATA_DMA_PIO; |
717 | 719 | ||
718 | /* Called for first time at startup */ | 720 | /* Called for first time at startup */ |
719 | wakeup_init(&ata_dma_wakeup); | 721 | semaphore_init(&ata_dma_complete, 1, 0); |
720 | 722 | ||
721 | if (!sdma_channel_init(ATA_DMA_CH_NUM_RD, &ata_cd_rd, ata_bda) || | 723 | if (!sdma_channel_init(ATA_DMA_CH_NUM_RD, &ata_cd_rd, ata_bda) || |
722 | !sdma_channel_init(ATA_DMA_CH_NUM_WR, &ata_cd_wr, ata_bda)) | 724 | !sdma_channel_init(ATA_DMA_CH_NUM_WR, &ata_cd_wr, ata_bda)) |