diff options
-rw-r--r-- | apps/debug_menu.c | 17 | ||||
-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 |
8 files changed, 31 insertions, 15 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 2cc000de17..cbec60ee62 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -60,8 +60,8 @@ | |||
60 | #include "fat.h" | 60 | #include "fat.h" |
61 | #include "mas.h" | 61 | #include "mas.h" |
62 | #include "eeprom_24cxx.h" | 62 | #include "eeprom_24cxx.h" |
63 | #if defined(HAVE_MMC) || defined(HAVE_HOTSWAP) | 63 | #if defined(HAVE_MMC) || defined(HAVE_ATA_SD) |
64 | #include "ata_mmc.h" | 64 | #include "hotswap.h" |
65 | #endif | 65 | #endif |
66 | #if CONFIG_TUNER | 66 | #if CONFIG_TUNER |
67 | #include "tuner.h" | 67 | #include "tuner.h" |
@@ -1716,7 +1716,7 @@ static bool view_battery(void) | |||
1716 | #endif | 1716 | #endif |
1717 | 1717 | ||
1718 | #ifndef SIMULATOR | 1718 | #ifndef SIMULATOR |
1719 | #if defined(HAVE_MMC) || defined(HAVE_HOTSWAP) | 1719 | #if defined(HAVE_MMC) || defined(HAVE_ATA_SD) |
1720 | #if defined(HAVE_MMC) | 1720 | #if defined(HAVE_MMC) |
1721 | #define CARDTYPE "MMC" | 1721 | #define CARDTYPE "MMC" |
1722 | #else | 1722 | #else |
@@ -1737,10 +1737,12 @@ static int disk_callback(int btn, struct gui_synclist *lists) | |||
1737 | "3.1-3.31", "4.0" }; | 1737 | "3.1-3.31", "4.0" }; |
1738 | if ((btn == ACTION_STD_OK) || (btn == SYS_FS_CHANGED) || (btn == ACTION_REDRAW)) | 1738 | if ((btn == ACTION_STD_OK) || (btn == SYS_FS_CHANGED) || (btn == ACTION_REDRAW)) |
1739 | { | 1739 | { |
1740 | #ifdef HAVE_HOTSWAP | ||
1740 | if (btn == ACTION_STD_OK) | 1741 | if (btn == ACTION_STD_OK) |
1741 | { | 1742 | { |
1742 | *cardnum ^= 0x1; /* change cards */ | 1743 | *cardnum ^= 0x1; /* change cards */ |
1743 | } | 1744 | } |
1745 | #endif | ||
1744 | 1746 | ||
1745 | simplelist_set_line_count(0); | 1747 | simplelist_set_line_count(0); |
1746 | 1748 | ||
@@ -1814,7 +1816,7 @@ static int disk_callback(int btn, struct gui_synclist *lists) | |||
1814 | } | 1816 | } |
1815 | return btn; | 1817 | return btn; |
1816 | } | 1818 | } |
1817 | #else /* !defined(HAVE_MMC) && !defined(HAVE_HOTSWAP) */ | 1819 | #else /* !defined(HAVE_MMC) && !defined(HAVE_ATA_SD) */ |
1818 | static int disk_callback(int btn, struct gui_synclist *lists) | 1820 | static int disk_callback(int btn, struct gui_synclist *lists) |
1819 | { | 1821 | { |
1820 | (void)lists; | 1822 | (void)lists; |
@@ -1948,12 +1950,13 @@ static bool dbg_identify_info(void) | |||
1948 | } | 1950 | } |
1949 | return false; | 1951 | return false; |
1950 | } | 1952 | } |
1951 | #endif /* !defined(HAVE_MMC) && !defined(HAVE_HOTSWAP) */ | 1953 | #endif /* !defined(HAVE_MMC) && !defined(HAVE_ATA_SD) */ |
1954 | |||
1952 | static bool dbg_disk_info(void) | 1955 | static bool dbg_disk_info(void) |
1953 | { | 1956 | { |
1954 | struct simplelist_info info; | 1957 | struct simplelist_info info; |
1955 | simplelist_info_init(&info, "Disk Info", 1, NULL); | 1958 | simplelist_info_init(&info, "Disk Info", 1, NULL); |
1956 | #if defined(HAVE_MMC) || defined(HAVE_HOTSWAP) | 1959 | #if defined(HAVE_MMC) || defined(HAVE_ATA_SD) |
1957 | char title[16]; | 1960 | char title[16]; |
1958 | int card = 0; | 1961 | int card = 0; |
1959 | info.callback_data = (void*)&card; | 1962 | info.callback_data = (void*)&card; |
@@ -2536,7 +2539,7 @@ static const struct the_menu_item menuitems[] = { | |||
2536 | #endif | 2539 | #endif |
2537 | #ifndef SIMULATOR | 2540 | #ifndef SIMULATOR |
2538 | { "View disk info", dbg_disk_info }, | 2541 | { "View disk info", dbg_disk_info }, |
2539 | #if !defined(HAVE_MMC) && !defined(HAVE_HOTSWAP) | 2542 | #if !defined(HAVE_MMC) && !defined(HAVE_ATA_SD) |
2540 | { "Dump ATA identify info", dbg_identify_info}, | 2543 | { "Dump ATA identify info", dbg_identify_info}, |
2541 | #endif | 2544 | #endif |
2542 | #endif | 2545 | #endif |
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; |