From e37044ff1d3406994fc6e07077a593f0ae95f8d7 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Wed, 12 Mar 2008 11:08:41 +0000 Subject: Hotswap code shuffling: Fix yellow. Simplify some target function access. Keep fat lock access from compiling for Ondios - think of a nicer way later. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16637 a1c6a512-1295-4272-9138-f99709370657 --- firmware/common/disk.c | 2 +- firmware/drivers/fat.c | 2 +- firmware/export/hotswap.h | 6 ++++-- firmware/hotswap.c | 18 +++--------------- firmware/target/arm/sandisk/ata-c200_e200.c | 4 ++-- firmware/target/arm/sandisk/hotswap-target.h | 2 +- 6 files changed, 12 insertions(+), 22 deletions(-) diff --git a/firmware/common/disk.c b/firmware/common/disk.c index c6200ba286..d4cfbc1a05 100644 --- a/firmware/common/disk.c +++ b/firmware/common/disk.c @@ -104,7 +104,7 @@ int disk_mount_all(void) int mounted; int i; -#if defined(HAVE_MMC) || defined(HAVE_HOTSWAP) +#ifdef HAVE_HOTSWAP card_enable_monitoring(false); #endif diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index f3374fc4c4..8ae3b70cd3 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c @@ -203,7 +203,7 @@ static char fat_cache_sectors[FAT_CACHE_SIZE][SECTOR_SIZE]; static struct fat_cache_entry fat_cache[FAT_CACHE_SIZE]; static struct mutex cache_mutex NOCACHEBSS_ATTR; -#ifdef HAVE_HOTSWAP +#if defined(HAVE_HOTSWAP) && !defined(HAVE_MMC) /* A better condition ?? */ void fat_lock(void) { mutex_lock(&cache_mutex); diff --git a/firmware/export/hotswap.h b/firmware/export/hotswap.h index 4a1b1717ca..03971098b9 100644 --- a/firmware/export/hotswap.h +++ b/firmware/export/hotswap.h @@ -40,8 +40,10 @@ typedef struct } tCardInfo; #ifdef TARGET_TREE -bool card_detect(void); -tCardInfo *card_get_info(int card_no); +#include "hotswap-target.h" +#define card_detect card_detect_target +#define card_get_info card_get_info_target +#define card_enable_monitoring card_enable_monitoring_target #else /* HAVE_MMC */ #include "ata_mmc.h" #define card_detect mmc_detect diff --git a/firmware/hotswap.c b/firmware/hotswap.c index 5620edf10b..bbcdabf649 100644 --- a/firmware/hotswap.c +++ b/firmware/hotswap.c @@ -18,10 +18,10 @@ ****************************************************************************/ #include #include "config.h" -#ifdef TARGET_TREE -#include "hotswap-target.h" -#else +#ifdef HAVE_MMC #include "ata_mmc.h" +#else +#include "hotswap.h" #endif /* helper function to extract n (<=32) bits from an arbitrary position. @@ -44,15 +44,3 @@ unsigned long card_extract_bits( return result; } - -#ifdef TARGET_TREE -bool card_detect(void) -{ - return card_detect_target(); -} - -tCardInfo *card_get_info(int card_no) -{ - return card_get_info_target(card_no); -} -#endif diff --git a/firmware/target/arm/sandisk/ata-c200_e200.c b/firmware/target/arm/sandisk/ata-c200_e200.c index 99a00358ff..8eb4a343f7 100644 --- a/firmware/target/arm/sandisk/ata-c200_e200.c +++ b/firmware/target/arm/sandisk/ata-c200_e200.c @@ -17,7 +17,7 @@ * ****************************************************************************/ #include "fat.h" -#include "hotswap-target.h" +#include "hotswap.h" #include "ata-target.h" #include "ata_idle_notify.h" #include "system.h" @@ -1147,7 +1147,7 @@ void ata_enable(bool on) } #ifdef HAVE_HOTSWAP -void card_enable_monitoring(bool on) +void card_enable_monitoring_target(bool on) { if (on) { diff --git a/firmware/target/arm/sandisk/hotswap-target.h b/firmware/target/arm/sandisk/hotswap-target.h index cab2afe163..c7cd2b8d4f 100644 --- a/firmware/target/arm/sandisk/hotswap-target.h +++ b/firmware/target/arm/sandisk/hotswap-target.h @@ -20,7 +20,6 @@ #define HOTSWAP_TARGET_H #include "inttypes.h" -#include "hotswap.h" typedef struct { @@ -41,5 +40,6 @@ typedef struct tCardInfo *card_get_info_target(int card_no); bool card_detect_target(void); +void card_enable_monitoring_target(bool on); #endif -- cgit v1.2.3