Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
0ab93e70
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
0ab93e70
编写于
3月 16, 2018
作者:
lymzzyh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Components][USB Device]增加协议栈对HS设备的支持
- 增加winusb对HS的支持。其余class还在完善中
上级
bce9bc47
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
99 addition
and
12 deletion
+99
-12
.vscode/c_cpp_properties.json
.vscode/c_cpp_properties.json
+80
-0
components/drivers/include/drivers/usb_device.h
components/drivers/include/drivers/usb_device.h
+1
-0
components/drivers/usb/usbdevice/class/winusb.c
components/drivers/usb/usbdevice/class/winusb.c
+14
-11
components/drivers/usb/usbdevice/core/core.c
components/drivers/usb/usbdevice/core/core.c
+4
-1
未找到文件。
.vscode/c_cpp_properties.json
0 → 100644
浏览文件 @
0ab93e70
{
"configurations"
:
[
{
"name"
:
"Mac"
,
"includePath"
:
[
"/usr/include"
,
"/usr/local/include"
,
"${workspaceRoot}"
],
"defines"
:
[],
"intelliSenseMode"
:
"clang-x64"
,
"browse"
:
{
"path"
:
[
"/usr/include"
,
"/usr/local/include"
,
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders"
:
true
,
"databaseFilename"
:
""
},
"macFrameworkPath"
:
[
"/System/Library/Frameworks"
,
"/Library/Frameworks"
]
},
{
"name"
:
"Linux"
,
"includePath"
:
[
"/usr/include"
,
"/usr/local/include"
,
"${workspaceRoot}"
],
"defines"
:
[],
"intelliSenseMode"
:
"clang-x64"
,
"browse"
:
{
"path"
:
[
"/usr/include"
,
"/usr/local/include"
,
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders"
:
true
,
"databaseFilename"
:
""
}
},
{
"name"
:
"Win32"
,
"includePath"
:
[
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128/include/*"
,
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128/atlmfc/include/*"
,
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/um"
,
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/ucrt"
,
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/shared"
,
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/winrt"
,
"${workspaceRoot}"
,
"${workspaceRoot}/include"
,
"${workspaceRoot}/components/drivers/include"
],
"defines"
:
[
"_DEBUG"
,
"UNICODE"
,
"_UNICODE"
],
"intelliSenseMode"
:
"msvc-x64"
,
"browse"
:
{
"path"
:
[
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128/include/*"
,
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128/atlmfc/include/*"
,
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/um"
,
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/ucrt"
,
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/shared"
,
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/winrt"
,
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders"
:
true
,
"databaseFilename"
:
""
}
}
],
"version"
:
3
}
\ No newline at end of file
components/drivers/include/drivers/usb_device.h
浏览文件 @
0ab93e70
...
...
@@ -140,6 +140,7 @@ struct udcd
struct
uendpoint
ep0
;
uep0_stage_t
stage
;
struct
ep_id
*
ep_pool
;
rt_uint8_t
device_is_hs
;
};
typedef
struct
udcd
*
udcd_t
;
...
...
components/drivers/usb/usbdevice/class/winusb.c
浏览文件 @
0ab93e70
...
...
@@ -43,13 +43,14 @@ static struct udevice_descriptor dev_desc =
//FS and HS needed
static
struct
usb_qualifier_descriptor
dev_qualifier
=
{
sizeof
(
dev_qualifier
),
USB_DESC_TYPE_DEVICEQUALIFIER
,
0x0200
,
0x00
,
0x00
,
64
,
0x01
,
sizeof
(
dev_qualifier
),
//bLength
USB_DESC_TYPE_DEVICEQUALIFIER
,
//bDescriptorType
0x0200
,
//bcdUSB
0xFF
,
//bDeviceClass
0x00
,
//bDeviceSubClass
0x00
,
//bDeviceProtocol
64
,
//bMaxPacketSize0
0x01
,
//bNumConfigurations
0
,
};
...
...
@@ -81,14 +82,14 @@ struct winusb_descriptor _winusb_desc =
USB_DESC_TYPE_ENDPOINT
,
USB_DYNAMIC
|
USB_DIR_OUT
,
USB_EP_ATTR_BULK
,
0x40
,
USB_DYNAMIC
,
0x00
,
/*endpoint descriptor*/
USB_DESC_LENGTH_ENDPOINT
,
USB_DESC_TYPE_ENDPOINT
,
USB_DYNAMIC
|
USB_DIR_IN
,
USB_EP_ATTR_BULK
,
0x40
,
USB_DYNAMIC
,
0x00
,
};
...
...
@@ -197,11 +198,13 @@ static struct ufunction_ops ops =
RT_NULL
,
};
static
rt_err_t
_winusb_descriptor_config
(
winusb_desc_t
winusb
,
rt_uint8_t
cintf_nr
)
static
rt_err_t
_winusb_descriptor_config
(
winusb_desc_t
winusb
,
rt_uint8_t
cintf_nr
,
rt_uint8_t
device_is_hs
)
{
#ifdef RT_USB_DEVICE_COMPOSITE
winusb
->
iad_desc
.
bFirstInterface
=
cintf_nr
;
#endif
winusb
->
ep_out_desc
.
wMaxPacketSize
=
device_is_hs
?
512
:
64
;
winusb
->
ep_in_desc
.
wMaxPacketSize
=
device_is_hs
?
512
:
64
;
winusb_func_comp_id_desc
.
bFirstInterfaceNumber
=
cintf_nr
;
return
RT_EOK
;
}
...
...
@@ -293,7 +296,7 @@ ufunction_t rt_usbd_function_winusb_create(udevice_t device)
rt_usbd_altsetting_config_descriptor
(
winusb_setting
,
&
_winusb_desc
,
(
rt_off_t
)
&
((
winusb_desc_t
)
0
)
->
intf_desc
);
/* configure the hid interface descriptor */
_winusb_descriptor_config
(
winusb_setting
->
desc
,
winusb_intf
->
intf_num
);
_winusb_descriptor_config
(
winusb_setting
->
desc
,
winusb_intf
->
intf_num
,
device
->
dcd
->
device_is_hs
);
/* create endpoint */
winusb_desc
=
(
winusb_desc_t
)
winusb_setting
->
desc
;
...
...
components/drivers/usb/usbdevice/core/core.c
浏览文件 @
0ab93e70
...
...
@@ -166,7 +166,7 @@ static rt_err_t _get_qualifier_descriptor(struct udevice* device, ureq_t setup)
RT_ASSERT
(
device
!=
RT_NULL
);
RT_ASSERT
(
setup
!=
RT_NULL
);
if
(
device
->
dev_qualifier
)
if
(
device
->
dev_qualifier
&&
device
->
dcd
->
device_is_hs
)
{
/* send device qualifier descriptor to endpoint 0 */
rt_usbd_ep0_write
(
device
,
(
rt_uint8_t
*
)
device
->
dev_qualifier
,
...
...
@@ -210,6 +210,9 @@ static rt_err_t _get_descriptor(struct udevice* device, ureq_t setup)
case
USB_DESC_TYPE_DEVICEQUALIFIER
:
_get_qualifier_descriptor
(
device
,
setup
);
break
;
case
USB_DESC_TYPE_OTHERSPEED
:
_get_config_descriptor
(
device
,
setup
);
break
;
default:
rt_kprintf
(
"unsupported descriptor request
\n
"
);
rt_usbd_ep0_set_stall
(
device
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录