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
This commit is contained in:
Marcin Bukat 2010-07-17 11:38:47 +00:00
parent 47d7be5f8b
commit 59ded69c96

View file

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