diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2010-07-17 11:38:47 +0000 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2010-07-17 11:38:47 +0000 |
commit | 59ded69c96e3304db3699d6f0d611dfbfcf93a0c (patch) | |
tree | ad48e1cbae021015e4d90802c5e66a64ef1c2f33 /firmware/target/coldfire/mpio/hd200/usb-hd200.c | |
parent | 47d7be5f8b99435683596c0f96d58541584be430 (diff) | |
download | rockbox-59ded69c96e3304db3699d6f0d611dfbfcf93a0c.tar.gz rockbox-59ded69c96e3304db3699d6f0d611dfbfcf93a0c.zip |
HD200: Add timeout in usb_enable(false) to prevent infinite loop when something goes wrong.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27468 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire/mpio/hd200/usb-hd200.c')
-rw-r--r-- | firmware/target/coldfire/mpio/hd200/usb-hd200.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/firmware/target/coldfire/mpio/hd200/usb-hd200.c b/firmware/target/coldfire/mpio/hd200/usb-hd200.c index 9a82359966..9717ef3205 100644 --- a/firmware/target/coldfire/mpio/hd200/usb-hd200.c +++ b/firmware/target/coldfire/mpio/hd200/usb-hd200.c | |||
@@ -48,6 +48,8 @@ int usb_detect(void) | |||
48 | 48 | ||
49 | void usb_enable(bool on) | 49 | void usb_enable(bool on) |
50 | { | 50 | { |
51 | /* one second timeout */ | ||
52 | unsigned char timeout = 10; | ||
51 | 53 | ||
52 | if(on) | 54 | if(on) |
53 | { | 55 | { |
@@ -64,7 +66,10 @@ void usb_enable(bool on) | |||
64 | 66 | ||
65 | and_l(~(1<<4),&GPIO1_OUT); /* GPIO36 low */ | 67 | and_l(~(1<<4),&GPIO1_OUT); /* GPIO36 low */ |
66 | 68 | ||
67 | while ( !(GPIO1_READ & (1<<5)) ) {} | 69 | while ( !(GPIO1_READ & (1<<5)) && timeout--) |
70 | { | ||
71 | sleep(HZ/10); | ||
72 | } | ||
68 | sleep(HZ); | 73 | sleep(HZ); |
69 | } | 74 | } |
70 | } | 75 | } |