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) 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); } } |