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:
+13
-4
@@ -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 );
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user