summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-01-18 13:12:33 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-01-18 13:12:33 +0000
commit6a8379674c43103c008f841968b84287b8fdaf89 (patch)
tree39003a711cfff5cdf5ad00a56c70ae34f34d5100 /firmware/target
parent3b36b98ff8dea187bd6c25174978da4f7b5e3231 (diff)
downloadrockbox-6a8379674c43103c008f841968b84287b8fdaf89.tar.gz
rockbox-6a8379674c43103c008f841968b84287b8fdaf89.zip
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
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/ipod/1g2g/adc-ipod-1g2g.c8
-rw-r--r--firmware/target/arm/sandisk/ata-c200_e200.c20
-rw-r--r--firmware/target/arm/tms320dm320/spi-dm320.c8
3 files changed, 18 insertions, 18 deletions
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 @@
22#include "hwcompat.h" 22#include "hwcompat.h"
23#include "kernel.h" 23#include "kernel.h"
24 24
25static struct spinlock adc_spin NOCACHEBSS_ATTR; 25static struct mutex adc_mtx NOCACHEBSS_ATTR;
26 26
27/* used in the 2nd gen ADC interrupt */ 27/* used in the 2nd gen ADC interrupt */
28static unsigned int_data; 28static unsigned int_data;
@@ -33,7 +33,7 @@ unsigned short adc_scan(int channel)
33 unsigned short data = 0; 33 unsigned short data = 0;
34 34
35 (void)channel; /* there is only one */ 35 (void)channel; /* there is only one */
36 spinlock_lock(&adc_spin); 36 mutex_lock(&adc_mtx);
37 37
38 if ((IPOD_HW_REVISION >> 16) == 1) 38 if ((IPOD_HW_REVISION >> 16) == 1)
39 { 39 {
@@ -69,7 +69,7 @@ unsigned short adc_scan(int channel)
69 69
70 data = int_data & 0xff; 70 data = int_data & 0xff;
71 } 71 }
72 spinlock_unlock(&adc_spin); 72 mutex_unlock(&adc_mtx);
73 return data; 73 return data;
74} 74}
75 75
@@ -100,7 +100,7 @@ void ipod_2g_adc_int(void)
100 100
101void adc_init(void) 101void adc_init(void)
102{ 102{
103 spinlock_init(&adc_spin IF_COP(, SPINLOCK_TASK_SWITCH)); 103 mutex_init(&adc_mtx);
104 104
105 GPIOB_ENABLE |= 0x1e; /* enable B1..B4 */ 105 GPIOB_ENABLE |= 0x1e; /* enable B1..B4 */
106 106
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] =
162/* Shoot for around 75% usage */ 162/* Shoot for around 75% usage */
163static long sd_stack [(DEFAULT_STACK_SIZE*2 + 0x1c0)/sizeof(long)]; 163static long sd_stack [(DEFAULT_STACK_SIZE*2 + 0x1c0)/sizeof(long)];
164static const char sd_thread_name[] = "ata/sd"; 164static const char sd_thread_name[] = "ata/sd";
165static struct spinlock sd_spin NOCACHEBSS_ATTR; 165static struct mutex sd_mtx NOCACHEBSS_ATTR;
166static struct event_queue sd_queue; 166static struct event_queue sd_queue;
167 167
168/* Posted when card plugged status has changed */ 168/* Posted when card plugged status has changed */
@@ -801,7 +801,7 @@ int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int incount,
801 801
802 /* TODO: Add DMA support. */ 802 /* TODO: Add DMA support. */
803 803
804 spinlock_lock(&sd_spin); 804 mutex_lock(&sd_mtx);
805 805
806 ata_led(true); 806 ata_led(true);
807 807
@@ -888,7 +888,7 @@ ata_read_retry:
888 while (1) 888 while (1)
889 { 889 {
890 ata_led(false); 890 ata_led(false);
891 spinlock_unlock(&sd_spin); 891 mutex_unlock(&sd_mtx);
892 892
893 return ret; 893 return ret;
894 894
@@ -916,7 +916,7 @@ int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count,
916 const unsigned char *buf, *buf_end; 916 const unsigned char *buf, *buf_end;
917 int bank; 917 int bank;
918 918
919 spinlock_lock(&sd_spin); 919 mutex_lock(&sd_mtx);
920 920
921 ata_led(true); 921 ata_led(true);
922 922
@@ -1016,7 +1016,7 @@ ata_write_retry:
1016 while (1) 1016 while (1)
1017 { 1017 {
1018 ata_led(false); 1018 ata_led(false);
1019 spinlock_unlock(&sd_spin); 1019 mutex_unlock(&sd_mtx);
1020 1020
1021 return ret; 1021 return ret;
1022 1022
@@ -1050,7 +1050,7 @@ static void sd_thread(void)
1050 1050
1051 /* Lock to keep us from messing with this variable while an init 1051 /* Lock to keep us from messing with this variable while an init
1052 may be in progress */ 1052 may be in progress */
1053 spinlock_lock(&sd_spin); 1053 mutex_lock(&sd_mtx);
1054 card_info[1].initialized = 0; 1054 card_info[1].initialized = 0;
1055 sd_status[1].retry = 0; 1055 sd_status[1].retry = 0;
1056 1056
@@ -1073,7 +1073,7 @@ static void sd_thread(void)
1073 if (action != SDA_NONE) 1073 if (action != SDA_NONE)
1074 queue_broadcast(SYS_FS_CHANGED, 0); 1074 queue_broadcast(SYS_FS_CHANGED, 0);
1075 1075
1076 spinlock_unlock(&sd_spin); 1076 mutex_unlock(&sd_mtx);
1077 break; 1077 break;
1078 } /* SD_HOTSWAP */ 1078 } /* SD_HOTSWAP */
1079#endif /* HAVE_HOTSWAP */ 1079#endif /* HAVE_HOTSWAP */
@@ -1150,9 +1150,9 @@ int ata_init(void)
1150 int ret = 0; 1150 int ret = 0;
1151 1151
1152 if (!initialized) 1152 if (!initialized)
1153 spinlock_init(&sd_spin IF_COP(, SPINLOCK_TASK_SWITCH)); 1153 mutex_init(&sd_mtx);
1154 1154
1155 spinlock_lock(&sd_spin); 1155 mutex_lock(&sd_mtx);
1156 1156
1157 ata_led(false); 1157 ata_led(false);
1158 1158
@@ -1215,7 +1215,7 @@ int ata_init(void)
1215#endif 1215#endif
1216 } 1216 }
1217 1217
1218 spinlock_unlock(&sd_spin); 1218 mutex_unlock(&sd_mtx);
1219 1219
1220 return ret; 1220 return ret;
1221} 1221}
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 @@
32#define GIO_RTC_ENABLE (1<<12) 32#define GIO_RTC_ENABLE (1<<12)
33#define GIO_BL_ENABLE (1<<13) 33#define GIO_BL_ENABLE (1<<13)
34 34
35struct spinlock spi_lock; 35struct mutex spi_mtx;
36 36
37struct SPI_info { 37struct SPI_info {
38 volatile unsigned short *setreg; 38 volatile unsigned short *setreg;
@@ -60,7 +60,7 @@ int spi_block_transfer(enum SPI_target target,
60 const uint8_t *tx_bytes, unsigned int tx_size, 60 const uint8_t *tx_bytes, unsigned int tx_size,
61 uint8_t *rx_bytes, unsigned int rx_size) 61 uint8_t *rx_bytes, unsigned int rx_size)
62{ 62{
63 spinlock_lock(&spi_lock); 63 mutex_lock(&spi_mtx);
64 /* Activate the slave select pin */ 64 /* Activate the slave select pin */
65 *spi_targets[target].setreg = spi_targets[target].bit; 65 *spi_targets[target].setreg = spi_targets[target].bit;
66 66
@@ -87,13 +87,13 @@ int spi_block_transfer(enum SPI_target target,
87 87
88 *spi_targets[target].clrreg = spi_targets[target].bit; 88 *spi_targets[target].clrreg = spi_targets[target].bit;
89 89
90 spinlock_unlock(&spi_lock); 90 mutex_unlock(&spi_mtx);
91 return 0; 91 return 0;
92} 92}
93 93
94void spi_init(void) 94void spi_init(void)
95{ 95{
96 spinlock_init(&spi_lock); 96 mutex_init(&spi_mtx);
97 /* Set SCLK idle level = 0 */ 97 /* Set SCLK idle level = 0 */
98 IO_SERIAL0_MODE |= 1<<10; 98 IO_SERIAL0_MODE |= 1<<10;
99 /* Enable TX */ 99 /* Enable TX */