summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire/mpio
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/mpio
parent47d7be5f8b99435683596c0f96d58541584be430 (diff)
downloadrockbox-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')
-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)
48 48
49void usb_enable(bool on) 49void 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}