From 00be7469d6bd0810cfa65f4b935da5db6fac09d4 Mon Sep 17 00:00:00 2001 From: Jörg Hohensohn Date: Sat, 11 Sep 2004 09:06:58 +0000 Subject: prepared Ondio USB passthrough (but doesn't work yet) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5066 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/ata.c | 2 +- firmware/drivers/ata_mmc.c | 19 +++++++++++++++++-- firmware/export/adc.h | 3 +-- firmware/usb.c | 4 ++-- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 21d97aa939..af6955b2b0 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 a3669573e0..7ce1547085 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 cbc40e2662..966714cbbd 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 1b9e747dc9..6b226bd43b 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) { -- cgit v1.2.3