Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
u010088926
rt-thread
提交
89999486
R
rt-thread
项目概览
u010088926
/
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,发现更多精彩内容 >>
提交
89999486
编写于
1月 17, 2013
作者:
P
prife
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
recover the terminal's behaviour when runing exit in finsh
上级
b8aaa6e7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
10 deletion
+28
-10
bsp/simlinux/drivers/board.c
bsp/simlinux/drivers/board.c
+16
-4
bsp/simlinux/drivers/usart_sim.c
bsp/simlinux/drivers/usart_sim.c
+12
-6
未找到文件。
bsp/simlinux/drivers/board.c
浏览文件 @
89999486
...
@@ -32,7 +32,7 @@ rt_uint8_t *rt_hw_sram_init(void)
...
@@ -32,7 +32,7 @@ rt_uint8_t *rt_hw_sram_init(void)
#ifdef _WIN32
#ifdef _WIN32
_exit
(
1
);
_exit
(
1
);
#else
#else
exit
(
1
);
exit
(
1
);
#endif
#endif
}
}
return
heap
;
return
heap
;
...
@@ -45,11 +45,11 @@ rt_uint8_t *rt_hw_sram_init(void)
...
@@ -45,11 +45,11 @@ rt_uint8_t *rt_hw_sram_init(void)
void
rt_hw_win32_low_cpu
(
void
)
void
rt_hw_win32_low_cpu
(
void
)
{
{
#ifdef _WIN32
#ifdef _WIN32
/* in windows */
/* in windows */
Sleep
(
1000
);
Sleep
(
1000
);
#else
#else
/* in linux */
/* in linux */
sleep
(
1
);
sleep
(
1
);
#endif
#endif
}
}
...
@@ -67,6 +67,18 @@ _CRTIMP void __cdecl abort(void);
...
@@ -67,6 +67,18 @@ _CRTIMP void __cdecl abort(void);
void
rt_hw_exit
(
void
)
void
rt_hw_exit
(
void
)
{
{
rt_kprintf
(
"RT-Thread, bye
\n
"
);
rt_kprintf
(
"RT-Thread, bye
\n
"
);
#if !defined(_WIN32) && defined(__GNUC__)
/* *
* getchar reads key from buffer, while finsh need an non-buffer getchar
* in windows, getch is such an function, in linux, we had to change
* the behaviour of terminal to get an non-buffer getchar.
* in usart_sim.c, set_stty is called to do this work
* */
{
extern
void
restore_stty
(
void
);
restore_stty
();
}
#endif
exit
(
0
);
exit
(
0
);
}
}
FINSH_FUNCTION_EXPORT_ALIAS
(
rt_hw_exit
,
exit
,
exit
rt
-
thread
);
FINSH_FUNCTION_EXPORT_ALIAS
(
rt_hw_exit
,
exit
,
exit
rt
-
thread
);
...
...
bsp/simlinux/drivers/usart_sim.c
浏览文件 @
89999486
...
@@ -129,19 +129,25 @@ static int savekey(unsigned char key)
...
@@ -129,19 +129,25 @@ static int savekey(unsigned char key)
static
DWORD
WINAPI
ThreadforKeyGet
(
LPVOID
lpParam
)
static
DWORD
WINAPI
ThreadforKeyGet
(
LPVOID
lpParam
)
#else
#else
static
struct
termios
oldt
,
newt
;
/*simulate windows' getch(), it works!!*/
/*simulate windows' getch(), it works!!*/
static
void
setgetchar
(
void
)
void
set_stty
(
void
)
{
{
struct
termios
oldt
,
newt
;
/* get terminal input's attribute */
// get terminal input's attribute
tcgetattr
(
STDIN_FILENO
,
&
oldt
);
tcgetattr
(
STDIN_FILENO
,
&
oldt
);
newt
=
oldt
;
newt
=
oldt
;
/
/set termios' local mode
/
* set termios' local mode */
newt
.
c_lflag
&=
~
(
ECHO
|
ICANON
);
newt
.
c_lflag
&=
~
(
ECHO
|
ICANON
);
tcsetattr
(
STDIN_FILENO
,
TCSANOW
,
&
newt
);
tcsetattr
(
STDIN_FILENO
,
TCSANOW
,
&
newt
);
}
}
void
restore_stty
(
void
)
{
/* recover terminal's attribute */
tcsetattr
(
STDIN_FILENO
,
TCSANOW
,
&
oldt
);
}
#define getch getchar
#define getch getchar
static
void
*
ThreadforKeyGet
(
void
*
lpParam
)
static
void
*
ThreadforKeyGet
(
void
*
lpParam
)
...
@@ -154,7 +160,7 @@ static void * ThreadforKeyGet(void * lpParam)
...
@@ -154,7 +160,7 @@ static void * ThreadforKeyGet(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
);
setgetchar
();
set_stty
();
#endif
#endif
(
void
)
lpParam
;
//prevent compiler warnings
(
void
)
lpParam
;
//prevent compiler warnings
for
(;;)
for
(;;)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录