mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
rename tusb_dir_t
This commit is contained in:
parent
e29409d4c8
commit
ca13d59682
@ -234,7 +234,7 @@ void tusb_dcd_control_stall(uint8_t port)
|
||||
|
||||
// control transfer does not need to use qtd find function
|
||||
// follows UM 24.10.8.1.1 Setup packet handling using setup lockout mechanism
|
||||
bool tusb_dcd_control_xfer(uint8_t port, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete)
|
||||
bool tusb_dcd_control_xfer(uint8_t port, tusb_dir_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete)
|
||||
{
|
||||
LPC_USB0_Type* const lpc_usb = LPC_USB[port];
|
||||
dcd_data_t* const p_dcd = dcd_data_ptr[port];
|
||||
@ -301,7 +301,7 @@ bool tusb_dcd_edpt_open(uint8_t port, tusb_descriptor_endpoint_t const * p_endpo
|
||||
// TODO not support ISO yet
|
||||
VERIFY ( p_endpoint_desc->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS);
|
||||
|
||||
tusb_direction_t dir = (p_endpoint_desc->bEndpointAddress & TUSB_DIR_DEV_TO_HOST_MASK) ? TUSB_DIR_DEV_TO_HOST : TUSB_DIR_HOST_TO_DEV;
|
||||
tusb_dir_t dir = (p_endpoint_desc->bEndpointAddress & TUSB_DIR_DEV_TO_HOST_MASK) ? TUSB_DIR_DEV_TO_HOST : TUSB_DIR_HOST_TO_DEV;
|
||||
|
||||
//------------- Prepare Queue Head -------------//
|
||||
uint8_t ep_idx = edpt_addr2phy(p_endpoint_desc->bEndpointAddress);
|
||||
|
@ -218,12 +218,12 @@ tusb_error_t cdcd_control_request_subtask(uint8_t port, tusb_control_request_t c
|
||||
switch(p_request->bRequest)
|
||||
{
|
||||
case CDC_REQUEST_GET_LINE_CODING:
|
||||
tusb_dcd_control_xfer(port, (tusb_direction_t) p_request->bmRequestType_bit.direction,
|
||||
tusb_dcd_control_xfer(port, (tusb_dir_t) p_request->bmRequestType_bit.direction,
|
||||
(uint8_t*) &cdcd_line_coding[port], min16_of(sizeof(cdc_line_coding_t), p_request->wLength), false );
|
||||
break;
|
||||
|
||||
case CDC_REQUEST_SET_LINE_CODING:
|
||||
tusb_dcd_control_xfer(port, (tusb_direction_t) p_request->bmRequestType_bit.direction,
|
||||
tusb_dcd_control_xfer(port, (tusb_dir_t) p_request->bmRequestType_bit.direction,
|
||||
(uint8_t*) &cdcd_line_coding[port], min16_of(sizeof(cdc_line_coding_t), p_request->wLength), false );
|
||||
// TODO notify application on xfer completea
|
||||
break;
|
||||
|
@ -218,7 +218,7 @@ tusb_error_t hidd_control_request_subtask(uint8_t port, tusb_control_request_t c
|
||||
&p_buffer, p_request->wLength);
|
||||
SUBTASK_ASSERT( p_buffer != NULL && actual_length > 0 );
|
||||
|
||||
tusb_dcd_control_xfer(port, (tusb_direction_t) p_request->bmRequestType_bit.direction, p_buffer, actual_length, false);
|
||||
tusb_dcd_control_xfer(port, (tusb_dir_t) p_request->bmRequestType_bit.direction, p_buffer, actual_length, false);
|
||||
}
|
||||
else if ( (HID_REQUEST_CONTROL_SET_REPORT == p_request->bRequest) && (p_driver->set_report_cb != NULL) )
|
||||
{
|
||||
@ -226,7 +226,7 @@ tusb_error_t hidd_control_request_subtask(uint8_t port, tusb_control_request_t c
|
||||
// wValue = Report Type | Report ID
|
||||
tusb_error_t error;
|
||||
|
||||
tusb_dcd_control_xfer(port, (tusb_direction_t) p_request->bmRequestType_bit.direction, m_hid_buffer, p_request->wLength, true);
|
||||
tusb_dcd_control_xfer(port, (tusb_dir_t) p_request->bmRequestType_bit.direction, m_hid_buffer, p_request->wLength, true);
|
||||
|
||||
osal_semaphore_wait(usbd_control_xfer_sem_hdl, OSAL_TIMEOUT_NORMAL, &error); // wait for control xfer complete
|
||||
SUBTASK_ASSERT_STATUS(error);
|
||||
|
@ -56,7 +56,7 @@ typedef struct ATTR_PACKED{
|
||||
struct ATTR_PACKED {
|
||||
uint8_t recipient : 5; ///< Recipient type tusb_std_request_recipient_t.
|
||||
uint8_t type : 2; ///< Request type tusb_control_request_type_t.
|
||||
uint8_t direction : 1; ///< Direction type. tusb_direction_t
|
||||
uint8_t direction : 1; ///< Direction type. tusb_dir_t
|
||||
} bmRequestType_bit;
|
||||
uint8_t bmRequestType;
|
||||
};
|
||||
|
@ -70,7 +70,7 @@ typedef enum
|
||||
TUSB_DIR_DEV_TO_HOST = 1,
|
||||
|
||||
TUSB_DIR_DEV_TO_HOST_MASK = 0x80
|
||||
}tusb_direction_t;
|
||||
}tusb_dir_t;
|
||||
|
||||
|
||||
/// USB Descriptor Types (section 9.4 table 9-5)
|
||||
|
@ -378,7 +378,7 @@ void tusb_dcd_control_stall(uint8_t port)
|
||||
sie_write(SIE_CMDCODE_ENDPOINT_SET_STATUS+0, 1, SIE_SET_ENDPOINT_STALLED_MASK | SIE_SET_ENDPOINT_CONDITION_STALLED_MASK);
|
||||
}
|
||||
|
||||
bool tusb_dcd_control_xfer(uint8_t port, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete)
|
||||
bool tusb_dcd_control_xfer(uint8_t port, tusb_dir_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete)
|
||||
{
|
||||
(void) port;
|
||||
|
||||
|
@ -380,7 +380,7 @@ void tusb_dcd_control_stall(uint8_t port)
|
||||
dcd_data.qhd[0][0].stall = dcd_data.qhd[1][0].stall = 1;
|
||||
}
|
||||
|
||||
bool tusb_dcd_control_xfer(uint8_t port, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete)
|
||||
bool tusb_dcd_control_xfer(uint8_t port, tusb_dir_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete)
|
||||
{
|
||||
(void) port;
|
||||
|
||||
|
@ -296,7 +296,7 @@ tusb_error_t usbd_control_request_subtask(uint8_t port, tusb_control_request_t c
|
||||
|
||||
if ( TUSB_ERROR_NONE == error )
|
||||
{
|
||||
tusb_dcd_control_xfer(port, (tusb_direction_t) p_request->bmRequestType_bit.direction, (uint8_t*) p_buffer, length, false);
|
||||
tusb_dcd_control_xfer(port, (tusb_dir_t) p_request->bmRequestType_bit.direction, (uint8_t*) p_buffer, length, false);
|
||||
}
|
||||
}
|
||||
else if ( TUSB_REQUEST_SET_ADDRESS == p_request->bRequest )
|
||||
@ -347,7 +347,7 @@ tusb_error_t usbd_control_request_subtask(uint8_t port, tusb_control_request_t c
|
||||
// ASSERT(error == TUSB_ERROR_NONE, VOID_RETURN);
|
||||
}else if (p_request->wLength == 0)
|
||||
{
|
||||
tusb_dcd_control_xfer(port, (tusb_direction_t) p_request->bmRequestType_bit.direction, NULL, 0, false); // zero length for non-data
|
||||
tusb_dcd_control_xfer(port, (tusb_dir_t) p_request->bmRequestType_bit.direction, NULL, 0, false); // zero length for non-data
|
||||
}
|
||||
|
||||
OSAL_SUBTASK_END
|
||||
|
@ -78,7 +78,7 @@ void tusb_dcd_xfer_complete(uint8_t port, uint8_t edpt_addr, uint32_t xferred_by
|
||||
/* API
|
||||
*------------------------------------------------------------------*/
|
||||
//------------- Control Endpoint -------------//
|
||||
bool tusb_dcd_control_xfer(uint8_t port, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete);
|
||||
bool tusb_dcd_control_xfer(uint8_t port, tusb_dir_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete);
|
||||
void tusb_dcd_control_stall(uint8_t port);
|
||||
|
||||
bool tusb_dcd_edpt_open(uint8_t port, tusb_descriptor_endpoint_t const * p_endpoint_desc);
|
||||
|
Loading…
x
Reference in New Issue
Block a user