mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-21 12:40:51 +00:00
only call class xfer callback associated with endpoint address
This commit is contained in:
parent
1efb552bfd
commit
7a1f40593f
@ -297,6 +297,7 @@ tusb_error_t cdcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, tusb_event_t event, u
|
|||||||
uint8_t const itf = 0;
|
uint8_t const itf = 0;
|
||||||
cdcd_interface_t const * p_cdc = &_cdcd_itf[itf];
|
cdcd_interface_t const * p_cdc = &_cdcd_itf[itf];
|
||||||
|
|
||||||
|
// receive new data
|
||||||
if ( ep_addr == p_cdc->ep_out )
|
if ( ep_addr == p_cdc->ep_out )
|
||||||
{
|
{
|
||||||
tu_fifo_write_n(&_rx_ff[itf], _tmp_rx_buf, xferred_bytes);
|
tu_fifo_write_n(&_rx_ff[itf], _tmp_rx_buf, xferred_bytes);
|
||||||
@ -308,6 +309,8 @@ tusb_error_t cdcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, tusb_event_t event, u
|
|||||||
if (tud_cdc_rx_cb) tud_cdc_rx_cb(itf);
|
if (tud_cdc_rx_cb) tud_cdc_rx_cb(itf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nothing to do with in and notif endpoint
|
||||||
|
|
||||||
return TUSB_ERROR_NONE;
|
return TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,8 +208,6 @@ tusb_error_t mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, tusb_event_t event, u
|
|||||||
msc_cbw_t const * p_cbw = &p_msc->cbw;
|
msc_cbw_t const * p_cbw = &p_msc->cbw;
|
||||||
msc_csw_t * p_csw = &p_msc->csw;
|
msc_csw_t * p_csw = &p_msc->csw;
|
||||||
|
|
||||||
VERIFY( (ep_addr == p_msc->ep_out) || (ep_addr == p_msc->ep_in), TUSB_ERROR_INVALID_PARA);
|
|
||||||
|
|
||||||
switch (p_msc->stage)
|
switch (p_msc->stage)
|
||||||
{
|
{
|
||||||
case MSC_STAGE_CMD:
|
case MSC_STAGE_CMD:
|
||||||
|
@ -269,14 +269,13 @@ static tusb_error_t usbd_main_st(void)
|
|||||||
}
|
}
|
||||||
else if (USBD_EVT_XFER_DONE == event.event_id)
|
else if (USBD_EVT_XFER_DONE == event.event_id)
|
||||||
{
|
{
|
||||||
// TODO only call respective interface callback
|
// Invoke the class callback associated with the endpoint address
|
||||||
// Call class handling function. Those does not own the endpoint should check and return
|
uint8_t const ep_addr = event.xfer_done.ep_addr;
|
||||||
for (uint8_t i = 0; i < USBD_CLASS_DRIVER_COUNT; i++)
|
uint8_t const drv_id = _usbd_dev.ep2drv[ edpt_dir(ep_addr) ][ edpt_number(ep_addr) ];
|
||||||
|
|
||||||
|
if (drv_id < USBD_CLASS_DRIVER_COUNT)
|
||||||
{
|
{
|
||||||
if ( usbd_class_drivers[i].xfer_cb )
|
usbd_class_drivers[drv_id].xfer_cb( event.rhport, ep_addr, (tusb_event_t) event.xfer_done.result, event.xfer_done.xferred_byte);
|
||||||
{
|
|
||||||
usbd_class_drivers[i].xfer_cb( event.rhport, event.xfer_done.ep_addr, (tusb_event_t) event.xfer_done.result, event.xfer_done.xferred_byte);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (USBD_EVT_SOF == event.event_id)
|
else if (USBD_EVT_SOF == event.event_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user