?? init.c
字號:
/****************Portting Start *******************/
#include "string.h"
#include "vxworks.h"
#include "tylib.h"
int consoleFd;
void serial_init( )
{
consoleFd=open("/tyCo/0",O_RDWR,0666);
ioctl(consoleFd,FIOSETOPTIONS,OPT_RAW);
ioctl(consoleFd,FIOFLUSH,0);
}
/* Test if there's chars at serial port */
int sio_ischar()
{
int cnt;
ioctl (consoleFd, FIONREAD, (int) &cnt);
return cnt;
}
void Uart_SendKey(unsigned char trychar)
{
unsigned char keyout;
keyout = trychar;
write(consoleFd, &keyout, 1);
}
int Uart_GetKey(unsigned char * chp)
{
unsigned char ch;
/* last_error = 0; */
while ( !sio_ischar() )
{
taskDelay(4);
return -1;
}
read(consoleFd,&ch,1);
/* last_error = 1; */
*chp=ch;
/* printf("Uart_GetKey: Get the char %c .\n",ch);*/
return (int)ch;
}
/****************Portting End*******************/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -