Fix issues with iPod nano 2G displays reported on the forums. The voltage supply...
[kugel-rb.git] / firmware / usb.c
blobaada27dfd9e3877005f2003fe4eeef2ba31aae90
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
12 * iPod driver based on code from the ipodlinux project - http://ipodlinux.org
13 * Adapted for Rockbox in January 2006
14 * Original file: podzilla/usb.c
15 * Copyright (C) 2005 Adam Johnston
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version 2
20 * of the License, or (at your option) any later version.
22 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
23 * KIND, either express or implied.
25 ****************************************************************************/
26 #include "config.h"
27 #include "cpu.h"
28 #include "kernel.h"
29 #include "thread.h"
30 #include "system.h"
31 #include "debug.h"
32 #include "storage.h"
33 #include "fat.h"
34 #include "disk.h"
35 #include "panic.h"
36 #include "lcd.h"
37 #include "usb-target.h"
38 #include "usb.h"
39 #include "button.h"
40 #include "string.h"
41 #ifdef HAVE_USBSTACK
42 #include "usb_core.h"
43 #endif
44 #include "logf.h"
45 #include "screendump.h"
47 /* Conditions under which we want the entire driver */
48 #if !defined(BOOTLOADER) || (CONFIG_CPU == SH7034) || \
49 (defined(HAVE_USBSTACK) && defined(HAVE_BOOTLOADER_USB_MODE)) || \
50 (defined(HAVE_USBSTACK) && (defined(CREATIVE_ZVx))) || \
51 (defined(HAVE_USBSTACK) && (defined(OLYMPUS_MROBE_500))) || \
52 (defined(HAVE_USBSTACK) && (defined(IPOD_NANO2G))) || \
53 defined(CPU_TCC77X) || defined(CPU_TCC780X) || \
54 (CONFIG_USBOTG == USBOTG_JZ4740) || \
55 (defined(USE_ROCKBOX_USB) && CONFIG_USBOTG == USBOTG_AS3525) || \
56 (defined(USE_ROCKBOX_USB) && CONFIG_USBOTG == USBOTG_AS3525v2)
57 #define USB_FULL_INIT
58 #endif
60 #if defined(USB_DETECT_BY_DRV) || defined(USB_DETECT_BY_CORE)
61 /* These aren't treated differently here */
62 #define USB_DELAYED_INSERT
63 #endif
65 #ifdef HAVE_LCD_BITMAP
66 bool do_screendump_instead_of_usb = false;
67 #endif
69 #if !defined(SIMULATOR) && !defined(USB_NONE)
71 /* We assume that the USB cable is extracted */
72 static int usb_state = USB_EXTRACTED;
74 #if (CONFIG_STORAGE & STORAGE_MMC) && defined(USB_FULL_INIT)
75 static int usb_mmc_countdown = 0;
76 #endif
78 /* Make sure there's enough stack space for screendump */
79 #ifdef USB_FULL_INIT
80 static long usb_stack[(DEFAULT_STACK_SIZE + DUMP_BMP_LINESIZE)/sizeof(long)];
81 static const char usb_thread_name[] = "usb";
82 static unsigned int usb_thread_entry = 0;
83 static bool usb_monitor_enabled = false;
84 #endif /* USB_FULL_INIT */
85 static struct event_queue usb_queue SHAREDBSS_ATTR;
86 static bool exclusive_storage_access = false;
87 #ifdef USB_ENABLE_HID
88 static bool usb_hid = true;
89 #endif
91 #ifdef USB_FULL_INIT
93 #if defined(USB_FIREWIRE_HANDLING) \
94 || (defined(HAVE_USBSTACK) && !defined(USE_ROCKBOX_USB))
95 static void try_reboot(void)
97 #ifdef HAVE_DISK_STORAGE
98 storage_sleepnow(); /* Immediately spindown the disk. */
99 sleep(HZ*2);
100 #endif
102 #ifdef IPOD_ARCH /* The following code is based on ipodlinux */
103 #if CONFIG_CPU == PP5020
104 memcpy((void *)0x40017f00, "diskmode\0\0hotstuff\0\0\1", 21);
105 #elif CONFIG_CPU == PP5022
106 memcpy((void *)0x4001ff00, "diskmode\0\0hotstuff\0\0\1", 21);
107 #endif /* CONFIG_CPU */
108 #endif /* IPOD_ARCH */
110 #ifdef IPOD_NANO2G
111 memcpy((void *)0x0002bf00, "diskmodehotstuff\1\0\0\0", 20);
112 #endif
114 system_reboot(); /* Reboot */
116 #endif /* USB_FIRWIRE_HANDLING || (HAVE_USBSTACK && !USE_ROCKBOX_USB) */
119 #ifdef HAVE_LCD_BITMAP
120 static inline bool usb_do_screendump(void)
122 if(do_screendump_instead_of_usb)
124 usb_state = USB_SCREENDUMP;
125 screen_dump();
126 #ifdef HAVE_REMOTE_LCD
127 remote_screen_dump();
128 #endif
129 return true;
132 return false;
134 #else /* !HAVE_LCD_BITMAP */
135 static inline bool usb_do_screendump(void)
137 return false;
139 #endif /* HAVE_LCD_BITMAP */
142 #ifdef HAVE_USBSTACK
144 #ifdef HAVE_HOTSWAP
145 static inline void usb_handle_hotswap(long id)
147 switch(id)
149 case SYS_HOTSWAP_INSERTED:
150 case SYS_HOTSWAP_EXTRACTED:
151 usb_core_hotswap_event(1, id == SYS_HOTSWAP_INSERTED);
152 break;
154 /* Note: No MMC storage handling is needed with the stack atm. */
156 #endif /* HAVE_HOTSWAP */
158 static inline bool usb_configure_drivers(int for_state)
160 switch(for_state)
162 case USB_POWERED:
163 #ifdef USB_ENABLE_STORAGE
164 usb_core_enable_driver(USB_DRIVER_MASS_STORAGE, false);
165 #endif
166 #ifdef USB_ENABLE_HID
167 #ifdef USB_ENABLE_CHARGING_ONLY
168 usb_core_enable_driver(USB_DRIVER_HID, false);
169 #else
170 usb_core_enable_driver(USB_DRIVER_HID, true);
171 #endif /* USB_ENABLE_CHARGING_ONLY */
172 #endif /* USB_ENABLE_HID */
174 #ifdef USB_ENABLE_CHARGING_ONLY
175 usb_core_enable_driver(USB_DRIVER_CHARGING_ONLY, true);
176 #endif
177 exclusive_storage_access = false;
179 usb_attach(); /* Powered only: attach now. */
180 break;
181 /* USB_POWERED: */
183 case USB_INSERTED:
184 #ifdef USB_ENABLE_STORAGE
185 usb_core_enable_driver(USB_DRIVER_MASS_STORAGE, true);
186 #endif
187 #ifdef USB_ENABLE_HID
188 usb_core_enable_driver(USB_DRIVER_HID, usb_hid);
189 #endif
190 #ifdef USB_ENABLE_CHARGING_ONLY
191 usb_core_enable_driver(USB_DRIVER_CHARGING_ONLY, false);
192 #endif
193 /* Check any drivers enabled at this point for exclusive storage
194 * access requirements. */
195 exclusive_storage_access = usb_core_any_exclusive_storage();
197 if(exclusive_storage_access)
198 return true;
200 usb_attach(); /* Not exclusive: attach now. */
201 break;
202 /* USB_INSERTED: */
204 case USB_EXTRACTED:
205 if(exclusive_storage_access)
206 usb_release_exclusive_storage();
207 break;
208 /* USB_EXTRACTED: */
211 return false;
214 #ifdef USE_ROCKBOX_USB
215 static inline void usb_slave_mode(bool on)
217 int rc;
219 if(on)
221 trigger_cpu_boost();
222 #ifdef HAVE_PRIORITY_SCHEDULING
223 thread_set_priority(thread_self(), PRIORITY_REALTIME);
224 #endif
225 disk_unmount_all();
226 usb_attach();
228 else /* usb_state == USB_INSERTED (only!) */
230 usb_enable(false);
231 #ifdef HAVE_PRIORITY_SCHEDULING
232 thread_set_priority(thread_self(), PRIORITY_SYSTEM);
233 #endif
234 /* Entered exclusive mode */
235 rc = disk_mount_all();
236 if(rc <= 0) /* no partition */
237 panicf("mount: %d",rc);
239 cancel_cpu_boost();
242 #else /* !USB_ROCKBOX_USB */
243 static inline void usb_slave_mode(bool on)
245 if(on)
247 /* until we have native mass-storage mode, we want to reboot on
248 usb host connect */
249 try_reboot();
252 #endif /* USE_ROCKBOX_USB */
254 void usb_signal_transfer_completion(
255 struct usb_transfer_completion_event_data* event_data)
257 queue_post(&usb_queue, USB_TRANSFER_COMPLETION, (intptr_t)event_data);
260 #else /* !HAVE_USBSTACK */
262 #ifdef HAVE_HOTSWAP
263 static inline void usb_handle_hotswap(long id)
265 #if (CONFIG_STORAGE & STORAGE_MMC)
266 switch(id)
268 case SYS_HOTSWAP_INSERTED:
269 case SYS_HOTSWAP_EXTRACTED:
270 if(usb_state == USB_INSERTED)
272 usb_enable(false);
273 usb_mmc_countdown = HZ/2; /* re-enable after 0.5 sec */
275 break;
276 case USB_REENABLE:
277 if(usb_state == USB_INSERTED)
278 usb_enable(true); /* reenable only if still inserted */
279 break;
281 #endif /* STORAGE_MMC */
282 (void)id;
284 #endif /* HAVE_HOTSWAP */
286 static inline bool usb_configure_drivers(int for_state)
288 switch(for_state)
290 case USB_POWERED:
291 exclusive_storage_access = false;
292 break;
293 case USB_INSERTED:
294 exclusive_storage_access = true;
295 return true;
296 case USB_EXTRACTED:
297 if(exclusive_storage_access)
298 usb_release_exclusive_storage();
299 break;
302 return false;
305 static inline void usb_slave_mode(bool on)
307 int rc;
309 if(on)
311 DEBUGF("Entering USB slave mode\n");
312 disk_unmount_all();
313 storage_soft_reset();
314 storage_init();
315 storage_enable(false);
316 usb_enable(true);
317 cpu_idle_mode(true);
319 else
321 DEBUGF("Leaving USB slave mode\n");
323 cpu_idle_mode(false);
325 /* Let the ISDx00 settle */
326 sleep(HZ*1);
328 usb_enable(false);
330 rc = storage_init();
331 if(rc)
332 panicf("storage: %d",rc);
334 rc = disk_mount_all();
335 if(rc <= 0) /* no partition */
336 panicf("mount: %d",rc);
339 #endif /* HAVE_USBSTACK */
341 #ifdef HAVE_USB_POWER
342 static inline bool usb_power_button(void)
344 #if (defined(IRIVER_H10) || defined (IRIVER_H10_5GB)) && !defined(USE_ROCKBOX_USB)
345 return (button_status() & ~USBPOWER_BTN_IGNORE) != USBPOWER_BUTTON;
346 #else
347 return (button_status() & ~USBPOWER_BTN_IGNORE) == USBPOWER_BUTTON;
348 #endif
351 #ifdef USB_FIREWIRE_HANDLING
352 static inline bool usb_reboot_button(void)
354 return (button_status() & ~USBPOWER_BTN_IGNORE) != USBPOWER_BUTTON;
356 #endif
357 #else /* !HAVE_USB_POWER */
358 static inline bool usb_power_button(void)
360 return false;
363 #ifdef USB_FIREWIRE_HANDLING
364 static inline bool usb_reboot_button(void)
366 return false;
368 #endif
369 #endif /* HAVE_USB_POWER */
371 #ifndef USB_DRIVER_CLOSE
372 static void usb_thread(void) NORETURN_ATTR;
373 #endif
374 static void usb_thread(void)
376 #ifdef USB_DELAYED_INSERT
377 bool host_detected = false;
378 #endif
379 int num_acks_to_expect = 0;
380 long last_broadcast_tick = current_tick;
381 struct queue_event ev;
383 while(1)
385 queue_wait(&usb_queue, &ev);
386 switch(ev.id)
388 /*** Main USB thread duties ***/
390 #ifdef HAVE_USBSTACK
391 case USB_TRANSFER_COMPLETION:
392 usb_core_handle_transfer_completion(
393 (struct usb_transfer_completion_event_data*)ev.data);
394 break;
395 #endif /* HAVE_USBSTACK */
397 case USB_INSERTED:
398 #ifdef USB_DELAYED_INSERT
399 if(usb_state != USB_POWERED)
400 break;
402 if (host_detected)
403 break; /* Drivers configured but we're still USB_POWERED */
405 host_detected = true;
406 #else /* !USB_DELAYED_INSERT */
407 if(usb_state != USB_EXTRACTED)
408 break;
410 if(usb_do_screendump())
411 break;
413 usb_state = USB_POWERED;
414 #endif /* USB_DELAYED_INSERT */
416 if(usb_power_button())
418 /* Only charging is desired */
419 usb_configure_drivers(USB_POWERED);
420 break;
423 if(!usb_configure_drivers(USB_INSERTED))
424 break; /* Exclusive storage access not required */
426 /* Tell all threads that they have to back off the storage.
427 We subtract one for our own thread. Expect an ACK for every
428 listener for each broadcast they received. If it has been too
429 long, the user might have entered a screen that didn't ACK
430 when inserting the cable, such as a debugging screen. In that
431 case, reset the count or else USB would be locked out until
432 rebooting because it most likely won't ever come. Simply
433 resetting to the most recent broadcast count is racy. */
434 if(TIME_AFTER(current_tick, last_broadcast_tick + HZ*5))
436 num_acks_to_expect = 0;
437 last_broadcast_tick = current_tick;
440 num_acks_to_expect += queue_broadcast(SYS_USB_CONNECTED, 0) - 1;
441 DEBUGF("USB inserted. Waiting for %d acks...\n",
442 num_acks_to_expect);
444 /* Leave the state as USB_POWERED until the expected number of
445 ACKS are received. */
446 break;
447 /* USB_INSERTED: */
449 case SYS_USB_CONNECTED_ACK:
450 if(num_acks_to_expect > 0 && --num_acks_to_expect == 0)
452 DEBUGF("All threads have acknowledged the connect.\n");
453 if(usb_state == USB_POWERED)
455 usb_slave_mode(true);
456 usb_state = USB_INSERTED;
459 else
461 DEBUGF("usb: got ack, %d to go...\n",
462 num_acks_to_expect);
464 break;
465 /* SYS_USB_CONNECTED_ACK */
467 #ifdef USB_DELAYED_INSERT
468 /* In this case, these events handle cable insertion. USB driver or
469 core determines USB_INSERTED. */
470 case USB_POWERED:
471 if(usb_state != USB_EXTRACTED)
472 break;
474 if(usb_do_screendump())
475 break;
477 usb_state = USB_POWERED;
478 usb_enable(true);
479 break;
480 /* USB_POWERED: */
482 case USB_UNPOWERED:
483 if(usb_state == USB_POWERED)
484 usb_enable(false);
485 /* Fall-through - other legal states can be USB_INSERTED or
486 USB_SCREENDUMP */
487 #endif /* USB_DELAYED_INSERT */
488 case USB_EXTRACTED:
489 if(usb_state == USB_EXTRACTED)
490 break;
492 /* Only disable the USB slave mode if we really have enabled
493 it. Some expected acks may not have been received. */
494 if(usb_state == USB_INSERTED)
495 usb_slave_mode(false);
497 usb_state = USB_EXTRACTED;
499 /* Ok to broadcast disconnect now */
500 usb_configure_drivers(USB_EXTRACTED);
501 #ifdef USB_DELAYED_INSERT
502 host_detected = false;
503 #endif
504 break;
505 /* USB_UNPOWERED: USB_EXTRACTED: */
507 /*** Miscellaneous USB thread duties ***/
509 /* HOTSWAP */
510 #ifdef HAVE_HOTSWAP
511 case SYS_HOTSWAP_INSERTED:
512 case SYS_HOTSWAP_EXTRACTED:
513 #if (CONFIG_STORAGE & STORAGE_MMC)
514 case USB_REENABLE:
515 #endif
516 usb_handle_hotswap(ev.id);
517 #endif
519 /* FIREWIRE */
520 #ifdef USB_FIREWIRE_HANDLING
521 case USB_REQUEST_REBOOT:
522 if(usb_reboot_button())
523 try_reboot();
524 break;
525 #endif
527 /* CHARGING */
528 #if defined(HAVE_USB_CHARGING_ENABLE) && defined(HAVE_USBSTACK)
529 case USB_CHARGER_UPDATE:
530 usb_charging_maxcurrent_change(usb_charging_maxcurrent());
531 break;
532 #endif
534 /* CLOSE */
535 #ifdef USB_DRIVER_CLOSE
536 case USB_QUIT:
537 return;
538 #endif
539 } /* switch */
540 } /* while */
543 #if defined(HAVE_USB_CHARGING_ENABLE) && defined(HAVE_USBSTACK)
544 void usb_charger_update(void)
546 queue_post(&usb_queue, USB_CHARGER_UPDATE, 0);
548 #endif
550 #ifdef USB_STATUS_BY_EVENT
551 void usb_status_event(int current_status)
553 /* Caller isn't expected to filter for changes in status.
554 * current_status:
555 * USB_DETECT_BY_DRV/CORE: USB_POWERED, USB_UNPOWERED,
556 USB_INSERTED (driver/core)
557 * else: USB_INSERTED, USB_EXTRACTED
559 if(usb_monitor_enabled)
561 int oldstatus = disable_irq_save(); /* Dual-use function */
562 queue_remove_from_head(&usb_queue, current_status);
563 queue_post(&usb_queue, current_status, 0);
564 restore_irq(oldstatus);
568 void usb_start_monitoring(void)
570 int oldstatus = disable_irq_save(); /* Sync to event */
571 int status = usb_detect();
573 usb_monitor_enabled = true;
575 /* An event may have been missed because it was sent before monitoring
576 * was enabled due to the connector already having been inserted before
577 * before or during boot. */
578 #ifdef USB_DELAYED_INSERT
579 /* Filter the status - USB_INSERTED may happen later */
580 status = (status == USB_EXTRACTED) ? USB_UNPOWERED : USB_POWERED;
581 #endif
582 usb_status_event(status);
584 #ifdef USB_FIREWIRE_HANDLING
585 if(firewire_detect())
586 usb_firewire_connect_event();
587 #endif
589 restore_irq(oldstatus);
592 #ifdef USB_FIREWIRE_HANDLING
593 void usb_firewire_connect_event(void)
595 queue_post(&usb_queue, USB_REQUEST_REBOOT, 0);
597 #endif /* USB_FIREWIRE_HANDLING */
599 #else /* !USB_STATUS_BY_EVENT */
601 static void usb_tick(void)
603 #define NUM_POLL_READINGS (HZ/5)
604 static int usb_countdown = -1;
605 static int last_usb_status = USB_EXTRACTED;
606 #ifdef USB_FIREWIRE_HANDLING
607 static int firewire_countdown = -1;
608 static int last_firewire_status = false;
609 #endif
611 if(usb_monitor_enabled)
613 #ifdef USB_FIREWIRE_HANDLING
614 int current_firewire_status = firewire_detect();
615 if(current_firewire_status != last_firewire_status)
617 last_firewire_status = current_firewire_status;
618 firewire_countdown = NUM_POLL_READINGS;
620 else
622 /* Count down until it gets negative */
623 if(firewire_countdown >= 0)
624 firewire_countdown--;
626 /* Report to the thread if we have had 3 identical status
627 readings in a row */
628 if(firewire_countdown == 0)
630 queue_post(&usb_queue, USB_REQUEST_REBOOT, 0);
633 #endif /* USB_FIREWIRE_HANDLING */
635 int current_status = usb_detect();
637 /* Only report when the status has changed */
638 if(current_status != last_usb_status)
640 last_usb_status = current_status;
641 usb_countdown = NUM_POLL_READINGS;
643 else
645 /* Count down until it gets negative */
646 if(usb_countdown >= 0)
647 usb_countdown--;
649 /* Report to the thread if we have had 3 identical status
650 readings in a row */
651 if(usb_countdown == 0)
653 queue_post(&usb_queue, current_status, 0);
657 #if (CONFIG_STORAGE & STORAGE_MMC)
658 if(usb_mmc_countdown > 0)
660 usb_mmc_countdown--;
661 if(usb_mmc_countdown == 0)
662 queue_post(&usb_queue, USB_REENABLE, 0);
664 #endif
667 void usb_start_monitoring(void)
669 usb_monitor_enabled = true;
671 #endif /* USB_STATUS_BY_EVENT */
672 #endif /* USB_FULL_INIT */
674 void usb_acknowledge(long id)
676 queue_post(&usb_queue, id, 0);
679 void usb_init(void)
681 usb_init_device();
683 #ifdef USB_FULL_INIT
684 usb_enable(false);
686 queue_init(&usb_queue, true);
688 usb_thread_entry = create_thread(usb_thread, usb_stack,
689 sizeof(usb_stack), 0, usb_thread_name
690 IF_PRIO(, PRIORITY_SYSTEM) IF_COP(, CPU));
692 #ifndef USB_STATUS_BY_EVENT
693 tick_add_task(usb_tick);
694 #endif
695 #endif /* USB_FULL_INIT */
698 void usb_wait_for_disconnect(struct event_queue *q)
700 #ifdef USB_FULL_INIT
701 struct queue_event ev;
703 /* Don't return until we get SYS_USB_DISCONNECTED */
704 while(1)
706 queue_wait(q, &ev);
707 if(ev.id == SYS_USB_DISCONNECTED)
708 return;
710 #endif /* USB_FULL_INIT */
711 (void)q;
714 int usb_wait_for_disconnect_w_tmo(struct event_queue *q, int ticks)
716 #ifdef USB_FULL_INIT
717 struct queue_event ev;
719 /* Don't return until we get SYS_USB_DISCONNECTED or SYS_TIMEOUT */
720 while(1)
722 queue_wait_w_tmo(q, &ev, ticks);
723 switch(ev.id)
725 case SYS_USB_DISCONNECTED:
726 return 0;
727 case SYS_TIMEOUT:
728 return 1;
731 #endif /* USB_FULL_INIT */
732 (void)q; (void)ticks;
733 return 0;
736 #ifdef USB_DRIVER_CLOSE
737 void usb_close(void)
739 unsigned int thread = usb_thread_entry;
740 usb_thread_entry = 0;
742 if(thread == 0)
743 return;
745 #ifndef USB_STATUS_BY_EVENT
746 tick_remove_task(usb_tick);
747 #endif
748 usb_monitor_enabled = false;
750 queue_post(&usb_queue, USB_QUIT, 0);
751 thread_wait(thread);
753 #endif /* USB_DRIVER_CLOSE */
755 bool usb_inserted(void)
757 return usb_state == USB_INSERTED || usb_state == USB_POWERED;
760 #ifdef HAVE_USBSTACK
761 bool usb_exclusive_storage(void)
763 /* Storage isn't actually exclusive until slave mode has been entered */
764 return exclusive_storage_access && usb_state == USB_INSERTED;
766 #endif /* HAVE_USBSTACK */
768 int usb_release_exclusive_storage(void)
770 int bccount;
771 exclusive_storage_access = false;
772 /* Tell all threads that we are back in business */
773 bccount = queue_broadcast(SYS_USB_DISCONNECTED, 0) - 1;
774 DEBUGF("USB extracted. Broadcast to %d threads...\n", bccount);
775 return bccount;
778 #ifdef HAVE_USB_POWER
779 bool usb_powered(void)
781 return usb_state == USB_POWERED;
783 #endif /* HAVE_USB_POWER */
785 #ifdef USB_ENABLE_HID
786 void usb_set_hid(bool enable)
788 usb_hid = enable;
789 usb_core_enable_driver(USB_DRIVER_HID, usb_hid);
791 #endif /* USB_ENABLE_HID */
793 #else /* SIMULATOR || USB_NONE */
795 #ifdef USB_NONE
796 bool usb_inserted(void)
798 return false;
800 #endif /* USB_NONE */
802 /* Dummy simulator functions */
803 void usb_acknowledge(long id)
805 id = id;
808 void usb_init(void)
812 void usb_start_monitoring(void)
816 int usb_detect(void)
818 return USB_EXTRACTED;
821 void usb_wait_for_disconnect(struct event_queue *q)
823 (void)q;
826 #endif /* !USB_NONE && !SIMULATOR */