mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-09 20:45:41 +08:00
[Components][USB][Class and
Core]修复了协议栈在ep0请求大于端点描述最大包时无法正确读取的bug 增加了rndis class LWIP on USB
This commit is contained in:
1 parent
345bea8b1d
commit
f4fb716167
6 files changed
+1801
-2
No files matched your search
@@ -132,6 +132,10 @@ menu "Using USB"
|
||||
config _RT_USB_DEVICE_HID
|
||||
bool "Enable to use device as HID device"
|
||||
select RT_USB_DEVICE_HID
|
||||
config _RT_USB_DEVICE_RNDIS
|
||||
bool "Enable to use device as rndis device"
|
||||
select RT_USB_DEVICE_RNDIS
|
||||
depends on RT_USING_LWIP
|
||||
config _RT_USB_DEVICE_ECM
|
||||
bool "Enable to use device as ecm device"
|
||||
select RT_USB_DEVICE_ECM
|
||||
@@ -150,6 +154,10 @@ menu "Using USB"
|
||||
config RT_USB_DEVICE_HID
|
||||
bool "Enable to use device as HID device"
|
||||
default n
|
||||
config RT_USB_DEVICE_RNDIS
|
||||
bool "Enable to use device as rndis device"
|
||||
default n
|
||||
depends on RT_USING_LWIP
|
||||
config RT_USB_DEVICE_ECM
|
||||
bool "Enable to use device as ecm device"
|
||||
default n
|
||||
|
||||
@@ -19,6 +19,9 @@ if GetDepend('RT_USB_DEVICE_MSTORAGE'):
|
||||
if GetDepend('RT_USB_DEVICE_ECM'):
|
||||
src += Glob('class/ecm.c')
|
||||
|
||||
if GetDepend('RT_USB_DEVICE_RNDIS'):
|
||||
src += Glob('class/rndis.c')
|
||||
|
||||
if GetDepend('RT_USB_DEVICE_WINUSB'):
|
||||
src += Glob('class/winusb.c')
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -871,6 +871,10 @@ static rt_err_t _ep0_out_notify(udevice_t device, struct ep_msg* ep_msg)
|
||||
ep0->rx_indicate(device, size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_usbd_ep0_read(device, ep0->request.buffer, ep0->request.remain_size,ep0->rx_indicate);
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -2054,18 +2058,26 @@ rt_size_t rt_usbd_ep0_read(udevice_t device, void *buffer, rt_size_t size,
|
||||
rt_err_t (*rx_ind)(udevice_t device, rt_size_t size))
|
||||
{
|
||||
uep_t ep0;
|
||||
rt_size_t read_size = 0;
|
||||
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(device->dcd != RT_NULL);
|
||||
RT_ASSERT(buffer != RT_NULL);
|
||||
|
||||
ep0 = &device->dcd->ep0;
|
||||
ep0->request.size = size;
|
||||
ep0->request.buffer = buffer;
|
||||
ep0->request.remain_size = size;
|
||||
ep0->rx_indicate = rx_ind;
|
||||
if(size >= ep0->id->maxpacket)
|
||||
{
|
||||
read_size = ep0->id->maxpacket;
|
||||
}
|
||||
else
|
||||
{
|
||||
read_size = size;
|
||||
}
|
||||
device->dcd->stage = STAGE_DOUT;
|
||||
dcd_ep_read_prepare(device->dcd, EP0_OUT_ADDR, buffer, size);
|
||||
dcd_ep_read_prepare(device->dcd, EP0_OUT_ADDR, buffer, read_size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user