rename to hal_dcd_control_xfer() and hal_dcd_control_stall()
This commit is contained in:
@@ -57,6 +57,7 @@ typedef enum
|
||||
USBD_BUS_EVENT_RESUME
|
||||
}usbd_bus_event_type_t;
|
||||
|
||||
// TODO move Hal
|
||||
typedef struct {
|
||||
uint8_t coreid;
|
||||
uint8_t reserved; // TODO redundant, cannot be control as control uses separated API
|
||||
@@ -91,8 +92,8 @@ void hal_dcd_bus_event(uint8_t coreid, usbd_bus_event_type_t bus_event);
|
||||
void hal_dcd_setup_received(uint8_t coreid, uint8_t const* p_request);
|
||||
|
||||
//------------- PIPE API -------------//
|
||||
bool dcd_pipe_control_xfer(uint8_t coreid, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete);
|
||||
void dcd_pipe_control_stall(uint8_t coreid);
|
||||
bool hal_dcd_control_xfer(uint8_t coreid, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete);
|
||||
void hal_dcd_control_stall(uint8_t coreid);
|
||||
|
||||
endpoint_handle_t dcd_pipe_open(uint8_t coreid, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code);
|
||||
tusb_error_t dcd_pipe_queue_xfer(endpoint_handle_t edpt_hdl, uint8_t * buffer, uint16_t total_bytes); // only queue, not transferring yet
|
||||
|
||||
@@ -373,12 +373,12 @@ static tusb_error_t pipe_control_read(void * buffer, uint16_t length)
|
||||
//--------------------------------------------------------------------+
|
||||
// CONTROL PIPE API
|
||||
//--------------------------------------------------------------------+
|
||||
void dcd_pipe_control_stall(uint8_t coreid)
|
||||
void hal_dcd_control_stall(uint8_t coreid)
|
||||
{
|
||||
sie_write(SIE_CMDCODE_ENDPOINT_SET_STATUS+0, 1, SIE_SET_ENDPOINT_STALLED_MASK | SIE_SET_ENDPOINT_CONDITION_STALLED_MASK);
|
||||
}
|
||||
|
||||
bool dcd_pipe_control_xfer(uint8_t coreid, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete)
|
||||
bool hal_dcd_control_xfer(uint8_t coreid, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete)
|
||||
{
|
||||
(void) coreid;
|
||||
|
||||
|
||||
@@ -373,14 +373,14 @@ void dcd_isr(uint8_t coreid)
|
||||
//--------------------------------------------------------------------+
|
||||
// CONTROL PIPE API
|
||||
//--------------------------------------------------------------------+
|
||||
void dcd_pipe_control_stall(uint8_t coreid)
|
||||
void hal_dcd_control_stall(uint8_t coreid)
|
||||
{
|
||||
(void) coreid;
|
||||
// TODO cannot able to STALL Control OUT endpoint !!!!! FIXME try some walk-around
|
||||
dcd_data.qhd[0][0].stall = dcd_data.qhd[1][0].stall = 1;
|
||||
}
|
||||
|
||||
bool dcd_pipe_control_xfer(uint8_t coreid, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete)
|
||||
bool hal_dcd_control_xfer(uint8_t coreid, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete)
|
||||
{
|
||||
(void) coreid;
|
||||
|
||||
|
||||
@@ -167,7 +167,6 @@ tusb_error_t usbd_init (void)
|
||||
hal_dcd_init(1);
|
||||
#endif
|
||||
|
||||
|
||||
//------------- Task init -------------//
|
||||
usbd_queue_hdl = osal_queue_create(USBD_TASK_QUEUE_DEPTH, sizeof(usbd_task_event_t));
|
||||
ASSERT_PTR(usbd_queue_hdl, TUSB_ERROR_OSAL_QUEUE_FAILED);
|
||||
@@ -177,7 +176,6 @@ tusb_error_t usbd_init (void)
|
||||
|
||||
osal_task_create(usbd_task, "usbd", TUC_DEVICE_STACKSIZE, NULL, TUSB_CFG_OS_TASK_PRIO);
|
||||
|
||||
|
||||
//------------- Descriptor Check -------------//
|
||||
ASSERT(tusbd_descriptor_pointers.p_device != NULL && tusbd_descriptor_pointers.p_configuration != NULL, TUSB_ERROR_DESCRIPTOR_CORRUPTED);
|
||||
|
||||
@@ -259,7 +257,7 @@ tusb_error_t usbd_control_request_subtask(uint8_t coreid, tusb_control_request_t
|
||||
|
||||
if ( TUSB_ERROR_NONE == error )
|
||||
{
|
||||
dcd_pipe_control_xfer(coreid, (tusb_direction_t) p_request->bmRequestType_bit.direction, (uint8_t*) p_buffer, length, false);
|
||||
hal_dcd_control_xfer(coreid, (tusb_direction_t) p_request->bmRequestType_bit.direction, (uint8_t*) p_buffer, length, false);
|
||||
}
|
||||
}
|
||||
else if ( TUSB_REQUEST_SET_ADDRESS == p_request->bRequest )
|
||||
@@ -307,11 +305,11 @@ tusb_error_t usbd_control_request_subtask(uint8_t coreid, tusb_control_request_t
|
||||
|
||||
if(TUSB_ERROR_NONE != error)
|
||||
{ // Response with Protocol Stall if request is not supported
|
||||
dcd_pipe_control_stall(coreid);
|
||||
hal_dcd_control_stall(coreid);
|
||||
// ASSERT(error == TUSB_ERROR_NONE, VOID_RETURN);
|
||||
}else if (p_request->wLength == 0)
|
||||
{
|
||||
dcd_pipe_control_xfer(coreid, (tusb_direction_t) p_request->bmRequestType_bit.direction, NULL, 0, false); // zero length for non-data
|
||||
hal_dcd_control_xfer(coreid, (tusb_direction_t) p_request->bmRequestType_bit.direction, NULL, 0, false); // zero length for non-data
|
||||
}
|
||||
|
||||
OSAL_SUBTASK_END
|
||||
|
||||
Reference in New Issue
Block a user