Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lfmiao0
rt-thread
提交
e2a0b193
R
rt-thread
项目概览
lfmiao0
/
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,发现更多精彩内容 >>
提交
e2a0b193
编写于
8月 31, 2013
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #150 from grissiom/simulator-linux
Simulator linux
上级
f7f14cf5
6563ae6c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
5 deletion
+24
-5
bsp/simulator/applications/application.c
bsp/simulator/applications/application.c
+6
-0
bsp/simulator/applications/platform.c
bsp/simulator/applications/platform.c
+0
-5
bsp/simulator/drivers/sdl_fb.c
bsp/simulator/drivers/sdl_fb.c
+18
-0
未找到文件。
bsp/simulator/applications/application.c
浏览文件 @
e2a0b193
...
@@ -30,6 +30,12 @@ void rt_init_thread_entry(void *parameter)
...
@@ -30,6 +30,12 @@ void rt_init_thread_entry(void *parameter)
/* initialization RT-Thread Components */
/* initialization RT-Thread Components */
rt_components_init
();
rt_components_init
();
#ifdef RT_USING_RTGUI
/* start sdl thread to simulate an LCD. SDL may depend on DFS and should be
* called after rt_components_init. */
rt_hw_sdl_start
();
#endif
/* RT_USING_RTGUI */
#if defined(RT_USING_COMPONENTS_INIT) && defined(__GNUC__) && defined(RT_USING_FINSH)
#if defined(RT_USING_COMPONENTS_INIT) && defined(__GNUC__) && defined(RT_USING_FINSH)
finsh_set_device
(
RT_CONSOLE_DEVICE_NAME
);
finsh_set_device
(
RT_CONSOLE_DEVICE_NAME
);
#endif
#endif
...
...
bsp/simulator/applications/platform.c
浏览文件 @
e2a0b193
...
@@ -17,11 +17,6 @@ void rt_platform_init(void)
...
@@ -17,11 +17,6 @@ void rt_platform_init(void)
#endif
/* RT_USING_DFS */
#endif
/* RT_USING_DFS */
#ifdef RT_USING_RTGUI
/* start sdl thread to simulate an LCD */
rt_hw_sdl_start
();
#endif
/* RT_USING_RTGUI */
#ifdef _WIN32
#ifdef _WIN32
rt_thread_idle_sethook
(
rt_hw_win32_low_cpu
);
rt_thread_idle_sethook
(
rt_hw_win32_low_cpu
);
#endif
#endif
...
...
bsp/simulator/drivers/sdl_fb.c
浏览文件 @
e2a0b193
...
@@ -152,8 +152,12 @@ static void sdlfb_hw_init(void)
...
@@ -152,8 +152,12 @@ static void sdlfb_hw_init(void)
#ifdef _WIN32
#ifdef _WIN32
static
HANDLE
sdl_ok_event
=
NULL
;
static
HANDLE
sdl_ok_event
=
NULL
;
static
DWORD
WINAPI
sdl_loop
(
LPVOID
lpParam
)
static
DWORD
WINAPI
sdl_loop
(
LPVOID
lpParam
)
#else
#else
static
pthread_mutex_t
sdl_ok_mutex
;
static
pthread_cond_t
sdl_ok_event
;
static
void
*
sdl_loop
(
void
*
lpParam
)
static
void
*
sdl_loop
(
void
*
lpParam
)
#endif
#endif
{
{
...
@@ -167,14 +171,19 @@ static void *sdl_loop(void *lpParam)
...
@@ -167,14 +171,19 @@ static void *sdl_loop(void *lpParam)
/* set the getchar without buffer */
/* set the getchar without buffer */
sigfillset
(
&
sigmask
);
sigfillset
(
&
sigmask
);
pthread_sigmask
(
SIG_BLOCK
,
&
sigmask
,
&
oldmask
);
pthread_sigmask
(
SIG_BLOCK
,
&
sigmask
,
&
oldmask
);
pthread_mutex_lock
(
&
sdl_ok_mutex
);
#endif
#endif
sdlfb_hw_init
();
sdlfb_hw_init
();
device
=
rt_device_find
(
"sdl"
);
device
=
rt_device_find
(
"sdl"
);
RT_ASSERT
(
device
);
rtgui_graphic_set_device
(
device
);
rtgui_graphic_set_device
(
device
);
#ifdef _WIN32
#ifdef _WIN32
SetEvent
(
sdl_ok_event
);
SetEvent
(
sdl_ok_event
);
#else
pthread_cond_signal
(
&
sdl_ok_event
);
pthread_mutex_unlock
(
&
sdl_ok_mutex
);
#endif
#endif
/* handle SDL event */
/* handle SDL event */
while
(
!
quit
)
while
(
!
quit
)
...
@@ -338,11 +347,20 @@ void rt_hw_sdl_start(void)
...
@@ -338,11 +347,20 @@ void rt_hw_sdl_start(void)
/* Linux */
/* Linux */
pthread_t
pid
;
pthread_t
pid
;
int
res
;
int
res
;
pthread_mutex_init
(
&
sdl_ok_mutex
,
NULL
);
pthread_cond_init
(
&
sdl_ok_event
,
NULL
);
res
=
pthread_create
(
&
pid
,
NULL
,
&
sdl_loop
,
NULL
);
res
=
pthread_create
(
&
pid
,
NULL
,
&
sdl_loop
,
NULL
);
if
(
res
)
if
(
res
)
{
{
printf
(
"pthread create sdl thread faild, <%d>
\n
"
,
res
);
printf
(
"pthread create sdl thread faild, <%d>
\n
"
,
res
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
pthread_mutex_lock
(
&
sdl_ok_mutex
);
pthread_cond_wait
(
&
sdl_ok_event
,
&
sdl_ok_mutex
);
pthread_mutex_destroy
(
&
sdl_ok_mutex
);
pthread_cond_destroy
(
&
sdl_ok_event
);
#endif
#endif
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录