Better handling of non-responding threads
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1281 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a550b07886
commit
53b8c99521
1 changed files with 111 additions and 99 deletions
|
@ -38,6 +38,8 @@
|
|||
#define USB_INSERTED 1
|
||||
#define USB_EXTRACTED 2
|
||||
|
||||
static int usb_state;
|
||||
|
||||
static char usb_stack[0x100];
|
||||
static struct event_queue usb_queue;
|
||||
static bool last_usb_status;
|
||||
|
@ -126,6 +128,8 @@ static void usb_thread(void)
|
|||
DEBUGF("All threads have acknowledged. Continuing...\n");
|
||||
#ifdef USB_REALLY_BRAVE
|
||||
usb_slave_mode(true);
|
||||
usb_state = USB_INSERTED;
|
||||
usb_display_info();
|
||||
#else
|
||||
system_reboot();
|
||||
#endif
|
||||
|
@ -138,8 +142,15 @@ static void usb_thread(void)
|
|||
break;
|
||||
|
||||
case USB_EXTRACTED:
|
||||
/* First disable the USB mode */
|
||||
if(usb_state == USB_INSERTED)
|
||||
{
|
||||
/* Only disable the USB mode if we really have enabled it
|
||||
some threads might not have acknowledged the
|
||||
insertion */
|
||||
usb_slave_mode(false);
|
||||
}
|
||||
|
||||
usb_state = USB_EXTRACTED;
|
||||
|
||||
/* Tell all threads that we are back in business */
|
||||
num_acks_to_expect =
|
||||
|
@ -199,6 +210,7 @@ void usb_acknowledge(int id)
|
|||
|
||||
void usb_init(void)
|
||||
{
|
||||
usb_state = USB_EXTRACTED;
|
||||
usb_monitor_enabled = false;
|
||||
|
||||
usb_enable(false);
|
||||
|
|
Loading…
Reference in a new issue