47 #include "esos_pc_stdio.h"
52 #include <sys/select.h>
62 struct termios stored_settings;
69 void __esos_hw_signal_start_tx(
void) {
70 while (__st_TxBuffer.u16_Head != __st_TxBuffer.u16_Tail) {
71 __st_TxBuffer.u16_Tail++;
72 if (__st_TxBuffer.u16_Tail == ESOS_SERIAL_IN_EP_SIZE)
73 __st_TxBuffer.u16_Tail = 0;
76 waddch( __st_TxBuffer.pau8_Data[__st_TxBuffer.u16_Tail] );
78 printf(
"%c", __st_TxBuffer.pau8_Data[__st_TxBuffer.u16_Tail]);
85 void __esos_hw_signal_stop_tx(
void) {
97 __st_RxBuffer.u16_Head++;
98 if (__st_RxBuffer.u16_Head == ESOS_SERIAL_OUT_EP_SIZE)
99 __st_RxBuffer.u16_Head = 0;
101 __st_RxBuffer.pau8_Data[__st_RxBuffer.u16_Head] = u8_c;
114 uint8_t kbhit(
void) {
123 if (select(1, &read_fd, NULL, NULL, &tv) == -1)
126 if (FD_ISSET(0,&read_fd))
133 void set_keypress(
void) {
134 struct termios new_settings;
136 tcgetattr(0,&stored_settings);
137 new_settings = stored_settings;
140 new_settings.c_lflag &= (~ICANON);
141 new_settings.c_cc[VTIME] = 0;
142 new_settings.c_cc[VMIN] = 1;
143 new_settings.c_lflag &= (~ECHO);
144 tcsetattr(0,TCSANOW,&new_settings);
148 void reset_keypress(
void) {
149 tcsetattr(0,TCSANOW,&stored_settings);
170 void __esos_hw_InitCommSystem(
void) {
177 keypad(stdscr,
TRUE);
180 printw(
"Hello from ESOS -- the PC/Linux version w/ NCURSES\n");
184 printf (
"Hello from ESOS -- the PC/Linux version\n");
223 return ESOS_SERIAL_OUT_EP_SIZE;
251 return ESOS_SERIAL_IN_EP_SIZE;
270 uint8_t _esos_hw_GetSerialUartVersion(
void) {
271 return ESOS_COMM_SYS_SERIAL_REV;