usbdevice/core: misc cleanup
This commit is contained in:
parent
ffb1e62020
commit
5de59429fe
|
@ -1294,25 +1294,24 @@ static void rt_usbd_thread_entry(void* parameter)
|
|||
uep_t ep;
|
||||
|
||||
/* receive message */
|
||||
if(rt_mq_recv(usb_mq, &msg, sizeof(struct udev_msg), RT_WAITING_FOREVER)
|
||||
!= RT_EOK ) continue;
|
||||
if(rt_mq_recv(usb_mq,
|
||||
&msg, sizeof(struct udev_msg),
|
||||
RT_WAITING_FOREVER) != RT_EOK )
|
||||
continue;
|
||||
|
||||
device = rt_usbd_find_device(msg.dcd);
|
||||
if(device == RT_NULL)
|
||||
{
|
||||
rt_kprintf("invalid usb device\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (msg.type)
|
||||
{
|
||||
case USB_MSG_SETUP_NOTIFY:
|
||||
device = rt_usbd_find_device(msg.dcd);
|
||||
if(device != RT_NULL)
|
||||
_setup_request(device, (ureq_t)msg.content.setup_msg.packet);
|
||||
else
|
||||
rt_kprintf("invalid usb device\n");
|
||||
_setup_request(device, (ureq_t)msg.content.setup_msg.packet);
|
||||
break;
|
||||
case USB_MSG_DATA_NOTIFY:
|
||||
device = rt_usbd_find_device(msg.dcd);
|
||||
if(device == RT_NULL)
|
||||
{
|
||||
rt_kprintf("invalid usb device\n");
|
||||
break;
|
||||
}
|
||||
ep = rt_usbd_find_endpoint(device, &cls, msg.content.ep_msg.ep_addr);
|
||||
if(ep != RT_NULL)
|
||||
ep->handler(device, cls, msg.content.ep_msg.size);
|
||||
|
@ -1320,13 +1319,10 @@ static void rt_usbd_thread_entry(void* parameter)
|
|||
rt_kprintf("invalid endpoint\n");
|
||||
break;
|
||||
case USB_MSG_SOF:
|
||||
device = rt_usbd_find_device(msg.dcd);
|
||||
if(device != RT_NULL)
|
||||
_sof_notify(device);
|
||||
else
|
||||
rt_kprintf("invalid usb device\n");
|
||||
_sof_notify(device);
|
||||
break;
|
||||
default:
|
||||
rt_kprintf("unknown msg type\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue