summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-12-06 10:06:40 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-12-06 10:06:40 +0000
commit55e9670c702cbb13895c74a3b0ac32122e5b518f (patch)
tree4e3e0602b67eb3ba5c7c38f42ed8895f08959a57
parentc9016f82e02470ea0f282d676742044ff0851e97 (diff)
downloadrockbox-55e9670c702cbb13895c74a3b0ac32122e5b518f.zip
rockbox-55e9670c702cbb13895c74a3b0ac32122e5b518f.tar.gz
rockbox-55e9670c702cbb13895c74a3b0ac32122e5b518f.tar.bz2
rockbox-55e9670c702cbb13895c74a3b0ac32122e5b518f.tar.xz
USB support for H300
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8167 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/main.c5
-rw-r--r--firmware/usb.c34
2 files changed, 28 insertions, 11 deletions
diff --git a/apps/main.c b/apps/main.c
index a0cab20..7bde823 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -235,9 +235,7 @@ void init(void)
adc_init();
-#ifndef IRIVER_H300_SERIES
usb_init();
-#endif
backlight_init();
@@ -285,7 +283,6 @@ void init(void)
panicf("ata: %d", rc);
}
-#ifndef IRIVER_H300_SERIES
usb_start_monitoring();
while (usb_detect())
{ /* enter USB mode early, before trying to mount */
@@ -302,7 +299,7 @@ void init(void)
break;
#endif
}
-#endif
+
if (!mounted)
{
rc = disk_mount_all();
diff --git a/firmware/usb.c b/firmware/usb.c
index fd92f85..8f9de11 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -136,13 +136,21 @@ static void usb_enable(bool on)
if(on)
{
/* Power on the Cypress chip */
- or_l(0x01000000, &GPIO_OUT);
+#ifdef IRIVER_H100_SERIES
+ or_l(0x01000040, &GPIO_OUT);
+#else
+ and_l(~0x00000008,&GPIO1_OUT);
+#endif
sleep(2);
}
else
{
/* Power off the Cypress chip */
- and_l(~0x01000000, &GPIO_OUT);
+#ifdef IRIVER_H100_SERIES
+ and_l(~0x01000040, &GPIO_OUT);
+#else
+ or_l(0x00000008,&GPIO1_OUT);
+#endif
}
#elif defined(USB_IPODSTYLE)
@@ -361,7 +369,7 @@ bool usb_detect(void)
#endif
#ifdef IRIVER_H300
/* TODO: add proper code code for H300 USB style */
- current_status = false;
+ current_status = (GPIO1_READ & 0x80)?true:false;
#endif
#ifdef USB_IPODSTYLE
/* TODO: Implement USB_IPODSTYLE */
@@ -436,11 +444,23 @@ void usb_init(void)
countdown = -1;
#ifdef USB_IRIVERSTYLE
- and_l(~0x01000000, &GPIO_OUT); /* GPIO24 is the Cypress chip power */
- or_l(0x01000000, &GPIO_ENABLE);
- or_l(0x01000000, &GPIO_FUNCTION);
-
or_l(0x00000080, &GPIO1_FUNCTION); /* GPIO39 is the USB detect input */
+
+#ifdef IRIVER_H300_SERIES
+ /* ISD300 3.3V ON */
+ or_l(8,&GPIO1_FUNCTION);
+ or_l(8,&GPIO1_OUT);
+ or_l(8,&GPIO1_ENABLE);
+
+ /* Tristate the SCK/SDA to the ISD300 config EEPROM */
+ and_l(~0x03000000, &GPIO_ENABLE);
+ or_l(0x03000000, &GPIO_FUNCTION);
+#else
+ and_l(~0x01000040, &GPIO_OUT); /* GPIO24 is the Cypress chip power */
+ or_l(0x01000040, &GPIO_ENABLE);
+ or_l(0x01000040, &GPIO_FUNCTION);
+#endif
+
#endif
usb_enable(false);