From 6a8379674c43103c008f841968b84287b8fdaf89 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Fri, 18 Jan 2008 13:12:33 +0000 Subject: Finally, out goes struct spinlock for anything but mutiprocessor targets where it becomes a reenterable corelock. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16105 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/ipod/1g2g/adc-ipod-1g2g.c | 8 ++++---- firmware/target/arm/sandisk/ata-c200_e200.c | 20 ++++++++++---------- firmware/target/arm/tms320dm320/spi-dm320.c | 8 ++++---- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'firmware/target') diff --git a/firmware/target/arm/ipod/1g2g/adc-ipod-1g2g.c b/firmware/target/arm/ipod/1g2g/adc-ipod-1g2g.c index 3a854afcdc..f80412023d 100644 --- a/firmware/target/arm/ipod/1g2g/adc-ipod-1g2g.c +++ b/firmware/target/arm/ipod/1g2g/adc-ipod-1g2g.c @@ -22,7 +22,7 @@ #include "hwcompat.h" #include "kernel.h" -static struct spinlock adc_spin NOCACHEBSS_ATTR; +static struct mutex adc_mtx NOCACHEBSS_ATTR; /* used in the 2nd gen ADC interrupt */ static unsigned int_data; @@ -33,7 +33,7 @@ unsigned short adc_scan(int channel) unsigned short data = 0; (void)channel; /* there is only one */ - spinlock_lock(&adc_spin); + mutex_lock(&adc_mtx); if ((IPOD_HW_REVISION >> 16) == 1) { @@ -69,7 +69,7 @@ unsigned short adc_scan(int channel) data = int_data & 0xff; } - spinlock_unlock(&adc_spin); + mutex_unlock(&adc_mtx); return data; } @@ -100,7 +100,7 @@ void ipod_2g_adc_int(void) void adc_init(void) { - spinlock_init(&adc_spin IF_COP(, SPINLOCK_TASK_SWITCH)); + mutex_init(&adc_mtx); GPIOB_ENABLE |= 0x1e; /* enable B1..B4 */ diff --git a/firmware/target/arm/sandisk/ata-c200_e200.c b/firmware/target/arm/sandisk/ata-c200_e200.c index ef2bad387b..9a5301884f 100644 --- a/firmware/target/arm/sandisk/ata-c200_e200.c +++ b/firmware/target/arm/sandisk/ata-c200_e200.c @@ -162,7 +162,7 @@ static struct sd_card_status sd_status[NUM_VOLUMES] = /* Shoot for around 75% usage */ static long sd_stack [(DEFAULT_STACK_SIZE*2 + 0x1c0)/sizeof(long)]; static const char sd_thread_name[] = "ata/sd"; -static struct spinlock sd_spin NOCACHEBSS_ATTR; +static struct mutex sd_mtx NOCACHEBSS_ATTR; static struct event_queue sd_queue; /* Posted when card plugged status has changed */ @@ -801,7 +801,7 @@ int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int incount, /* TODO: Add DMA support. */ - spinlock_lock(&sd_spin); + mutex_lock(&sd_mtx); ata_led(true); @@ -888,7 +888,7 @@ ata_read_retry: while (1) { ata_led(false); - spinlock_unlock(&sd_spin); + mutex_unlock(&sd_mtx); return ret; @@ -916,7 +916,7 @@ int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const unsigned char *buf, *buf_end; int bank; - spinlock_lock(&sd_spin); + mutex_lock(&sd_mtx); ata_led(true); @@ -1016,7 +1016,7 @@ ata_write_retry: while (1) { ata_led(false); - spinlock_unlock(&sd_spin); + mutex_unlock(&sd_mtx); return ret; @@ -1050,7 +1050,7 @@ static void sd_thread(void) /* Lock to keep us from messing with this variable while an init may be in progress */ - spinlock_lock(&sd_spin); + mutex_lock(&sd_mtx); card_info[1].initialized = 0; sd_status[1].retry = 0; @@ -1073,7 +1073,7 @@ static void sd_thread(void) if (action != SDA_NONE) queue_broadcast(SYS_FS_CHANGED, 0); - spinlock_unlock(&sd_spin); + mutex_unlock(&sd_mtx); break; } /* SD_HOTSWAP */ #endif /* HAVE_HOTSWAP */ @@ -1150,9 +1150,9 @@ int ata_init(void) int ret = 0; if (!initialized) - spinlock_init(&sd_spin IF_COP(, SPINLOCK_TASK_SWITCH)); + mutex_init(&sd_mtx); - spinlock_lock(&sd_spin); + mutex_lock(&sd_mtx); ata_led(false); @@ -1215,7 +1215,7 @@ int ata_init(void) #endif } - spinlock_unlock(&sd_spin); + mutex_unlock(&sd_mtx); return ret; } diff --git a/firmware/target/arm/tms320dm320/spi-dm320.c b/firmware/target/arm/tms320dm320/spi-dm320.c index f3b41add54..d8f338f592 100644 --- a/firmware/target/arm/tms320dm320/spi-dm320.c +++ b/firmware/target/arm/tms320dm320/spi-dm320.c @@ -32,7 +32,7 @@ #define GIO_RTC_ENABLE (1<<12) #define GIO_BL_ENABLE (1<<13) -struct spinlock spi_lock; +struct mutex spi_mtx; struct SPI_info { volatile unsigned short *setreg; @@ -60,7 +60,7 @@ int spi_block_transfer(enum SPI_target target, const uint8_t *tx_bytes, unsigned int tx_size, uint8_t *rx_bytes, unsigned int rx_size) { - spinlock_lock(&spi_lock); + mutex_lock(&spi_mtx); /* Activate the slave select pin */ *spi_targets[target].setreg = spi_targets[target].bit; @@ -87,13 +87,13 @@ int spi_block_transfer(enum SPI_target target, *spi_targets[target].clrreg = spi_targets[target].bit; - spinlock_unlock(&spi_lock); + mutex_unlock(&spi_mtx); return 0; } void spi_init(void) { - spinlock_init(&spi_lock); + mutex_init(&spi_mtx); /* Set SCLK idle level = 0 */ IO_SERIAL0_MODE |= 1<<10; /* Enable TX */ -- cgit v1.2.3