diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/config-c200.h | 3 | ||||
-rw-r--r-- | firmware/export/config-e200.h | 3 | ||||
-rw-r--r-- | firmware/export/hotswap.h | 6 | ||||
-rw-r--r-- | firmware/target/arm/ata-sd-pp.c | 8 | ||||
-rw-r--r-- | firmware/target/arm/ata-sd-target.h | 3 | ||||
-rw-r--r-- | firmware/target/arm/system-pp502x.c | 4 | ||||
-rw-r--r-- | firmware/usbstack/usb_storage.c | 2 |
7 files changed, 21 insertions, 8 deletions
diff --git a/firmware/export/config-c200.h b/firmware/export/config-c200.h index a0bb1aeb2c..9f3e78f611 100644 --- a/firmware/export/config-c200.h +++ b/firmware/export/config-c200.h | |||
@@ -113,6 +113,9 @@ | |||
113 | /* define this if you have a flash memory storage */ | 113 | /* define this if you have a flash memory storage */ |
114 | #define HAVE_FLASH_STORAGE | 114 | #define HAVE_FLASH_STORAGE |
115 | 115 | ||
116 | /* define this if the flash memory uses the SecureDigital Memory Card protocol */ | ||
117 | #define HAVE_ATA_SD | ||
118 | |||
116 | #define BATTERY_CAPACITY_DEFAULT 530 /* default battery capacity */ | 119 | #define BATTERY_CAPACITY_DEFAULT 530 /* default battery capacity */ |
117 | #define BATTERY_CAPACITY_MIN 530 /* min. capacity selectable */ | 120 | #define BATTERY_CAPACITY_MIN 530 /* min. capacity selectable */ |
118 | #define BATTERY_CAPACITY_MAX 530 /* max. capacity selectable */ | 121 | #define BATTERY_CAPACITY_MAX 530 /* max. capacity selectable */ |
diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h index c49ee23841..8d42dd2618 100644 --- a/firmware/export/config-e200.h +++ b/firmware/export/config-e200.h | |||
@@ -108,6 +108,9 @@ | |||
108 | /* define this if you have a flash memory storage */ | 108 | /* define this if you have a flash memory storage */ |
109 | #define HAVE_FLASH_STORAGE | 109 | #define HAVE_FLASH_STORAGE |
110 | 110 | ||
111 | /* define this if the flash memory uses the SecureDigital Memory Card protocol */ | ||
112 | #define HAVE_ATA_SD | ||
113 | |||
111 | #define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */ | 114 | #define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */ |
112 | #define BATTERY_CAPACITY_MIN 750 /* min. capacity selectable */ | 115 | #define BATTERY_CAPACITY_MIN 750 /* min. capacity selectable */ |
113 | #define BATTERY_CAPACITY_MAX 750 /* max. capacity selectable */ | 116 | #define BATTERY_CAPACITY_MAX 750 /* max. capacity selectable */ |
diff --git a/firmware/export/hotswap.h b/firmware/export/hotswap.h index 7f0aa80fda..f54423325d 100644 --- a/firmware/export/hotswap.h +++ b/firmware/export/hotswap.h | |||
@@ -39,13 +39,13 @@ typedef struct | |||
39 | unsigned int block_exp; /* block size exponent */ | 39 | unsigned int block_exp; /* block size exponent */ |
40 | } tCardInfo; | 40 | } tCardInfo; |
41 | 41 | ||
42 | #ifdef TARGET_TREE | 42 | #ifdef HAVE_ATA_SD |
43 | #ifdef HAVE_HOTSWAP | ||
44 | #include "ata-sd-target.h" | 43 | #include "ata-sd-target.h" |
45 | #endif | ||
46 | #define card_detect card_detect_target | 44 | #define card_detect card_detect_target |
47 | #define card_get_info card_get_info_target | 45 | #define card_get_info card_get_info_target |
46 | #ifdef HAVE_HOTSWAP | ||
48 | #define card_enable_monitoring card_enable_monitoring_target | 47 | #define card_enable_monitoring card_enable_monitoring_target |
48 | #endif | ||
49 | #else /* HAVE_MMC */ | 49 | #else /* HAVE_MMC */ |
50 | #include "ata_mmc.h" | 50 | #include "ata_mmc.h" |
51 | #define card_detect mmc_detect | 51 | #define card_detect mmc_detect |
diff --git a/firmware/target/arm/ata-sd-pp.c b/firmware/target/arm/ata-sd-pp.c index 8c7ebcddc7..e4ab922f24 100644 --- a/firmware/target/arm/ata-sd-pp.c +++ b/firmware/target/arm/ata-sd-pp.c | |||
@@ -18,9 +18,7 @@ | |||
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include "fat.h" | 19 | #include "fat.h" |
20 | #include "hotswap.h" | 20 | #include "hotswap.h" |
21 | #ifdef BOOTLOADER | ||
22 | #include "ata-sd-target.h" | 21 | #include "ata-sd-target.h" |
23 | #endif | ||
24 | #include "ata_idle_notify.h" | 22 | #include "ata_idle_notify.h" |
25 | #include "system.h" | 23 | #include "system.h" |
26 | #include <string.h> | 24 | #include <string.h> |
@@ -1278,16 +1276,20 @@ tCardInfo *card_get_info_target(int card_no) | |||
1278 | return &card; | 1276 | return &card; |
1279 | } | 1277 | } |
1280 | 1278 | ||
1281 | #ifdef HAVE_HOTSWAP | ||
1282 | bool card_detect_target(void) | 1279 | bool card_detect_target(void) |
1283 | { | 1280 | { |
1281 | #ifdef HAVE_HOTSWAP | ||
1284 | #ifdef SANSA_E200 | 1282 | #ifdef SANSA_E200 |
1285 | return (GPIOA_INPUT_VAL & 0x80) == 0; /* low active */ | 1283 | return (GPIOA_INPUT_VAL & 0x80) == 0; /* low active */ |
1286 | #elif defined SANSA_C200 | 1284 | #elif defined SANSA_C200 |
1287 | return (GPIOL_INPUT_VAL & 0x08) != 0; /* high active */ | 1285 | return (GPIOL_INPUT_VAL & 0x08) != 0; /* high active */ |
1288 | #endif | 1286 | #endif |
1287 | #else | ||
1288 | return false; | ||
1289 | #endif | ||
1289 | } | 1290 | } |
1290 | 1291 | ||
1292 | #ifdef HAVE_HOTSWAP | ||
1291 | static bool sd1_oneshot_callback(struct timeout *tmo) | 1293 | static bool sd1_oneshot_callback(struct timeout *tmo) |
1292 | { | 1294 | { |
1293 | (void)tmo; | 1295 | (void)tmo; |
diff --git a/firmware/target/arm/ata-sd-target.h b/firmware/target/arm/ata-sd-target.h index dce2ca9030..33106156cc 100644 --- a/firmware/target/arm/ata-sd-target.h +++ b/firmware/target/arm/ata-sd-target.h | |||
@@ -40,6 +40,9 @@ typedef struct | |||
40 | 40 | ||
41 | tCardInfo *card_get_info_target(int card_no); | 41 | tCardInfo *card_get_info_target(int card_no); |
42 | bool card_detect_target(void); | 42 | bool card_detect_target(void); |
43 | |||
44 | #ifdef HAVE_HOTSWAP | ||
43 | void card_enable_monitoring_target(bool on); | 45 | void card_enable_monitoring_target(bool on); |
46 | #endif | ||
44 | 47 | ||
45 | #endif | 48 | #endif |
diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c index 9b335fe223..4e3f2c0cf0 100644 --- a/firmware/target/arm/system-pp502x.c +++ b/firmware/target/arm/system-pp502x.c | |||
@@ -54,17 +54,19 @@ void irq(void) | |||
54 | else if (CPU_HI_INT_STAT & I2C_MASK) | 54 | else if (CPU_HI_INT_STAT & I2C_MASK) |
55 | ipod_4g_button_int(); | 55 | ipod_4g_button_int(); |
56 | #elif defined(SANSA_E200) | 56 | #elif defined(SANSA_E200) |
57 | #ifdef HAVE_HOTSWAP | ||
57 | else if (CPU_HI_INT_STAT & GPIO0_MASK) { | 58 | else if (CPU_HI_INT_STAT & GPIO0_MASK) { |
58 | if (GPIOA_INT_STAT & 0x80) | 59 | if (GPIOA_INT_STAT & 0x80) |
59 | microsd_int(); | 60 | microsd_int(); |
60 | } | 61 | } |
62 | #endif | ||
61 | else if (CPU_HI_INT_STAT & GPIO1_MASK) { | 63 | else if (CPU_HI_INT_STAT & GPIO1_MASK) { |
62 | if (GPIOF_INT_STAT & 0xff) | 64 | if (GPIOF_INT_STAT & 0xff) |
63 | button_int(); | 65 | button_int(); |
64 | if (GPIOH_INT_STAT & 0xc0) | 66 | if (GPIOH_INT_STAT & 0xc0) |
65 | clickwheel_int(); | 67 | clickwheel_int(); |
66 | } | 68 | } |
67 | #elif defined(SANSA_C200) | 69 | #elif defined(SANSA_C200) && defined(HAVE_HOTSWAP) |
68 | else if (CPU_HI_INT_STAT & GPIO2_MASK) { | 70 | else if (CPU_HI_INT_STAT & GPIO2_MASK) { |
69 | if (GPIOL_INT_STAT & 0x08) | 71 | if (GPIOL_INT_STAT & 0x08) |
70 | microsd_int(); | 72 | microsd_int(); |
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c index c496e5142b..72306995aa 100644 --- a/firmware/usbstack/usb_storage.c +++ b/firmware/usbstack/usb_storage.c | |||
@@ -605,7 +605,7 @@ static void handle_scsi(struct command_block_wrapper* cbw) | |||
605 | unsigned char lun = cbw->lun; | 605 | unsigned char lun = cbw->lun; |
606 | #endif | 606 | #endif |
607 | unsigned int block_size_mult = 1; | 607 | unsigned int block_size_mult = 1; |
608 | #ifdef HAVE_HOTSWAP | 608 | #if defined(HAVE_ATA_SD) || defined(HAVE_HOTSWAP) |
609 | tCardInfo* cinfo = card_get_info(lun); | 609 | tCardInfo* cinfo = card_get_info(lun); |
610 | if(cinfo->initialized==1 && cinfo->numblocks > 0) { | 610 | if(cinfo->initialized==1 && cinfo->numblocks > 0) { |
611 | block_size = cinfo->blocksize; | 611 | block_size = cinfo->blocksize; |