diff options
author | Jens Arnold <amiconn@rockbox.org> | 2004-10-10 19:51:11 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2004-10-10 19:51:11 +0000 |
commit | 5789ee99286a487e1764bd9b52562e1a79b5d4e7 (patch) | |
tree | e4a9eb64f5b8f58def41faa2e123e553b2bdf5d8 /firmware/drivers | |
parent | 120d863c68a6c4489357f1ae11db3e96a0124ded (diff) | |
download | rockbox-5789ee99286a487e1764bd9b52562e1a79b5d4e7.tar.gz rockbox-5789ee99286a487e1764bd9b52562e1a79b5d4e7.zip |
MMC hotswap handling in USB mode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5247 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/ata_mmc.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c index 7b3b8d1ea8..faa4c1f187 100644 --- a/firmware/drivers/ata_mmc.c +++ b/firmware/drivers/ata_mmc.c | |||
@@ -135,18 +135,21 @@ static void swapcopy_sector(const unsigned char *buf); | |||
135 | static int send_sector(const unsigned char *nextbuf, int timeout); | 135 | static int send_sector(const unsigned char *nextbuf, int timeout); |
136 | static int send_single_sector(const unsigned char *buf, int timeout); | 136 | static int send_single_sector(const unsigned char *buf, int timeout); |
137 | 137 | ||
138 | static bool mmc_detect(void); | ||
139 | static void mmc_tick(void); | 138 | static void mmc_tick(void); |
140 | 139 | ||
141 | /* implementation */ | 140 | /* implementation */ |
142 | 141 | ||
143 | static int select_card(int card_no) | 142 | void mmc_select_clock(int card_no) |
144 | { | 143 | { |
145 | if (card_no == 0) /* internal */ | 144 | if (card_no == 0) /* internal */ |
146 | or_b(0x10, &PADRH); /* set clock gate PA12 CHECKME: mask? */ | 145 | or_b(0x10, &PADRH); /* set clock gate PA12 CHECKME: mask? */ |
147 | else /* external */ | 146 | else /* external */ |
148 | and_b(~0x10, &PADRH); /* clear clock gate PA12 CHECKME: mask?*/ | 147 | and_b(~0x10, &PADRH); /* clear clock gate PA12 CHECKME: mask?*/ |
149 | 148 | } | |
149 | |||
150 | static int select_card(int card_no) | ||
151 | { | ||
152 | mmc_select_clock(card_no); | ||
150 | last_disk_activity = current_tick; | 153 | last_disk_activity = current_tick; |
151 | 154 | ||
152 | if (!card_info[card_no].initialized) | 155 | if (!card_info[card_no].initialized) |
@@ -760,7 +763,7 @@ void ata_spin(void) | |||
760 | { | 763 | { |
761 | } | 764 | } |
762 | 765 | ||
763 | static bool mmc_detect(void) | 766 | bool mmc_detect(void) |
764 | { | 767 | { |
765 | return adc_read(ADC_MMC_SWITCH) < 0x200 ? true : false; | 768 | return adc_read(ADC_MMC_SWITCH) < 0x200 ? true : false; |
766 | } | 769 | } |