From 1167e3c72f5d0d581b81fd2cb8f2580a1524ca5a Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sat, 30 Jun 2007 02:08:27 +0000 Subject: Accept FS#7134 - Sansa: external sd card support by Antonius Hellmann with some tweaks. All testers have given the green light. (Now for the RED ?? ;). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13741 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/ata_mmc.h | 24 ++---------------- firmware/export/config-e200.h | 5 ++++ firmware/export/config.h | 2 +- firmware/export/hotswap.h | 59 +++++++++++++++++++++++++++++++++++++++++++ firmware/export/kernel.h | 4 +-- firmware/export/pp5024.h | 2 +- 6 files changed, 70 insertions(+), 26 deletions(-) create mode 100644 firmware/export/hotswap.h (limited to 'firmware/export') diff --git a/firmware/export/ata_mmc.h b/firmware/export/ata_mmc.h index a4e9f71f09..2361c439b5 100644 --- a/firmware/export/ata_mmc.h +++ b/firmware/export/ata_mmc.h @@ -18,34 +18,14 @@ ****************************************************************************/ #ifndef __ATA_MMC_H__ #define __ATA_MMC_H__ - -typedef struct -{ - bool initialized; - unsigned char bitrate_register; - unsigned long read_timeout; /* n * 8 clock cycles */ - unsigned long write_timeout; /* n * 8 clock cycles */ - - unsigned long ocr; /* OCR register */ - unsigned long csd[4]; /* CSD register, 16 bytes */ - unsigned long cid[4]; /* CID register, 16 bytes */ - unsigned long speed; /* bit/s */ - unsigned int nsac; /* clock cycles */ - unsigned long tsac; /* n * 0.1 ns */ - unsigned int r2w_factor; - unsigned long size; /* size in bytes */ - unsigned long numblocks; /* size in flash blocks */ - unsigned int blocksize; /* block size in bytes */ - unsigned int block_exp; /* block size exponent */ -} tCardInfo; +#include "hotswap.h" void mmc_enable_int_flash_clock(bool on); bool mmc_detect(void); -unsigned long mmc_extract_bits(const unsigned long *p, unsigned int start, - unsigned int size); tCardInfo *mmc_card_info(int card_no); bool mmc_touched(void); bool mmc_usb_active(int delayticks); + #ifdef HAVE_HOTSWAP void mmc_enable_monitoring(bool on); #endif diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h index 71b1270749..f9708697dc 100644 --- a/firmware/export/config-e200.h +++ b/firmware/export/config-e200.h @@ -33,6 +33,11 @@ /* define this if you have LCD enable function */ #define HAVE_LCD_ENABLE +#ifndef SIMULATOR +#define HAVE_HOTSWAP +#define HAVE_MULTIVOLUME +#endif + #define HAVE_BACKLIGHT_BRIGHTNESS /* Main LCD backlight brightness range and defaults */ #define MIN_BRIGHTNESS_SETTING 1 diff --git a/firmware/export/config.h b/firmware/export/config.h index 4652359e62..ffcbf688ea 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -247,7 +247,7 @@ /* Enable the directory cache and tagcache in RAM if we have * plenty of RAM. Both features can be enabled independently. */ #if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8) && \ - !defined(BOOTLOADER) + !defined(BOOTLOADER) && !defined(SANSA_E200) #define HAVE_DIRCACHE #ifdef HAVE_TAGCACHE #define HAVE_TC_RAMCACHE diff --git a/firmware/export/hotswap.h b/firmware/export/hotswap.h new file mode 100644 index 0000000000..c6a657d731 --- /dev/null +++ b/firmware/export/hotswap.h @@ -0,0 +1,59 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2004 by Jens Arnold + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef __HOTSWAP_H__ +#define __HOTSWAP_H__ + +typedef struct +{ + bool initialized; + unsigned char bitrate_register; + unsigned long read_timeout; /* n * 8 clock cycles */ + unsigned long write_timeout; /* n * 8 clock cycles */ + + unsigned long ocr; /* OCR register */ + unsigned long csd[4]; /* CSD register, 16 bytes */ + unsigned long cid[4]; /* CID register, 16 bytes */ + unsigned long speed; /* bit/s */ + unsigned int nsac; /* clock cycles */ + unsigned long tsac; /* n * 0.1 ns */ + unsigned int r2w_factor; + unsigned long size; /* size in bytes */ + unsigned long numblocks; /* size in flash blocks */ + unsigned int blocksize; /* block size in bytes */ + unsigned int block_exp; /* block size exponent */ +} tCardInfo; + +#ifdef TARGET_TREE +bool card_detect(void); +tCardInfo *card_get_info(int card_no); +#else /* HAVE_MMC */ +#include "ata_mmc.h" +#define card_detect mmc_detect +#define card_get_info mmc_card_info +#define card_touched mmc_touched +#define card_enable_monitoring mmc_enable_monitoring +#endif + +/* helper function to extract n (<=32) bits from an arbitrary position. + counting from MSB to LSB */ +unsigned long card_extract_bits( + const unsigned long *p, /* the start of the bitfield array */ + unsigned int start, /* bit no. to start reading */ + unsigned int size); /* how many bits to read */ +#endif diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h index 9e3a8d25df..d5898a97f1 100644 --- a/firmware/export/kernel.h +++ b/firmware/export/kernel.h @@ -41,8 +41,8 @@ #define SYS_USB_DISCONNECTED ((SYS_EVENT | ((long)3 << 27))) #define SYS_USB_DISCONNECTED_ACK ((SYS_EVENT | ((long)4 << 27))) #define SYS_TIMEOUT ((SYS_EVENT | ((long)5 << 27))) -#define SYS_MMC_INSERTED ((SYS_EVENT | ((long)6 << 27))) -#define SYS_MMC_EXTRACTED ((SYS_EVENT | ((long)7 << 27))) +#define SYS_HOTSWAP_INSERTED ((SYS_EVENT | ((long)6 << 27))) +#define SYS_HOTSWAP_EXTRACTED ((SYS_EVENT | ((long)7 << 27))) #define SYS_POWEROFF ((SYS_EVENT | ((long)8 << 27))) #define SYS_FS_CHANGED ((SYS_EVENT | ((long)9 << 27))) #define SYS_CHARGER_CONNECTED ((SYS_EVENT | ((long)10 << 27))) diff --git a/firmware/export/pp5024.h b/firmware/export/pp5024.h index e7758b9ce5..5e2de17741 100644 --- a/firmware/export/pp5024.h +++ b/firmware/export/pp5024.h @@ -24,7 +24,7 @@ #include "pp5020.h" #undef GPIO_IRQ -/* Ports A, ?? */ +/* Ports A, B, ?? */ #define GPIO0_IRQ (32+0) /* Ports F, H, ?? */ #define GPIO1_IRQ (32+1) -- cgit v1.2.3