diff options
| author | Dave Chapman <dave@dchapman.com> | 2009-10-10 15:26:38 +0000 |
|---|---|---|
| committer | Dave Chapman <dave@dchapman.com> | 2009-10-10 15:26:38 +0000 |
| commit | 8c078f34ffc8b20282263a31d8a7e0c8294a848f (patch) | |
| tree | 09e6a3e39eb21b5a5e4d950ff50995a203abffdd | |
| parent | 4ff7666388b58fe06e8de28eb55f54d9bb7afb34 (diff) | |
| download | rockbox-8c078f34ffc8b20282263a31d8a7e0c8294a848f.zip rockbox-8c078f34ffc8b20282263a31d8a7e0c8294a848f.tar.gz rockbox-8c078f34ffc8b20282263a31d8a7e0c8294a848f.tar.bz2 rockbox-8c078f34ffc8b20282263a31d8a7e0c8294a848f.tar.xz | |
Nano2G - reboot into disk mode when USB is inserted.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23070 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/export/config-ipodnano2g.h | 5 | ||||
| -rw-r--r-- | firmware/target/arm/s5l8700/usb-s5l8700.c | 31 |
2 files changed, 25 insertions, 11 deletions
diff --git a/firmware/export/config-ipodnano2g.h b/firmware/export/config-ipodnano2g.h index d9c5cbf..f94584b 100644 --- a/firmware/export/config-ipodnano2g.h +++ b/firmware/export/config-ipodnano2g.h @@ -3,6 +3,8 @@ */ #define TARGET_TREE /* this target is using the target tree system */ +#define IPOD_ARCH 1 + /* For Rolo and boot loader */ #define MODEL_NUMBER 62 @@ -152,6 +154,9 @@ /* USB On-the-go */ //#define CONFIG_USBOTG USBOTG_M5636 +/* We reboot into the OF to handle USB */ +#define USB_HANDLED_BY_OF + /* Define this if you have adjustable CPU frequency */ #define HAVE_ADJUSTABLE_CPU_FREQ diff --git a/firmware/target/arm/s5l8700/usb-s5l8700.c b/firmware/target/arm/s5l8700/usb-s5l8700.c index 6ad4dce..c0bf7a9 100644 --- a/firmware/target/arm/s5l8700/usb-s5l8700.c +++ b/firmware/target/arm/s5l8700/usb-s5l8700.c @@ -20,6 +20,9 @@ ****************************************************************************/ #include "config.h" #include "usb.h" +#include "cpu.h" +#include "system.h" +#include "string.h" void usb_init_device(void) { @@ -27,21 +30,27 @@ void usb_init_device(void) void usb_enable(bool on) { - (void)on; -} - -void usb_attach(void) -{ + /* This device specific code will eventually give way to proper USB + handling, which should be the same for all S5L870x targets. */ + if (on) + { +#ifdef IPOD_ARCH + /* For iPod, we can only do one thing with USB mode atm - reboot + into the flash-based disk-mode. This does not return. */ -} + memcpy((void *)0x0002bf00, "diskmodehotstuff\1\0\0\0", 20); -static bool usb_pin_state(void) -{ - return false; + system_reboot(); /* Reboot */ +#endif + } } -/* detect host or charger (INSERTED or EXTRACTED) */ int usb_detect(void) { - return usb_pin_state() ? USB_INSERTED : USB_EXTRACTED; +#if defined(IPOD_NANO2G) + if ((PDAT14 & 0x8) == 0x0) + return USB_INSERTED; +#endif + + return USB_EXTRACTED; } |