Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yunqingabc
rt-thread
提交
8f70786c
R
rt-thread
项目概览
yunqingabc
/
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,发现更多精彩内容 >>
提交
8f70786c
编写于
1月 14, 2013
作者:
P
prife
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add finsh, but still cannot work, only can be built with gcc
上级
7b42f926
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
58 addition
and
11 deletion
+58
-11
bsp/simlinux/drivers/SConscript
bsp/simlinux/drivers/SConscript
+2
-2
bsp/simlinux/drivers/board.c
bsp/simlinux/drivers/board.c
+5
-4
bsp/simlinux/drivers/usart_sim.c
bsp/simlinux/drivers/usart_sim.c
+49
-3
bsp/simlinux/rtconfig.h
bsp/simlinux/rtconfig.h
+1
-1
libcpu/sim/posix/cpu_port.c
libcpu/sim/posix/cpu_port.c
+1
-1
未找到文件。
bsp/simlinux/drivers/SConscript
浏览文件 @
8f70786c
...
...
@@ -12,8 +12,8 @@ if GetDepend('RT_USING_DFS') == False or GetDepend('RT_USING_MTD_NAND') == False
SrcRemove
(
src
,
'nanddrv_file.c'
)
if
GetDepend
(
'RT_USING_DFS'
)
==
False
or
GetDepend
(
'RT_USING_MTD_NOR'
)
==
False
:
SrcRemove
(
src
,
'sst25vfxx_mtd_sim.c'
)
if
GetDepend
(
'RT_USING_SERIAL'
)
==
False
:
SrcRemove
(
src
,
'usart_sim.c'
)
#
if GetDepend('RT_USING_SERIAL') == False:
#
SrcRemove(src, 'usart_sim.c')
CPPPATH
=
[
cwd
]
...
...
bsp/simlinux/drivers/board.c
浏览文件 @
8f70786c
...
...
@@ -53,15 +53,16 @@ void rt_hw_win32_low_cpu(void)
#endif
}
#if defined(RT_USING_FINSH)
#ifdef _WIN32
#ifndef _CRT_TERMINATE_DEFINED
#define _CRT_TERMINATE_DEFINED
_CRTIMP
__declspec
(
noreturn
)
void
__cdecl
exit
(
__in
int
_Code
);
_CRTIMP
__declspec
(
noreturn
)
void
__cdecl
_exit
(
__in
int
_Code
);
_CRTIMP
void
__cdecl
abort
(
void
);
#endif
#endif
#if defined(RT_USING_FINSH)
#include <finsh.h>
void
rt_hw_exit
(
void
)
{
...
...
@@ -79,9 +80,9 @@ void rt_hw_board_init()
/* init system memory */
heap
=
rt_hw_sram_init
();
#if defined(RT_USING_USART)
//
#if defined(RT_USING_USART)
rt_hw_usart_init
();
#endif
//
#endif
#if defined(RT_USING_CONSOLE)
rt_hw_serial_init
();
...
...
bsp/simlinux/drivers/usart_sim.c
浏览文件 @
8f70786c
...
...
@@ -4,16 +4,16 @@
#ifdef _WIN32
#include <windows.h>
#include <mmsystem.h>
#include <conio.h>
#endif
#include <stdio.h>
#include <conio.h>
#include "serial.h"
struct
serial_int_rx
serial_rx
;
extern
struct
rt_device
serial_device
;
#ifdef _WIN32
/*
* Handler for OSKey Thread
*/
...
...
@@ -23,7 +23,6 @@ static DWORD OSKey_ThreadID;
static
DWORD
WINAPI
ThreadforKeyGet
(
LPVOID
lpParam
);
void
rt_hw_usart_init
(
void
)
{
/*
* create serial thread that receive key input from keyboard
*/
...
...
@@ -50,9 +49,52 @@ void rt_hw_usart_init(void)
* Start OS get key Thread
*/
ResumeThread
(
OSKey_Thread
);
}
#else
/* POSIX version */
#include <pthread.h>
#include <semaphore.h>
#include <stdlib.h>
#include <termios.h>
/* for tcxxxattr, ECHO, etc */
#include <unistd.h>
/* for STDIN_FILENO */
/*simulate windows' getch(), it works!!*/
int
getch
(
void
)
{
int
ch
;
struct
termios
oldt
,
newt
;
// get terminal input's attribute
tcgetattr
(
STDIN_FILENO
,
&
oldt
);
newt
=
oldt
;
//set termios' local mode
newt
.
c_lflag
&=
~
(
ECHO
|
ICANON
);
tcsetattr
(
STDIN_FILENO
,
TCSANOW
,
&
newt
);
//read character from terminal input
ch
=
getchar
();
//recover terminal's attribute
tcsetattr
(
STDIN_FILENO
,
TCSANOW
,
&
oldt
);
return
ch
;
}
static
void
*
ThreadforKeyGet
(
void
*
lpParam
);
static
pthread_t
OSKey_Thread
;
void
rt_hw_usart_init
(
void
)
{
int
res
;
res
=
pthread_create
(
&
OSKey_Thread
,
NULL
,
&
ThreadforKeyGet
,
NULL
);
if
(
res
)
{
printf
(
"pthread create faild, <%d>
\n
"
,
res
);
exit
(
EXIT_FAILURE
);
}
}
#endif
/*
* 方向键(←): 0xe04b
* 方向键(↑): 0xe048
...
...
@@ -104,7 +146,11 @@ static int savekey(unsigned char key)
}
return
0
;
}
#ifdef _WIN32
static
DWORD
WINAPI
ThreadforKeyGet
(
LPVOID
lpParam
)
#else
static
void
*
ThreadforKeyGet
(
void
*
lpParam
)
#endif
{
unsigned
char
key
;
...
...
bsp/simlinux/rtconfig.h
浏览文件 @
8f70786c
...
...
@@ -101,7 +101,7 @@
/* #define RT_USING_MTD_NOR */
/* SECTION: finsh, a C-Express shell */
/* #define RT_USING_FINSH */
#define RT_USING_FINSH
/* Using symbol table */
#define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION
...
...
libcpu/sim/posix/cpu_port.c
浏览文件 @
8f70786c
/*
* author : prife (goprife@gmail.com)
* date : 2013/01/14 01:18:50
* version: v 0.
1
.0
* version: v 0.
2
.0
*/
#include <rtthread.h>
#include <stdio.h>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录