diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-07-03 14:16:20 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-07-03 14:16:20 +0000 |
commit | d5ce38c7b8cc0e326687e1f12494c8657f09e975 (patch) | |
tree | b67024e90fc27593e58dd8cbff17fb29b4b13e29 | |
parent | cd890a5e5e69f4e8698779c6b2ccebad04748533 (diff) | |
download | rockbox-d5ce38c7b8cc0e326687e1f12494c8657f09e975.tar.gz rockbox-d5ce38c7b8cc0e326687e1f12494c8657f09e975.zip |
Lame attempt to fix USB polarity auto-detection
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1321 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/usb.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/firmware/usb.c b/firmware/usb.c index 2e118e176c..1e45cd34b8 100644 --- a/firmware/usb.c +++ b/firmware/usb.c | |||
@@ -60,14 +60,14 @@ static char usb_stack[0x800]; | |||
60 | static struct event_queue usb_queue; | 60 | static struct event_queue usb_queue; |
61 | static bool last_usb_status; | 61 | static bool last_usb_status; |
62 | static bool usb_monitor_enabled; | 62 | static bool usb_monitor_enabled; |
63 | static bool usb_inverted; | ||
63 | 64 | ||
64 | static void usb_enable(bool on) | 65 | static void usb_enable(bool on) |
65 | { | 66 | { |
66 | #ifdef ARCHOS_RECORDER | 67 | if(usb_inverted) |
67 | if(!on) /* The pin is inverted on the Recorder */ | 68 | on = !on; |
68 | #else | 69 | |
69 | if(on) | 70 | if(on) |
70 | #endif | ||
71 | PADR &= ~0x400; /* enable USB */ | 71 | PADR &= ~0x400; /* enable USB */ |
72 | else | 72 | else |
73 | PADR |= 0x400; | 73 | PADR |= 0x400; |
@@ -252,7 +252,14 @@ void usb_init(void) | |||
252 | usb_state = USB_EXTRACTED; | 252 | usb_state = USB_EXTRACTED; |
253 | usb_monitor_enabled = false; | 253 | usb_monitor_enabled = false; |
254 | countdown = -1; | 254 | countdown = -1; |
255 | 255 | ||
256 | /* This is lame. Really lame. We determine the polarity of the USB | ||
257 | enable pin by checking how it is set by the Archos firmware. */ | ||
258 | if(PADR & 0x400) | ||
259 | usb_inverted = false; | ||
260 | else | ||
261 | usb_inverted = true; | ||
262 | |||
256 | usb_enable(false); | 263 | usb_enable(false); |
257 | 264 | ||
258 | /* We assume that the USB cable is extracted */ | 265 | /* We assume that the USB cable is extracted */ |