Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Keyboard Man_俊
rt-thread
提交
b5e8fa08
R
rt-thread
项目概览
Keyboard Man_俊
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b5e8fa08
编写于
11月 29, 2017
作者:
lymzzyh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Components][Drivers][USB]Add IAD support for MSC class
上级
cdf2af5c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
3 deletion
+30
-3
components/drivers/KConfig
components/drivers/KConfig
+5
-1
components/drivers/usb/usbdevice/class/mstorage.c
components/drivers/usb/usbdevice/class/mstorage.c
+22
-2
components/drivers/usb/usbdevice/class/mstorage.h
components/drivers/usb/usbdevice/class/mstorage.h
+3
-0
未找到文件。
components/drivers/KConfig
浏览文件 @
b5e8fa08
...
...
@@ -166,7 +166,11 @@ menu "Using USB"
bool "Enable to use device as winusb device"
default n
endif
if RT_USB_DEVICE_MSTORAGE
config RT_USB_MSTORAGE_DISK_NAME
string "msc class disk name"
default "flash0"
endif
if RT_USB_DEVICE_HID
config RT_USB_DEVICE_HID_KEYBOARD
bool "Use to HID device as Keyboard"
...
...
components/drivers/usb/usbdevice/class/mstorage.c
浏览文件 @
b5e8fa08
...
...
@@ -116,6 +116,17 @@ static struct usb_qualifier_descriptor dev_qualifier =
const
static
struct
umass_descriptor
_mass_desc
=
{
#ifdef RT_USB_DEVICE_COMPOSITE
/* Interface Association Descriptor */
USB_DESC_LENGTH_IAD
,
USB_DESC_TYPE_IAD
,
USB_DYNAMIC
,
0x01
,
USB_CLASS_MASS_STORAGE
,
0x06
,
0x50
,
0x00
,
#endif
USB_DESC_LENGTH_INTERFACE
,
//bLength;
USB_DESC_TYPE_INTERFACE
,
//type;
USB_DYNAMIC
,
//bInterfaceNumber;
...
...
@@ -1028,7 +1039,13 @@ static struct ufunction_ops ops =
_function_disable
,
RT_NULL
,
};
static
rt_err_t
_mstorage_descriptor_config
(
umass_desc_t
desc
,
rt_uint8_t
cintf_nr
)
{
#ifdef RT_USB_DEVICE_COMPOSITE
desc
->
iad_desc
.
bFirstInterface
=
cintf_nr
;
#endif
return
RT_EOK
;
}
/**
* This function will create a mass storage function instance.
*
...
...
@@ -1066,7 +1083,10 @@ ufunction_t rt_usbd_function_mstorage_create(udevice_t device)
setting
=
rt_usbd_altsetting_new
(
sizeof
(
struct
umass_descriptor
));
/* config desc in alternate setting */
rt_usbd_altsetting_config_descriptor
(
setting
,
&
_mass_desc
,
0
);
rt_usbd_altsetting_config_descriptor
(
setting
,
&
_mass_desc
,
(
rt_off_t
)
&
((
umass_desc_t
)
0
)
->
intf_desc
);
/* configure the msc interface descriptor */
_mstorage_descriptor_config
(
setting
->
desc
,
intf
->
intf_num
);
/* create a bulk out and a bulk in endpoint */
mass_desc
=
(
umass_desc_t
)
setting
->
desc
;
...
...
components/drivers/usb/usbdevice/class/mstorage.h
浏览文件 @
b5e8fa08
...
...
@@ -32,6 +32,9 @@
struct
umass_descriptor
{
#ifdef RT_USB_DEVICE_COMPOSITE
struct
uiad_descriptor
iad_desc
;
#endif
struct
uinterface_descriptor
intf_desc
;
struct
uendpoint_descriptor
ep_out_desc
;
struct
uendpoint_descriptor
ep_in_desc
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录