Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
2a3f223b
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看板
提交
2a3f223b
编写于
1月 25, 2013
作者:
P
prife
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of github.com:RT-Thread/rt-thread
上级
4be62911
58a55504
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
130 addition
and
88 deletion
+130
-88
components/drivers/include/drivers/usb_device.h
components/drivers/include/drivers/usb_device.h
+2
-1
components/drivers/usb/usbdevice/class/cdc_vcom.c
components/drivers/usb/usbdevice/class/cdc_vcom.c
+71
-59
components/drivers/usb/usbdevice/class/mstorage.c
components/drivers/usb/usbdevice/class/mstorage.c
+25
-13
components/drivers/usb/usbdevice/core/core.c
components/drivers/usb/usbdevice/core/core.c
+21
-7
components/drivers/usb/usbdevice/core/usbdevice.c
components/drivers/usb/usbdevice/core/usbdevice.c
+11
-8
未找到文件。
components/drivers/include/drivers/usb_device.h
浏览文件 @
2a3f223b
...
...
@@ -166,7 +166,7 @@ struct udev_msg
};
typedef
struct
udev_msg
*
udev_msg_t
;
udevice_t
rt_usbd_device_create
(
const
char
**
str
);
udevice_t
rt_usbd_device_create
(
void
);
uconfig_t
rt_usbd_config_create
(
void
);
uclass_t
rt_usbd_class_create
(
udevice_t
device
,
udev_desc_t
dev_desc
,
uclass_ops_t
ops
);
...
...
@@ -180,6 +180,7 @@ rt_err_t rt_usbd_post_event(struct udev_msg* msg, rt_size_t size);
rt_err_t
rt_usbd_free_device
(
udevice_t
device
);
rt_err_t
rt_usbd_device_set_controller
(
udevice_t
device
,
udcd_t
dcd
);
rt_err_t
rt_usbd_device_set_descriptor
(
udevice_t
device
,
udev_desc_t
dev_desc
);
rt_err_t
rt_usbd_device_set_string
(
udevice_t
device
,
const
char
**
ustring
);
rt_err_t
rt_usbd_device_add_config
(
udevice_t
device
,
uconfig_t
cfg
);
rt_err_t
rt_usbd_config_add_class
(
uconfig_t
cfg
,
uclass_t
cls
);
rt_err_t
rt_usbd_class_add_interface
(
uclass_t
cls
,
uintf_t
intf
);
...
...
components/drivers/usb/usbdevice/class/cdc_vcom.c
浏览文件 @
2a3f223b
...
...
@@ -132,6 +132,16 @@ const static struct ucdc_data_descriptor _data_desc =
0x00
,
};
const
static
char
*
_ustring
[]
=
{
"Language"
,
"RT-Thread Team."
,
"RTT Virtual Serial"
,
"1.1.0"
,
"Configuration"
,
"Interface"
,
};
/**
* This function will handle cdc bulk in endpoint request.
*
...
...
@@ -438,6 +448,8 @@ uclass_t rt_usbd_class_cdc_create(udevice_t device)
/* parameter check */
RT_ASSERT
(
device
!=
RT_NULL
);
/* set usb device string description */
rt_usbd_device_set_string
(
device
,
_ustring
);
/* create a cdc class */
cdc
=
rt_usbd_class_create
(
device
,
&
dev_desc
,
&
ops
);
/* create a cdc class endpoints collection */
...
...
components/drivers/usb/usbdevice/class/mstorage.c
浏览文件 @
2a3f223b
...
...
@@ -79,6 +79,16 @@ const static struct umass_descriptor _mass_desc =
0x00
,
//bInterval;
};
const
static
char
*
_ustring
[]
=
{
"Language"
,
"RT-Thread Team."
,
"RTT Mass Storage"
,
"1.1.0"
,
"Configuration"
,
"Interface"
,
};
/**
* This function will allocate an usb device instance from system.
*
...
...
@@ -562,6 +572,8 @@ uclass_t rt_usbd_class_mstorage_create(udevice_t device)
/* parameter check */
RT_ASSERT
(
device
!=
RT_NULL
);
/* set usb device string description */
rt_usbd_device_set_string
(
device
,
_ustring
);
/* create a mass storage class */
mstorage
=
rt_usbd_class_create
(
device
,
&
dev_desc
,
&
ops
);
/* create a mass storage endpoints collection */
...
...
components/drivers/usb/usbdevice/core/core.c
浏览文件 @
2a3f223b
...
...
@@ -612,13 +612,10 @@ rt_err_t _sof_notify(udevice_t device)
*
* @return an usb device object on success, RT_NULL on fail.
*/
udevice_t
rt_usbd_device_create
(
const
char
**
ustring
)
udevice_t
rt_usbd_device_create
(
void
)
{
udevice_t
udevice
;
/* parameter check */
RT_ASSERT
(
ustring
!=
RT_NULL
);
RT_DEBUG_LOG
(
RT_DEBUG_USB
,
(
"rt_usbd_device_create
\n
"
));
/* allocate memory for the object */
...
...
@@ -630,9 +627,6 @@ udevice_t rt_usbd_device_create(const char** ustring)
}
rt_memset
(
udevice
,
0
,
sizeof
(
struct
udevice
));
/* set string descriptor array to the device object */
udevice
->
str
=
ustring
;
/* to initialize configuration list */
rt_list_init
(
&
udevice
->
cfg_list
);
...
...
@@ -642,6 +636,26 @@ udevice_t rt_usbd_device_create(const char** ustring)
return
udevice
;
}
/**
* This function will set usb device string description.
*
* @param device the usb device object.
* @param ustring pointer to string pointer array.
*
* @return RT_EOK.
*/
rt_err_t
rt_usbd_device_set_string
(
udevice_t
device
,
const
char
**
ustring
)
{
/* parameter check */
RT_ASSERT
(
device
!=
RT_NULL
);
RT_ASSERT
(
ustring
!=
RT_NULL
);
/* set string descriptor array to the device object */
device
->
str
=
ustring
;
return
RT_EOK
;
}
/**
* This function will set an usb controller driver to a device.
*
...
...
components/drivers/usb/usbdevice/core/usbdevice.c
浏览文件 @
2a3f223b
...
...
@@ -18,15 +18,17 @@
#ifdef RT_USING_USB_DEVICE
#ifdef RT_USB_DEVICE_COMPOSITE
const
static
char
*
ustring
[]
=
{
"Language"
,
"RT-Thread Team."
,
"RT
-Thread
Device"
,
"RT
T Composite
Device"
,
"1.1.0"
,
"Configuration"
,
"Interface"
,
};
#endif
#ifdef RT_USB_DEVICE_COMPOSITE
static
struct
udevice_descriptor
compsit_desc
=
...
...
@@ -68,7 +70,7 @@ rt_err_t rt_usb_device_init(const char* udc_name)
rt_usbd_core_init
();
/* create a device object */
udevice
=
rt_usbd_device_create
(
ustring
);
udevice
=
rt_usbd_device_create
();
/* set usb controller driver to the device */
rt_usbd_device_set_controller
(
udevice
,
(
udcd_t
)
udc
);
...
...
@@ -101,6 +103,7 @@ rt_err_t rt_usb_device_init(const char* udc_name)
/* set device descriptor to the device */
#ifdef RT_USB_DEVICE_COMPOSITE
rt_usbd_device_set_descriptor
(
udevice
,
&
compsit_desc
);
rt_usbd_device_set_string
(
udevice
,
ustring
);
#else
rt_usbd_device_set_descriptor
(
udevice
,
cls
->
dev_desc
);
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录