1
0
Fork 0
forked from len0rd/rockbox

Preparing for the Philips SA9200 part 2. Since the SA9200 doesn't have a microsd card (no hotswap), use HAVE_ATA_SD for the Sansa flash driver so we don't rely on HAVE_HOTSWAP in some places.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17488 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Mark Arigo 2008-05-13 02:50:31 +00:00
parent 7656748221
commit 3e743ec6c9
8 changed files with 31 additions and 15 deletions

View file

@ -60,8 +60,8 @@
#include "fat.h" #include "fat.h"
#include "mas.h" #include "mas.h"
#include "eeprom_24cxx.h" #include "eeprom_24cxx.h"
#if defined(HAVE_MMC) || defined(HAVE_HOTSWAP) #if defined(HAVE_MMC) || defined(HAVE_ATA_SD)
#include "ata_mmc.h" #include "hotswap.h"
#endif #endif
#if CONFIG_TUNER #if CONFIG_TUNER
#include "tuner.h" #include "tuner.h"
@ -1716,7 +1716,7 @@ static bool view_battery(void)
#endif #endif
#ifndef SIMULATOR #ifndef SIMULATOR
#if defined(HAVE_MMC) || defined(HAVE_HOTSWAP) #if defined(HAVE_MMC) || defined(HAVE_ATA_SD)
#if defined(HAVE_MMC) #if defined(HAVE_MMC)
#define CARDTYPE "MMC" #define CARDTYPE "MMC"
#else #else
@ -1737,10 +1737,12 @@ static int disk_callback(int btn, struct gui_synclist *lists)
"3.1-3.31", "4.0" }; "3.1-3.31", "4.0" };
if ((btn == ACTION_STD_OK) || (btn == SYS_FS_CHANGED) || (btn == ACTION_REDRAW)) if ((btn == ACTION_STD_OK) || (btn == SYS_FS_CHANGED) || (btn == ACTION_REDRAW))
{ {
#ifdef HAVE_HOTSWAP
if (btn == ACTION_STD_OK) if (btn == ACTION_STD_OK)
{ {
*cardnum ^= 0x1; /* change cards */ *cardnum ^= 0x1; /* change cards */
} }
#endif
simplelist_set_line_count(0); simplelist_set_line_count(0);
@ -1814,7 +1816,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
} }
return btn; return btn;
} }
#else /* !defined(HAVE_MMC) && !defined(HAVE_HOTSWAP) */ #else /* !defined(HAVE_MMC) && !defined(HAVE_ATA_SD) */
static int disk_callback(int btn, struct gui_synclist *lists) static int disk_callback(int btn, struct gui_synclist *lists)
{ {
(void)lists; (void)lists;
@ -1948,12 +1950,13 @@ static bool dbg_identify_info(void)
} }
return false; return false;
} }
#endif /* !defined(HAVE_MMC) && !defined(HAVE_HOTSWAP) */ #endif /* !defined(HAVE_MMC) && !defined(HAVE_ATA_SD) */
static bool dbg_disk_info(void) static bool dbg_disk_info(void)
{ {
struct simplelist_info info; struct simplelist_info info;
simplelist_info_init(&info, "Disk Info", 1, NULL); simplelist_info_init(&info, "Disk Info", 1, NULL);
#if defined(HAVE_MMC) || defined(HAVE_HOTSWAP) #if defined(HAVE_MMC) || defined(HAVE_ATA_SD)
char title[16]; char title[16];
int card = 0; int card = 0;
info.callback_data = (void*)&card; info.callback_data = (void*)&card;
@ -2536,7 +2539,7 @@ static const struct the_menu_item menuitems[] = {
#endif #endif
#ifndef SIMULATOR #ifndef SIMULATOR
{ "View disk info", dbg_disk_info }, { "View disk info", dbg_disk_info },
#if !defined(HAVE_MMC) && !defined(HAVE_HOTSWAP) #if !defined(HAVE_MMC) && !defined(HAVE_ATA_SD)
{ "Dump ATA identify info", dbg_identify_info}, { "Dump ATA identify info", dbg_identify_info},
#endif #endif
#endif #endif

View file

@ -113,6 +113,9 @@
/* define this if you have a flash memory storage */ /* define this if you have a flash memory storage */
#define HAVE_FLASH_STORAGE #define HAVE_FLASH_STORAGE
/* define this if the flash memory uses the SecureDigital Memory Card protocol */
#define HAVE_ATA_SD
#define BATTERY_CAPACITY_DEFAULT 530 /* default battery capacity */ #define BATTERY_CAPACITY_DEFAULT 530 /* default battery capacity */
#define BATTERY_CAPACITY_MIN 530 /* min. capacity selectable */ #define BATTERY_CAPACITY_MIN 530 /* min. capacity selectable */
#define BATTERY_CAPACITY_MAX 530 /* max. capacity selectable */ #define BATTERY_CAPACITY_MAX 530 /* max. capacity selectable */

View file

@ -108,6 +108,9 @@
/* define this if you have a flash memory storage */ /* define this if you have a flash memory storage */
#define HAVE_FLASH_STORAGE #define HAVE_FLASH_STORAGE
/* define this if the flash memory uses the SecureDigital Memory Card protocol */
#define HAVE_ATA_SD
#define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */ #define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */
#define BATTERY_CAPACITY_MIN 750 /* min. capacity selectable */ #define BATTERY_CAPACITY_MIN 750 /* min. capacity selectable */
#define BATTERY_CAPACITY_MAX 750 /* max. capacity selectable */ #define BATTERY_CAPACITY_MAX 750 /* max. capacity selectable */

View file

@ -39,13 +39,13 @@ typedef struct
unsigned int block_exp; /* block size exponent */ unsigned int block_exp; /* block size exponent */
} tCardInfo; } tCardInfo;
#ifdef TARGET_TREE #ifdef HAVE_ATA_SD
#ifdef HAVE_HOTSWAP
#include "ata-sd-target.h" #include "ata-sd-target.h"
#endif
#define card_detect card_detect_target #define card_detect card_detect_target
#define card_get_info card_get_info_target #define card_get_info card_get_info_target
#ifdef HAVE_HOTSWAP
#define card_enable_monitoring card_enable_monitoring_target #define card_enable_monitoring card_enable_monitoring_target
#endif
#else /* HAVE_MMC */ #else /* HAVE_MMC */
#include "ata_mmc.h" #include "ata_mmc.h"
#define card_detect mmc_detect #define card_detect mmc_detect

View file

@ -18,9 +18,7 @@
****************************************************************************/ ****************************************************************************/
#include "fat.h" #include "fat.h"
#include "hotswap.h" #include "hotswap.h"
#ifdef BOOTLOADER
#include "ata-sd-target.h" #include "ata-sd-target.h"
#endif
#include "ata_idle_notify.h" #include "ata_idle_notify.h"
#include "system.h" #include "system.h"
#include <string.h> #include <string.h>
@ -1278,16 +1276,20 @@ tCardInfo *card_get_info_target(int card_no)
return &card; return &card;
} }
#ifdef HAVE_HOTSWAP
bool card_detect_target(void) bool card_detect_target(void)
{ {
#ifdef HAVE_HOTSWAP
#ifdef SANSA_E200 #ifdef SANSA_E200
return (GPIOA_INPUT_VAL & 0x80) == 0; /* low active */ return (GPIOA_INPUT_VAL & 0x80) == 0; /* low active */
#elif defined SANSA_C200 #elif defined SANSA_C200
return (GPIOL_INPUT_VAL & 0x08) != 0; /* high active */ return (GPIOL_INPUT_VAL & 0x08) != 0; /* high active */
#endif #endif
#else
return false;
#endif
} }
#ifdef HAVE_HOTSWAP
static bool sd1_oneshot_callback(struct timeout *tmo) static bool sd1_oneshot_callback(struct timeout *tmo)
{ {
(void)tmo; (void)tmo;

View file

@ -40,6 +40,9 @@ typedef struct
tCardInfo *card_get_info_target(int card_no); tCardInfo *card_get_info_target(int card_no);
bool card_detect_target(void); bool card_detect_target(void);
#ifdef HAVE_HOTSWAP
void card_enable_monitoring_target(bool on); void card_enable_monitoring_target(bool on);
#endif
#endif #endif

View file

@ -54,17 +54,19 @@ void irq(void)
else if (CPU_HI_INT_STAT & I2C_MASK) else if (CPU_HI_INT_STAT & I2C_MASK)
ipod_4g_button_int(); ipod_4g_button_int();
#elif defined(SANSA_E200) #elif defined(SANSA_E200)
#ifdef HAVE_HOTSWAP
else if (CPU_HI_INT_STAT & GPIO0_MASK) { else if (CPU_HI_INT_STAT & GPIO0_MASK) {
if (GPIOA_INT_STAT & 0x80) if (GPIOA_INT_STAT & 0x80)
microsd_int(); microsd_int();
} }
#endif
else if (CPU_HI_INT_STAT & GPIO1_MASK) { else if (CPU_HI_INT_STAT & GPIO1_MASK) {
if (GPIOF_INT_STAT & 0xff) if (GPIOF_INT_STAT & 0xff)
button_int(); button_int();
if (GPIOH_INT_STAT & 0xc0) if (GPIOH_INT_STAT & 0xc0)
clickwheel_int(); clickwheel_int();
} }
#elif defined(SANSA_C200) #elif defined(SANSA_C200) && defined(HAVE_HOTSWAP)
else if (CPU_HI_INT_STAT & GPIO2_MASK) { else if (CPU_HI_INT_STAT & GPIO2_MASK) {
if (GPIOL_INT_STAT & 0x08) if (GPIOL_INT_STAT & 0x08)
microsd_int(); microsd_int();

View file

@ -605,7 +605,7 @@ static void handle_scsi(struct command_block_wrapper* cbw)
unsigned char lun = cbw->lun; unsigned char lun = cbw->lun;
#endif #endif
unsigned int block_size_mult = 1; unsigned int block_size_mult = 1;
#ifdef HAVE_HOTSWAP #if defined(HAVE_ATA_SD) || defined(HAVE_HOTSWAP)
tCardInfo* cinfo = card_get_info(lun); tCardInfo* cinfo = card_get_info(lun);
if(cinfo->initialized==1 && cinfo->numblocks > 0) { if(cinfo->initialized==1 && cinfo->numblocks > 0) {
block_size = cinfo->blocksize; block_size = cinfo->blocksize;