nrf5x: refactor device control transfer.

- make control transfer as part of usbd. Class driver must use
usbd_control_ API() instead of dcd_ api.
- change the signature of class driver's control_request
- allow control request complete to stall in staus stage
- move control request parser & handling to usbd.
This commit is contained in:
hathach
2018-11-16 21:56:39 +07:00
parent b62ca2e5cd
commit 215f8603b1
15 changed files with 491 additions and 452 deletions
+13 -4
View File
@@ -54,15 +54,24 @@ extern tud_desc_set_t const* usbd_desc_set;
tusb_error_t usbd_init (void);
void usbd_task (void* param);
// Carry out Data and Status stage of control transfer
// - If len = 0, it is equivalent to sending status only
// - If len > wLength : it will be truncated
bool usbd_control_xfer(uint8_t rhport, tusb_control_request_t const * request, void* buffer, uint16_t len);
// Send STATUS (zero length) packet
bool usbd_control_status(uint8_t rhport, tusb_control_request_t const * request);
// Stall control endpoint until new setup packet arrived
void usbd_control_stall(uint8_t rhport);
/*------------------------------------------------------------------*/
/* Endpoint helper
/* Helper
*------------------------------------------------------------------*/
// helper to parse an pair of In and Out endpoint descriptors. They must be consecutive
tusb_error_t usbd_open_edpt_pair(uint8_t rhport, tusb_desc_endpoint_t const* p_desc_ep, uint8_t xfer_type, uint8_t* ep_out, uint8_t* ep_in);
/*------------------------------------------------------------------*/
/* Other Helpers
*------------------------------------------------------------------*/
void usbd_defer_func( osal_task_func_t func, void* param, bool in_isr );