house keeping

This commit is contained in:
hathach 2013-07-04 10:54:51 +07:00
parent d3aed01874
commit 8c0bc38713
1 changed files with 24 additions and 15 deletions

View File

@ -75,24 +75,33 @@ void tusbh_cdc_unmounted_isr(uint8_t dev_addr)
void tusbh_cdc_xfer_isr(uint8_t dev_addr, tusb_event_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes)
{
switch(event)
if ( pipe_id == CDC_PIPE_DATA_IN )
{
case TUSB_EVENT_XFER_COMPLETE:
for(uint32_t i=0; i<xferred_bytes; i++)
{
osal_queue_send(queue_hdl, buffer_in+i);
}
tusbh_cdc_receive(dev_addr, buffer_in, sizeof(buffer_in), true);
break;
switch(event)
{
case TUSB_EVENT_XFER_COMPLETE:
for(uint32_t i=0; i<xferred_bytes; i++)
{
osal_queue_send(queue_hdl, buffer_in+i);
}
tusbh_cdc_receive(dev_addr, buffer_in, sizeof(buffer_in), true);
break;
case TUSB_EVENT_XFER_ERROR:
tusbh_cdc_receive(dev_addr, buffer_in, sizeof(buffer_in), true); // ignore & continue
break;
case TUSB_EVENT_XFER_ERROR:
tusbh_cdc_receive(dev_addr, buffer_in, sizeof(buffer_in), true); // ignore & continue
break;
case TUSB_EVENT_XFER_STALLED:
default :
ASSERT(false, (void) 0); // error
break;
}
}else if (pipe_id == CDC_PIPE_DATA_OUT)
{
}else if (pipe_id == CDC_PIPE_NOTIFICATION)
{
case TUSB_EVENT_XFER_STALLED:
default :
ASSERT(false, (void) 0); // error
break;
}
}