summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2004-09-11 09:06:58 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2004-09-11 09:06:58 +0000
commit00be7469d6bd0810cfa65f4b935da5db6fac09d4 (patch)
treebf7b43a7c188906eec01d499a9f597dc6001e854
parent57ea92cae1f4d0f28b453e0caf68977c599cc096 (diff)
downloadrockbox-00be7469d6bd0810cfa65f4b935da5db6fac09d4.zip
rockbox-00be7469d6bd0810cfa65f4b935da5db6fac09d4.tar.gz
rockbox-00be7469d6bd0810cfa65f4b935da5db6fac09d4.tar.bz2
rockbox-00be7469d6bd0810cfa65f4b935da5db6fac09d4.tar.xz
prepared Ondio USB passthrough (but doesn't work yet)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5066 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/ata.c2
-rw-r--r--firmware/drivers/ata_mmc.c19
-rw-r--r--firmware/export/adc.h3
-rw-r--r--firmware/usb.c4
4 files changed, 21 insertions, 7 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 21d97aa..af6955b 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -1174,4 +1174,4 @@ int ata_init(void)
return 0;
}
-#endif /* #ifndef HAVE_MMC */ \ No newline at end of file
+#endif /* #ifndef HAVE_MMC */
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c
index a366957..7ce1547 100644
--- a/firmware/drivers/ata_mmc.c
+++ b/firmware/drivers/ata_mmc.c
@@ -29,6 +29,7 @@
#include "power.h"
#include "string.h"
#include "hwcompat.h"
+#include "adc.h"
/* use file for an MMC-based system, FIXME in makefile */
#ifdef HAVE_MMC
@@ -257,9 +258,23 @@ int ata_init(void)
led(false);
- /* ToDo: Port setup */
- // PAIOR |= 0x1680;
+ /* Port setup */
+ PADR |= 0x1600; /* set all the selects high (=inactive) */
+ PAIOR |= 0x1600; /* make outputs for them */
+ PAIOR &= ~0x0008; /* input for card detect */
+ /* serial setup */
+ PBCR1 &= ~0x0CF0; /* use PB10, PB11, PB13 */
+ PBCR1 |= 0x08A0; /* as RxD1, TxD1, SCK1 */
+
+ if(adc_read(ADC_MMC_SWITCH) < 0x200)
+ { /* MMC inserted */
+ PADR |= 0x0200;
+ }
+ else
+ { /* no MMC, use internal memory */
+ PADR |= 0x0400;
+ }
sleeping = false;
ata_enable(true);
diff --git a/firmware/export/adc.h b/firmware/export/adc.h
index cbc40e2..966714c 100644
--- a/firmware/export/adc.h
+++ b/firmware/export/adc.h
@@ -23,8 +23,7 @@
#ifdef HAVE_ONDIO_ADC
-#define ADC_MMC_SWITCH 0 /* Battery voltage always reads 0x3FF due to
- silly scaling */
+#define ADC_MMC_SWITCH 0 /* low values if MMC inserted */
#define ADC_USB_POWER 1 /* USB, reads 0x000 when USB is inserted */
#define ADC_BUTTON_OPTION 2 /* the option button, low value if pressed */
#define ADC_BUTTON_ONOFF 3 /* the on/off button, high value if pressed */
diff --git a/firmware/usb.c b/firmware/usb.c
index 1b9e747..6b226bd 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -84,9 +84,9 @@ static void usb_enable(bool on)
}
else
{
- and_b(~0x20, &PADRL);
+ and_b(~0x20, &PADRL); /* disable USB */
}
- or_b(0x20, &PAIORL);
+ or_b(0x20, &PAIORL); /* output for USB enable */
#else /* standard HD Jukebox */
if(on)
{