精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
锐英源精品开源心得,转载请注明:“锐英源www.wisestudy.cn,孙老师作品,电话13803810136。”需要全文内容也请联系孙老师。
VxWorks是实时操作系统,不面向普通用户,面向特别行业。国内资料比较少,这里翻译些和我项目有关的外文资料。
Could anyone be kind enough to help me out with the following ? Thanks a lot, (its a kind of long message, sorry for that)
I recently changed from Tornado1 to TornadoII.2. And as is expected
not all code works instantly. Especially troublesome at the moment is
the fact that I am unable to read in (for processing)keyboard input at
the target side.我最近从Tornado1改为TornadoII.2。正如预期的那样并非所有代码都能立即生效,特别麻烦的是我在目标方无法读入(用于处理)键盘输入。
of course when making the bootdisk i included in config.h :
#INCLUDE_PC_CONSOLE and also in the vxworks kernel (PC_CONSOLE was
selected (BAUDRATE 9600 - N_VIRTUAL_CONSOLE (2) - PC_CONSOLE (0)).
and after initialisation i can actually use the keyboard and see the typed results on the monitor. Checking the devices i see
当然,当我制作bootdisk时,我在config.h中包含了:
#INCLUDE_PC_CONSOLE以及vxworks内核(PC_CONSOLE被选择(BAUDRATE 9600 - N_VIRTUAL_CONSOLE(2) - PC_CONSOLE(0))。
初始化后,我可以实际使用键盘,看看在监视器上键入结果。检查我看到的设备
-> devs
drv name
0 /null
1 /tyCo/0
1 /tyCo/1
2 /pcConsole/0
2 /pcConsole/1
4 /fd0
6 lizard:
7 /vio
so far, everything normal. Now, when i try to read in the pushed keys
on the keyboard i fail !!! (following code worked in Tornado1 !?!).
This, although i can see them actually being displayed on the monitor,
and by setting ioctl (0, FIOSETOPTIONS, OPT_TERMINAL & ~OPT_LINE); i
can see them even twice. Now, the code which used to work (Tornado1)
is simply
到目前为止,一切正常。现在,当我尝试读入按键时,我失败了!(以下代码在Tornado1中工作!?!)。
这个,虽然我可以看到它们实际显示在显示器上,并通过设置ioctl(0,FIOSETOPTIONS,OPT_TERMINAL和~OPT_LINE); 我甚至可以看到他们出现两次。现在,以前的代码(Tornado1)很简单
/* Save options */
options = ioctl(0, FIOGETOPTIONS, 0);
/* Enter raw mode */
ioctl (0, FIOSETOPTIONS, OPT_TERMINAL & ~OPT_LINE & ~OPT_ECHO);
while(!(key = keyhit())){;} /* just a waiting loop. */
ioctl (0, FIOSETOPTIONS, options);
with
int keyhit(void)
{
int nread,rc,oneChar=0;
/* probe STDIN to see if operator entered any characters */
rc = ioctl(0, FIONREAD, (int) &nread);
assert(rc != ERROR);
if (nread)
{ /* got a char */
/* flush all the characters entered */
for (; nread; nread--)
oneChar=getchar();
return oneChar;
}
return 0;
} /* keyhit */
I tried already a lot of stuff, but all fail. The system does not read the data and the task is pending.
ps: getchar() also makes the system PENDING, without result. I tried
to use the code in bootConfig.c where automatic boot of the system ca
n be prevented by a keyboard hit, but also this was unsuccesfull.
Question, i suppose STDIN has fp=0, and ioctl (0, FIOSETOPTIONS,
OPT_TERMINAL & ~OPT_LINE)seems to confirm this (by duplicating the
input of the keyboard), this is correct, right ?
我已经尝试了很多东西,但都失败了。系统无法读取数据,任务正在等待中。
ps:getchar()也使系统PENDING,没有结果。我试过了使用bootConfig.c中的代码,里面系统自启动能被键盘按键阻止,但这也是不成功的。
问题,我想STDIN有fp = 0和ioctl(0,FIOSETOPTIONS,
OPT_TERMINAL&~OPT_LINE)似乎证实了这一点(通过复制输入键盘),这是对的,对吗?
Every help is welcome ! Please show me some light at the
end of this tunnel,
could you use the device 1 as standinput deivce,and try? i remember device0 is stand output device ,and device2 is stand error output device.
你可以使用设备1作为标准输出,并尝试?我记得device0是标准输出设备,而设备2是标准错误输出设备。
nope, the task hangs also in this case :-( By the way, i did some more
reading (newsgroup) and found some comments about functions
ioGlobalStdGet(i) and ioTaskStdGet(taskid,i) giving the fd's of both
global and task-dependend io. And strange but true if i call these for
standard input, standard output, standard error (0,1,2), they all
return the value 3 !!! Probably this has to do something with a
VIRTUAL CONSOLE or something ? What do you think ?
不,在这种情况下任务也挂起:-(顺便说一句,我做了一些阅读(新闻组)并找到一些关于功能的评论ioGlobalStdGet(i)和ioTaskStdGet(taskid,i)向fd提供了
全局和任务依赖的io。如果我针对标准输入,标准输出,标准误差(0,1,2)调用这2个函数,它们都是返回值3,很奇怪但确实哪样。可能这需要对VIRTUAL CONSOLE 做一些事情
还是什么?你怎么看 ?
Manu,