From aa2989f4d272344062c43fc894a7721efd7f9f8c Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Thu, 10 Feb 2005 23:20:34 +0000 Subject: iRiver: USB support git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5892 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/config-h100.h | 2 +- firmware/mpeg.c | 3 +++ firmware/usb.c | 23 +++++++++++++++++++---- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index c8a7a5c26c..0083842770 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h @@ -48,7 +48,7 @@ /* Offset ( in the firmware file's header ) to the real data */ #define FIRMWARE_OFFSET_FILE_DATA 8 -#define USB_NONE /* FIX: USB temorarily disabled */ +#define USB_IRIVERSTYLE /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 4a1ff52666..954faece94 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c @@ -1995,6 +1995,9 @@ static void mpeg_thread(void) mpeg_stop_done = true; break; default: + /* Tell the USB thread that we are safe */ + DEBUGF("mpeg_thread got SYS_USB_CONNECTED\n"); + usb_acknowledge(SYS_USB_CONNECTED_ACK); break; } } diff --git a/firmware/usb.c b/firmware/usb.c index 327b07d39e..a9ce20e13a 100644 --- a/firmware/usb.c +++ b/firmware/usb.c @@ -116,8 +116,7 @@ static void usb_enable(bool on) or_b(0x08, &PADRL); /* deassert card detect */ } or_b(0x28, &PAIORL); /* output for USB enable and card detect */ -#else /* standard HD Jukebox */ -#ifdef USB_GMINISTYLE +#elif defined(USB_GMINISTYLE) { int i; int smscVer = getSMSCVer(); @@ -144,6 +143,19 @@ static void usb_enable(bool on) } } } +#elif defined(USB_IRIVERSTYLE) + if(on) + { + /* Power on the Cypress chip */ + GPIO_OUT |= 0x01000000; + sleep(2); + } + else + { + /* Power off the Cypress chip */ + GPIO_OUT &= ~0x01000000; + } + #else #ifdef HAVE_LCD_BITMAP if(read_hw_mask() & USB_ACTIVE_HIGH) @@ -159,7 +171,6 @@ static void usb_enable(bool on) } or_b(0x04, &PAIORH); #endif -#endif } static void usb_slave_mode(bool on) @@ -403,7 +414,11 @@ void usb_init(void) countdown = -1; #ifdef IRIVER_H100 - GPIO1_FUNCTION |= 0x80; /* GPIO39 is the USB detect input */ + GPIO_OUT &= ~0x01000000; /* GPIO24 is the Cypress chip power */ + GPIO_ENABLE |= 0x01000000; + GPIO_FUNCTION |= 0x01000000; + + GPIO1_FUNCTION |= 0x00000080; /* GPIO39 is the USB detect input */ #endif usb_enable(false); -- cgit v1.2.3