summaryrefslogtreecommitdiffstats
path: root/firmware/target/coldfire
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2010-07-17 11:38:47 +0000
committerMarcin Bukat <marcin.bukat@gmail.com>2010-07-17 11:38:47 +0000
commit59ded69c96e3304db3699d6f0d611dfbfcf93a0c (patch)
treead48e1cbae021015e4d90802c5e66a64ef1c2f33 /firmware/target/coldfire
parent47d7be5f8b99435683596c0f96d58541584be430 (diff)
downloadrockbox-59ded69c96e3304db3699d6f0d611dfbfcf93a0c.tar.gz
rockbox-59ded69c96e3304db3699d6f0d611dfbfcf93a0c.tar.bz2
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')
-rw-r--r--firmware/target/coldfire/mpio/hd200/usb-hd200.c7
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)
void usb_enable(bool on)
{
+ /* one second timeout */
+ unsigned char timeout = 10;
if(on)
{
@@ -64,7 +66,10 @@ void usb_enable(bool on)
and_l(~(1<<4),&GPIO1_OUT); /* GPIO36 low */
- while ( !(GPIO1_READ & (1<<5)) ) {}
+ while ( !(GPIO1_READ & (1<<5)) && timeout--)
+ {
+ sleep(HZ/10);
+ }
sleep(HZ);
}
}