From f0b4a32d6f983b1bece0b8cb2f2da1fdd23b012e Mon Sep 17 00:00:00 2001 From: Frank Gevaerts Date: Thu, 6 Mar 2008 21:25:09 +0000 Subject: reorganise the usb stack to provide a clean separation between core and class drivers git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16541 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/usb.h | 17 +++++++++-------- firmware/export/usb_core.h | 23 +++++++---------------- 2 files changed, 16 insertions(+), 24 deletions(-) (limited to 'firmware/export') diff --git a/firmware/export/usb.h b/firmware/export/usb.h index 67793729c6..4dae7c2e68 100644 --- a/firmware/export/usb.h +++ b/firmware/export/usb.h @@ -24,13 +24,13 @@ /* Messages from usb_tick and thread states */ enum { - USB_INSERTED, - USB_EXTRACTED, - USB_REENABLE, - USB_POWERED, - USB_TRANSFER_COMPLETION, - USB_REQUEST_DISK, - USB_REQUEST_REBOOT + USB_INSERTED, + USB_EXTRACTED, + USB_REENABLE, + USB_POWERED, + USB_TRANSFER_COMPLETION, + USB_REQUEST_DISK, + USB_REQUEST_REBOOT }; @@ -69,7 +69,8 @@ enum { enum { USB_DRIVER_MASS_STORAGE, USB_DRIVER_SERIAL, - USB_DRIVER_CHARGING_ONLY + USB_DRIVER_CHARGING_ONLY, + USB_NUM_DRIVERS }; #endif #ifdef HAVE_USBSTACK diff --git a/firmware/export/usb_core.h b/firmware/export/usb_core.h index bb4ce6cedd..97712bca4d 100644 --- a/firmware/export/usb_core.h +++ b/firmware/export/usb_core.h @@ -21,7 +21,7 @@ #ifndef BOOTLOADER -//#define USB_SERIAL +#define USB_SERIAL #define USB_STORAGE #define USB_CHARGING_ONLY #else /* BOOTLOADER */ @@ -32,19 +32,8 @@ #include "usb.h" /* endpoints */ -enum { - EP_CONTROL = 0, -#ifdef USB_STORAGE - EP_MASS_STORAGE, -#endif -#ifdef USB_SERIAL - EP_SERIAL, -#endif -#ifdef USB_CHARGING_ONLY - EP_CHARGING_ONLY, -#endif - NUM_ENDPOINTS -}; +#define EP_CONTROL 0 +#define NUM_ENDPOINTS 3 extern int usb_max_pkt_size; @@ -54,7 +43,9 @@ void usb_core_control_request(struct usb_ctrlrequest* req); void usb_core_transfer_complete(int endpoint, bool in, int status, int length); void usb_core_bus_reset(void); bool usb_core_exclusive_connection(void); -void usb_core_enable_protocol(int driver,bool enabled); -void usb_core_handle_transfer_completion(struct usb_transfer_completion_event_data* event); +void usb_core_enable_driver(int driver,bool enabled); +bool usb_core_driver_enabled (int driver); +void usb_core_handle_transfer_completion( + struct usb_transfer_completion_event_data* event); #endif -- cgit v1.2.3