24 #if (HARDWARE != SIMULATION)
31 #define STDIN_FILENO 0
35 #define STDOUT_FILENO 1
38 struct termios TerminalAttr;
39 struct termios TerminalSavedAttr;
41 RESULT TerminalResult = FAIL;
48 if (tcgetattr(STDIN_FILENO,&TerminalAttr) >= 0)
50 TerminalSavedAttr = TerminalAttr;
52 TerminalAttr.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG);
53 TerminalAttr.c_lflag |= ECHO;
54 TerminalAttr.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON);
55 TerminalAttr.c_cflag &= ~(CSIZE | PARENB);
56 TerminalAttr.c_cflag |= CS8;
57 TerminalAttr.c_oflag &= ~(OPOST);
59 TerminalAttr.c_cc[VMIN] = 0;
60 TerminalAttr.c_cc[VTIME] = 0;
62 if (tcsetattr(STDIN_FILENO,TCSANOW,&TerminalAttr) >= 0)
67 TerminalResult = Result;
75 #ifdef DEBUG_TRACE_KEY
76 static int OldTmp = 1;
81 if (TerminalResult == OK)
85 Tmp = read(STDIN_FILENO,pData,1);
89 #ifdef DEBUG_TRACE_KEY
90 printf(
"[%c]",(
char)*pData);
94 #ifdef DEBUG_TRACE_KEY
112 if (TerminalResult == OK)
114 if (write(STDOUT_FILENO,pData,(
size_t)Cnt) != Cnt)
116 TerminalResult = FAIL;
126 if (TerminalResult == OK)
128 tcsetattr(STDIN_FILENO,TCSAFLUSH,&TerminalSavedAttr);
130 TerminalResult = FAIL;
RESULT dTerminalExit(void)
RESULT dTerminalWrite(UBYTE *pData, UWORD Cnt)
RESULT dTerminalRead(UBYTE *pData)
unsigned char UBYTE
Basic Type used to symbolise 8 bit unsigned values.
unsigned short UWORD
Basic Type used to symbolise 16 bit unsigned values.
RESULT dTerminalInit(void)