diff options
| author | hathach <[email protected]> | 2013-03-09 21:37:49 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-03-09 21:37:49 +0700 |
| commit | 8457585464eeaeb56d086374b74d9aae38a5a4cb (patch) | |
| tree | c2f7fb0d188d7e6ac52c8d41002c9aa0ed834ada /tinyusb | |
| parent | 96c92afb32cf4ed811da503bc800fdd286b24de8 (diff) | |
add class code to hcd_pipe_open to facilitate usb_complete callback
Diffstat (limited to 'tinyusb')
| -rw-r--r-- | tinyusb/host/ehci/ehci.c | 3 | ||||
| -rw-r--r-- | tinyusb/host/ehci/ehci.h | 3 | ||||
| -rw-r--r-- | tinyusb/host/hcd.h | 2 | ||||
| -rw-r--r-- | tinyusb/host/usbh.c | 10 | ||||
| -rw-r--r-- | tinyusb/host/usbh_hcd.h | 5 |
5 files changed, 9 insertions, 14 deletions
diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c index a609737df..b147ab400 100644 --- a/tinyusb/host/ehci/ehci.c +++ b/tinyusb/host/ehci/ehci.c @@ -360,7 +360,7 @@ tusb_error_t hcd_pipe_control_close(uint8_t dev_addr) //--------------------------------------------------------------------+ // BULK/INT/ISO PIPE API //--------------------------------------------------------------------+ -pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const * p_endpoint_desc) +pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code) { pipe_handle_t const null_handle = { .dev_addr = 0, .xfer_type = 0, .index = 0 }; @@ -377,6 +377,7 @@ pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const * ehci_qhd_t * const p_qhd = &ehci_data.device[dev_addr].qhd[index]; init_qhd(p_qhd, dev_addr, p_endpoint_desc->wMaxPacketSize, p_endpoint_desc->bEndpointAddress, p_endpoint_desc->bmAttributes.xfer); + p_qhd->class_code = class_code; ehci_qhd_t * list_head; diff --git a/tinyusb/host/ehci/ehci.h b/tinyusb/host/ehci/ehci.h index b07bdbb27..8ff1f52ea 100644 --- a/tinyusb/host/ehci/ehci.h +++ b/tinyusb/host/ehci/ehci.h @@ -195,14 +195,13 @@ typedef struct { //--------------------------------------------------------------------+ uint8_t used; uint8_t pid_non_control; + uint8_t class_code; uint8_t list_index; - uint8_t reserved; ehci_qtd_t *p_qtd_list_head; // head of the scheduled TD list ehci_qtd_t *p_qtd_list_tail; // tail of the scheduled TD list uint32_t reserved_2; - }ATTR_ALIGNED(32) ehci_qhd_t; /// Highspeed Isochronous Transfer Descriptor (section 3.3) diff --git a/tinyusb/host/hcd.h b/tinyusb/host/hcd.h index 640b217a3..7091e6c54 100644 --- a/tinyusb/host/hcd.h +++ b/tinyusb/host/hcd.h @@ -79,7 +79,7 @@ tusb_error_t hcd_pipe_control_open(uint8_t dev_addr, uint8_t max_packet_size) A tusb_error_t hcd_pipe_control_xfer(uint8_t dev_addr, tusb_std_request_t const * p_request, uint8_t data[]) ATTR_WARN_UNUSED_RESULT; tusb_error_t hcd_pipe_control_close(uint8_t dev_addr) ATTR_WARN_UNUSED_RESULT; -pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const * endpoint_desc) ATTR_WARN_UNUSED_RESULT; +pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const * endpoint_desc, uint8_t class_code) ATTR_WARN_UNUSED_RESULT; tusb_error_t hcd_pipe_xfer(pipe_handle_t pipe_hdl, uint8_t buffer[], uint16_t total_bytes, bool int_on_complete) ATTR_WARN_UNUSED_RESULT; tusb_error_t hcd_pipe_close(pipe_handle_t pipe_hdl) ATTR_WARN_UNUSED_RESULT; diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c index cf575fecc..3f18c8eff 100644 --- a/tinyusb/host/usbh.c +++ b/tinyusb/host/usbh.c @@ -53,7 +53,7 @@ #define ENUM_QUEUE_DEPTH 5 // TODO fix number of class driver -class_driver_t const class_host_drivers[TUSB_CLASS_MAX_CONSEC_NUMBER] = +class_driver_t const usbh_class_drivers[TUSB_CLASS_MAX_CONSEC_NUMBER] = { [TUSB_CLASS_HID] = { .init = hidh_init, @@ -109,8 +109,8 @@ tusb_error_t usbh_init(void) //------------- class init -------------// for (uint8_t class_code = 1; class_code < TUSB_CLASS_MAX_CONSEC_NUMBER; class_code++) { - if (class_host_drivers[class_code].init) - class_host_drivers[class_code].init(); + if (usbh_class_drivers[class_code].init) + usbh_class_drivers[class_code].init(); } return TUSB_ERROR_NONE; @@ -273,11 +273,11 @@ OSAL_TASK_DECLARE(usbh_enumeration_task) TASK_ASSERT( false ); // corrupted data, abort enumeration } else if ( class_code < TUSB_CLASS_MAX_CONSEC_NUMBER) { - if ( class_host_drivers[class_code].install_subtask ) + if ( usbh_class_drivers[class_code].install_subtask ) { uint16_t length; OSAL_SUBTASK_INVOKED_AND_WAIT ( // parameters in task/sub_task must be static storage (static or global) - class_host_drivers[ ((tusb_descriptor_interface_t*) p_desc)->bInterfaceClass ].install_subtask(new_addr, p_desc, &length) ); + usbh_class_drivers[ ((tusb_descriptor_interface_t*) p_desc)->bInterfaceClass ].install_subtask(new_addr, p_desc, &length) ); p_desc += length; } } else // unsupported class (not enable or yet implemented) diff --git a/tinyusb/host/usbh_hcd.h b/tinyusb/host/usbh_hcd.h index e8a1d4c62..7681dc560 100644 --- a/tinyusb/host/usbh_hcd.h +++ b/tinyusb/host/usbh_hcd.h @@ -102,11 +102,6 @@ typedef struct { // TODO internal structure, re-order members } usbh_device_info_t; extern usbh_device_info_t usbh_device_info_pool[TUSB_CFG_HOST_DEVICE_MAX+1]; // including zero-address -//--------------------------------------------------------------------+ -// ADDRESS 0 API -//--------------------------------------------------------------------+ -//tusb_error_t hcd_addr0_open(usbh_device_addr0_t *dev_addr0) ATTR_WARN_UNUSED_RESULT; -//NOTE addr0 close is not needed tusb_error_t hcd_addr0_close(usbh_device_addr0_t *dev_addr0) ATTR_WARN_UNUSED_RESULT; #ifdef __cplusplus } |
