Lines Matching refs:fd
64 int fd; in open_comm() local
65 fd = open(name, O_RDWR | O_NOCTTY | O_NONBLOCK, 0); in open_comm()
66 if(fd == -1) in open_comm()
73 rt_kprintf("Open %s success,fd:%d\n",name,fd); in open_comm()
76 return fd; in open_comm()
79 void close_comm(int fd) in close_comm() argument
81 if(fd != -1) in close_comm()
83 close(fd); in close_comm()
87 void config_comm(int fd, int speed_baud_rate, char parity, int data_bits, int stop_bits) in config_comm() argument
148 tcflush(fd,TCIFLUSH); in config_comm()
152 if( tcsetattr(fd, TCSANOW, &new_tc) != 0) in config_comm()
158 int recv_comm(int fd, unsigned char *buffer, rt_size_t size, struct timeval *timeout) in recv_comm() argument
170 if(fd == -1) in recv_comm()
191 FD_SET(fd, &readSet); in recv_comm()
193 ret = select(fd+1,&readSet,RT_NULL,RT_NULL,&t); in recv_comm()
218 if(FD_ISSET(fd, &readSet)) in recv_comm()
221 ioctl(fd, FIONREAD, &drv_recved); in recv_comm()
227 recved = read(fd, c, drv_recved); in recv_comm()
260 int send_comm(int fd, const unsigned char *buffer, rt_size_t size) in send_comm() argument
264 if(fd == -1) in send_comm()
270 write(fd, buffer, size); in send_comm()
275 int flush_comm(int fd) in flush_comm() argument
277 if(fd == -1) in flush_comm()
281 tcflush(fd,TCIFLUSH); in flush_comm()
288 int fd = -1; in termios_test_entry() local
292 if((fd = open_comm(pTerm->dev)) == -1) in termios_test_entry()
303 config_comm(fd, pTerm->baud_rate, Default_parity, 8, 1); in termios_test_entry()
305 flush_comm(fd); in termios_test_entry()
309 len = recv_comm(fd, pBuf, 10, RT_NULL); in termios_test_entry()
313 send_comm(fd, pBuf, len); in termios_test_entry()
316 close_comm(fd); in termios_test_entry()