diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2007-10-16 01:25:17 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2007-10-16 01:25:17 +0000 |
commit | a9b2fb5ee3114fe835f6515b6aeae7454f66d821 (patch) | |
tree | fc4e96d0c1f215565918406c8827b16b806c1345 /firmware/target/arm/sandisk | |
parent | a3fbbc9fa7e12fd3fce122bbd235dc362050e024 (diff) | |
download | rockbox-a9b2fb5ee3114fe835f6515b6aeae7454f66d821.tar.gz rockbox-a9b2fb5ee3114fe835f6515b6aeae7454f66d821.zip |
Finally full multicore support for PortalPlayer 502x targets with an eye towards the possibility of other types. All SVN targets the low-lag code to speed up blocking operations. Most files are modified here simple due to a name change to actually support a real event object and a param change to create_thread. Add some use of new features but just sit on things for a bit and leave full integration for later. Work will continue on to address size on sensitive targets and simplify things if possible. Any PP target having problems with SWP can easily be changed to sw corelocks with one #define change in config.h though only PP5020 has shown an issue and seems to work without any difficulties.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15134 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/sandisk')
-rw-r--r-- | firmware/target/arm/sandisk/adc-c200_e200.c | 7 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/ata-c200_e200.c | 27 |
2 files changed, 16 insertions, 18 deletions
diff --git a/firmware/target/arm/sandisk/adc-c200_e200.c b/firmware/target/arm/sandisk/adc-c200_e200.c index 31321ece37..9dc8f3aabb 100644 --- a/firmware/target/arm/sandisk/adc-c200_e200.c +++ b/firmware/target/arm/sandisk/adc-c200_e200.c | |||
@@ -21,8 +21,6 @@ | |||
21 | #include "i2c-pp.h" | 21 | #include "i2c-pp.h" |
22 | #include "as3514.h" | 22 | #include "as3514.h" |
23 | 23 | ||
24 | static struct mutex adc_mutex NOCACHEBSS_ATTR; | ||
25 | |||
26 | /* Read 10-bit channel data */ | 24 | /* Read 10-bit channel data */ |
27 | unsigned short adc_read(int channel) | 25 | unsigned short adc_read(int channel) |
28 | { | 26 | { |
@@ -30,7 +28,7 @@ unsigned short adc_read(int channel) | |||
30 | 28 | ||
31 | if ((unsigned)channel < NUM_ADC_CHANNELS) | 29 | if ((unsigned)channel < NUM_ADC_CHANNELS) |
32 | { | 30 | { |
33 | spinlock_lock(&adc_mutex); | 31 | spinlock_lock(&i2c_spin); |
34 | 32 | ||
35 | /* Select channel */ | 33 | /* Select channel */ |
36 | if (pp_i2c_send( AS3514_I2C_ADDR, ADC_0, (channel << 4)) >= 0) | 34 | if (pp_i2c_send( AS3514_I2C_ADDR, ADC_0, (channel << 4)) >= 0) |
@@ -44,7 +42,7 @@ unsigned short adc_read(int channel) | |||
44 | } | 42 | } |
45 | } | 43 | } |
46 | 44 | ||
47 | spinlock_unlock(&adc_mutex); | 45 | spinlock_unlock(&i2c_spin); |
48 | } | 46 | } |
49 | 47 | ||
50 | return data; | 48 | return data; |
@@ -52,5 +50,4 @@ unsigned short adc_read(int channel) | |||
52 | 50 | ||
53 | void adc_init(void) | 51 | void adc_init(void) |
54 | { | 52 | { |
55 | spinlock_init(&adc_mutex); | ||
56 | } | 53 | } |
diff --git a/firmware/target/arm/sandisk/ata-c200_e200.c b/firmware/target/arm/sandisk/ata-c200_e200.c index 14be27e19d..8e17152e6f 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 */ |
163 | static long sd_stack [(DEFAULT_STACK_SIZE*2 + 0x1c0)/sizeof(long)]; | 163 | static long sd_stack [(DEFAULT_STACK_SIZE*2 + 0x1c0)/sizeof(long)]; |
164 | static const char sd_thread_name[] = "ata/sd"; | 164 | static const char sd_thread_name[] = "ata/sd"; |
165 | static struct mutex sd_mtx; | 165 | static struct spinlock sd_spin NOCACHEBSS_ATTR; |
166 | static struct event_queue sd_queue; | 166 | static 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_mtx); | 804 | spinlock_lock(&sd_spin); |
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_mtx); | 891 | spinlock_unlock(&sd_spin); |
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_mtx); | 919 | spinlock_lock(&sd_spin); |
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_mtx); | 1019 | spinlock_unlock(&sd_spin); |
1020 | 1020 | ||
1021 | return ret; | 1021 | return ret; |
1022 | 1022 | ||
@@ -1034,7 +1034,7 @@ ata_write_error: | |||
1034 | static void sd_thread(void) __attribute__((noreturn)); | 1034 | static void sd_thread(void) __attribute__((noreturn)); |
1035 | static void sd_thread(void) | 1035 | static void sd_thread(void) |
1036 | { | 1036 | { |
1037 | struct event ev; | 1037 | struct queue_event ev; |
1038 | bool idle_notified = false; | 1038 | bool idle_notified = false; |
1039 | 1039 | ||
1040 | while (1) | 1040 | while (1) |
@@ -1050,10 +1050,9 @@ 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_mtx); | 1053 | spinlock_lock(&sd_spin); |
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 | spinlock_unlock(&sd_mtx); | ||
1057 | 1056 | ||
1058 | /* Either unmount because the card was pulled or unmount and | 1057 | /* Either unmount because the card was pulled or unmount and |
1059 | remount if already mounted since multiple messages may be | 1058 | remount if already mounted since multiple messages may be |
@@ -1073,6 +1072,8 @@ static void sd_thread(void) | |||
1073 | 1072 | ||
1074 | if (action != SDA_NONE) | 1073 | if (action != SDA_NONE) |
1075 | queue_broadcast(SYS_FS_CHANGED, 0); | 1074 | queue_broadcast(SYS_FS_CHANGED, 0); |
1075 | |||
1076 | spinlock_unlock(&sd_spin); | ||
1076 | break; | 1077 | break; |
1077 | } /* SD_HOTSWAP */ | 1078 | } /* SD_HOTSWAP */ |
1078 | #endif /* HAVE_HOTSWAP */ | 1079 | #endif /* HAVE_HOTSWAP */ |
@@ -1155,9 +1156,9 @@ int ata_init(void) | |||
1155 | { | 1156 | { |
1156 | initialized = true; | 1157 | initialized = true; |
1157 | 1158 | ||
1158 | spinlock_init(&sd_mtx); | 1159 | spinlock_init(&sd_spin IF_COP(, SPINLOCK_TASK_SWITCH)); |
1159 | 1160 | ||
1160 | spinlock_lock(&sd_mtx); | 1161 | spinlock_lock(&sd_spin); |
1161 | 1162 | ||
1162 | /* init controller */ | 1163 | /* init controller */ |
1163 | outl(inl(0x70000088) & ~(0x4), 0x70000088); | 1164 | outl(inl(0x70000088) & ~(0x4), 0x70000088); |
@@ -1181,8 +1182,8 @@ int ata_init(void) | |||
1181 | ret = currcard->initialized; | 1182 | ret = currcard->initialized; |
1182 | 1183 | ||
1183 | queue_init(&sd_queue, true); | 1184 | queue_init(&sd_queue, true); |
1184 | create_thread(sd_thread, sd_stack, sizeof(sd_stack), | 1185 | create_thread(sd_thread, sd_stack, sizeof(sd_stack), 0, |
1185 | sd_thread_name IF_PRIO(, PRIORITY_SYSTEM) IF_COP(, CPU, false)); | 1186 | sd_thread_name IF_PRIO(, PRIORITY_SYSTEM) IF_COP(, CPU)); |
1186 | 1187 | ||
1187 | /* enable interupt for the mSD card */ | 1188 | /* enable interupt for the mSD card */ |
1188 | sleep(HZ/10); | 1189 | sleep(HZ/10); |
@@ -1195,7 +1196,7 @@ int ata_init(void) | |||
1195 | GPIOA_INT_CLR = 0x80; | 1196 | GPIOA_INT_CLR = 0x80; |
1196 | GPIOA_INT_EN |= 0x80; | 1197 | GPIOA_INT_EN |= 0x80; |
1197 | #endif | 1198 | #endif |
1198 | spinlock_unlock(&sd_mtx); | 1199 | spinlock_unlock(&sd_spin); |
1199 | } | 1200 | } |
1200 | 1201 | ||
1201 | return ret; | 1202 | return ret; |