Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dgr6878
rt-thread
提交
713b1f00
R
rt-thread
项目概览
dgr6878
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
713b1f00
编写于
5月 12, 2013
作者:
qiuyiuestc
提交者:
heyuanjie87
5月 16, 2013
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #87 from grissiom/static-usbd
Static usbd
上级
f1e34eef
b3e38f53
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
37 addition
and
17 deletion
+37
-17
components/drivers/include/drivers/usb_common.h
components/drivers/include/drivers/usb_common.h
+14
-0
components/drivers/usb/usbdevice/core/core.c
components/drivers/usb/usbdevice/core/core.c
+23
-17
未找到文件。
components/drivers/include/drivers/usb_common.h
浏览文件 @
713b1f00
...
...
@@ -374,6 +374,20 @@ typedef struct ustorage_csw* ustorage_csw_t;
#pragma pack()
/*
* USB device event loop thread configurations
*/
/* the stack size of USB thread */
#ifndef RT_USBD_THREAD_STACK_SZ
#define RT_USBD_THREAD_STACK_SZ 2048
#endif
/* the priority of USB thread */
#ifndef RT_USBD_THREAD_PRIO
#define RT_USBD_THREAD_PRIO 8
#endif
#ifdef __cplusplus
}
#endif
...
...
components/drivers/usb/usbdevice/core/core.c
浏览文件 @
713b1f00
...
...
@@ -1274,7 +1274,7 @@ rt_err_t rt_usbd_set_config(udevice_t device, rt_uint8_t value)
return
RT_TRUE
;
}
static
struct
rt_messagequeue
*
usb_mq
;
static
struct
rt_messagequeue
usb_mq
;
/**
* This function is the main entry of usb device thread, it is in charge of
...
...
@@ -1294,7 +1294,7 @@ static void rt_usbd_thread_entry(void* parameter)
uep_t
ep
;
/* receive message */
if
(
rt_mq_recv
(
usb_mq
,
if
(
rt_mq_recv
(
&
usb_mq
,
&
msg
,
sizeof
(
struct
udev_msg
),
RT_WAITING_FOREVER
)
!=
RT_EOK
)
continue
;
...
...
@@ -1341,9 +1341,20 @@ rt_err_t rt_usbd_post_event(struct udev_msg* msg, rt_size_t size)
RT_ASSERT
(
msg
!=
RT_NULL
);
/* send message to usb message queue */
return
rt_mq_send
(
usb_mq
,
(
void
*
)
msg
,
size
);
return
rt_mq_send
(
&
usb_mq
,
(
void
*
)
msg
,
size
);
}
ALIGN
(
RT_ALIGN_SIZE
)
static
rt_uint8_t
usb_thread_stack
[
RT_USBD_THREAD_STACK_SZ
];
static
struct
rt_thread
usb_thread
;
#define USBD_MQ_MSG_SZ 32
#define USBD_MQ_MAX_MSG 16
/* internal of the message queue: every message is associated with a pointer,
* so in order to recveive USBD_MQ_MAX_MSG messages, we have to allocate more
* than USBD_MQ_MSG_SZ*USBD_MQ_MAX_MSG memery. */
static
rt_uint8_t
usb_mq_pool
[(
USBD_MQ_MSG_SZ
+
sizeof
(
void
*
))
*
USBD_MQ_MAX_MSG
];
/**
* This function will initialize usb device thread.
*
...
...
@@ -1352,21 +1363,16 @@ rt_err_t rt_usbd_post_event(struct udev_msg* msg, rt_size_t size)
*/
rt_err_t
rt_usbd_core_init
(
void
)
{
rt_thread_t
thread
;
rt_list_init
(
&
device_list
);
/* create an usb message queue */
usb_mq
=
rt_mq_create
(
"usbd"
,
32
,
16
,
RT_IPC_FLAG_FIFO
);
/* create usb device thread */
thread
=
rt_thread_create
(
"usbd"
,
rt_usbd_thread_entry
,
RT_NULL
,
2048
,
8
,
20
);
if
(
thread
!=
RT_NULL
)
{
/* startup usb device thread */
rt_thread_startup
(
thread
);
}
return
RT_EOK
;
rt_mq_init
(
&
usb_mq
,
"usbd"
,
usb_mq_pool
,
USBD_MQ_MSG_SZ
,
sizeof
(
usb_mq_pool
),
RT_IPC_FLAG_FIFO
);
/* init usb device thread */
rt_thread_init
(
&
usb_thread
,
"usbd"
,
rt_usbd_thread_entry
,
RT_NULL
,
usb_thread_stack
,
RT_USBD_THREAD_STACK_SZ
,
RT_USBD_THREAD_PRIO
,
20
);
/* rt_thread_init should always be OK, so start the thread without further
* checking. */
return
rt_thread_startup
(
&
usb_thread
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录