summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2012-12-07 13:37:26 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2012-12-07 13:37:26 +0100
commit775ab07d5e710c4811a66b246f8f8708a09eba28 (patch)
treedf725ba1aea0bccbfb64e29d49fa04bfc671ec11 /firmware/export
parentfb43a137e72d1f428efef00047a416497463edfb (diff)
downloadrockbox-775ab07d5e710c4811a66b246f8f8708a09eba28.tar.gz
rockbox-775ab07d5e710c4811a66b246f8f8708a09eba28.zip
usb: add support for hardware handled SET ADDR/CONFIG
Some USB controllers like the one of the Rockchip 27xx handle some requests in pure hardware. This is especially a problem for two of them: - SET ADDR which is used by our core to track the DEFAULT/ADDRESS state and is required for the drivers to work properly - SET CONFIG which is used by our core to initialise the drivers by calling init_connection() In these cases we need a way to notify the core that such requests happened. We do this by exporting two functions which directly notify the core about these requests and perform the necessary init steps required without doing the actual USB transfers. Special care is needed because these functions could be called from an interrupt handler. For this reason we still use the usb_queue and introduce new IDs so that they are processed in order and safely. No functional change is intended, both in the usbstack and on targets without such quirks. Change-Id: Ie42feffd4584e88bf37cff018b627f333dca1140
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/usb.h3
-rw-r--r--firmware/export/usb_core.h4
2 files changed, 7 insertions, 0 deletions
diff --git a/firmware/export/usb.h b/firmware/export/usb.h
index 8954e9cc59..13ef3983b2 100644
--- a/firmware/export/usb.h
+++ b/firmware/export/usb.h
@@ -44,6 +44,8 @@ enum
44#endif 44#endif
45#ifdef HAVE_USBSTACK 45#ifdef HAVE_USBSTACK
46 USB_TRANSFER_COMPLETION, /* Event */ 46 USB_TRANSFER_COMPLETION, /* Event */
47 USB_NOTIFY_SET_ADDR, /* Event */
48 USB_NOTIFY_SET_CONFIG, /* Event */
47#endif 49#endif
48#ifdef USB_FIREWIRE_HANDLING 50#ifdef USB_FIREWIRE_HANDLING
49 USB_REQUEST_REBOOT, /* Event */ 51 USB_REQUEST_REBOOT, /* Event */
@@ -130,6 +132,7 @@ void usb_charger_update(void);
130#ifdef HAVE_USBSTACK 132#ifdef HAVE_USBSTACK
131void usb_signal_transfer_completion( 133void usb_signal_transfer_completion(
132 struct usb_transfer_completion_event_data *event_data); 134 struct usb_transfer_completion_event_data *event_data);
135void usb_signal_notify(long id, intptr_t data);
133bool usb_driver_enabled(int driver); 136bool usb_driver_enabled(int driver);
134bool usb_exclusive_storage(void); /* storage is available for usb */ 137bool usb_exclusive_storage(void); /* storage is available for usb */
135#endif 138#endif
diff --git a/firmware/export/usb_core.h b/firmware/export/usb_core.h
index 6405aa492d..9e3d0d7916 100644
--- a/firmware/export/usb_core.h
+++ b/firmware/export/usb_core.h
@@ -51,6 +51,10 @@ void usb_core_enable_driver(int driver,bool enabled);
51bool usb_core_driver_enabled(int driver); 51bool usb_core_driver_enabled(int driver);
52void usb_core_handle_transfer_completion( 52void usb_core_handle_transfer_completion(
53 struct usb_transfer_completion_event_data* event); 53 struct usb_transfer_completion_event_data* event);
54void usb_core_handle_notify(long id, intptr_t data);
55/* For controllers which handle SET ADDR and/or SET CONFIG in hardware */
56void usb_core_notify_set_address(uint8_t addr);
57void usb_core_notify_set_config(uint8_t config);
54 58
55int usb_core_request_endpoint(int type, int dir,struct usb_class_driver* drv); 59int usb_core_request_endpoint(int type, int dir,struct usb_class_driver* drv);
56void usb_core_release_endpoint(int dir); 60void usb_core_release_endpoint(int dir);