This commit is contained in:
hathach
2018-03-07 15:30:32 +07:00
parent 889169d4d0
commit 7092db264f
13 changed files with 79 additions and 388 deletions

View File

@@ -231,15 +231,20 @@ tusb_error_t cdcd_xfer_cb(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32
{
cdcd_data_t const * p_cdc = &cdcd_data[edpt_hdl.coreid];
for(cdc_pipeid_t pipeid=CDC_PIPE_NOTIFICATION; pipeid < CDC_PIPE_ERROR; pipeid++ )
if ( endpointhandle_is_equal(edpt_hdl, p_cdc->edpt_hdl[CDC_PIPE_DATA_OUT]) )
{
if ( endpointhandle_is_equal(edpt_hdl, p_cdc->edpt_hdl[pipeid]) )
{
tud_cdc_xfer_cb(edpt_hdl.coreid, event, pipeid, xferred_bytes);
break;
}
tud_cdc_rx_cb(edpt_hdl.coreid, xferred_bytes);
}
// for(cdc_pipeid_t pipeid=CDC_PIPE_NOTIFICATION; pipeid < CDC_PIPE_ERROR; pipeid++ )
// {
// if ( endpointhandle_is_equal(edpt_hdl, p_cdc->edpt_hdl[pipeid]) )
// {
// tud_cdc_xfer_cb(edpt_hdl.coreid, event, pipeid, xferred_bytes);
// break;
// }
// }
return TUSB_ERROR_NONE;
}

View File

@@ -109,6 +109,8 @@ tusb_error_t tud_cdc_receive(uint8_t coreid, void * p_buffer, uint32_t length, b
void tud_cdc_xfer_cb(uint8_t coreid, tusb_event_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes);
//void tud_cdc_line_coding_changed_cb(uint8_t coreid, cdc_line_coding_t* p_line_coding);
void tud_cdc_rx_cb(uint8_t coreid, uint32_t xferred_bytes);
//--------------------------------------------------------------------+
// USBD-CLASS DRIVER API
//--------------------------------------------------------------------+

View File

@@ -120,8 +120,8 @@
* - VERIFY_1ARGS : return false if failed
* - VERIFY_2ARGS : return provided value if failed
*------------------------------------------------------------------*/
#define VERIFY_1ARGS(cond) do { if (!(cond)) return false; } while(0)
#define VERIFY_2ARGS(cond, _error) do { if (!(cond)) return _error; } while(0)
#define VERIFY_1ARGS(cond) do { if (!(cond)) { hal_debugger_breakpoint(); return false; } } while(0)
#define VERIFY_2ARGS(cond, _error) do { if (!(cond)) { hal_debugger_breakpoint(); return _error;} } while(0)
/**
* Check if condition is success (true), otherwise return

View File

@@ -224,7 +224,10 @@ static tusb_error_t usbd_body_subtask(void)
// Call class handling function, Class that endpoint not belong to should check and return
for (uint8_t class_code = TUSB_CLASS_AUDIO; class_code < USBD_CLASS_DRIVER_COUNT; class_code++)
{
if ( usbd_class_drivers[class_code].xfer_cb ) usbd_class_drivers[class_code].xfer_cb( event.xfer_done.edpt_hdl, (tusb_event_t) event.sub_event_id, event.xfer_done.xferred_byte);
if ( usbd_class_drivers[class_code].xfer_cb )
{
usbd_class_drivers[class_code].xfer_cb( event.xfer_done.edpt_hdl, (tusb_event_t) event.sub_event_id, event.xfer_done.xferred_byte);
}
}
}else
{
@@ -273,7 +276,6 @@ tusb_error_t usbd_control_request_subtask(uint8_t coreid, tusb_control_request_t
error = TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT;
}
}
//------------- Class/Interface Specific Request -------------//
else if ( TUSB_REQUEST_RECIPIENT_INTERFACE == p_request->bmRequestType_bit.recipient)
{

View File

@@ -119,7 +119,7 @@
#error TUSB_CFG_ATTR_USBRAM is not defined, please help me know how to place data in accessible RAM for usb controller
#endif
#ifndef TUSB_OS_NONE
#ifndef TUSB_CFG_OS
#define TUSB_CFG_OS TUSB_OS_NONE
#endif