#ifndef MYCOM_H #define MYCOM_H #include //printf等用到 #include //file control #include //bzero等用到 #include //exit(0)等用到 #include //sleep等用到 #include //串口应用程序必须添加的头文件 #include //定义pid_t,size等 #include //read,write,getpid等等 #include //ioctl typedef struct //define the uart value struct { char prompt; //prompt after reciving data int baudrate; //baudrate char databit; //data bits, 5, 6, 7, 8 char debug; //debug mode, 0: none, 1: debug char echo; //echo mode, 0: none, 1: echo char fctl; //flow control, 0: none, 1: hardware, 2: software char tty; //tty: 0, 1, 2, 3, 4, 5, 6, 7 char parity; //parity 0: none, 1: odd, 2: even char stopbit; //stop bits, 1, 2 //const int reserved; //reserved, must be zero int reserved; //reserved, must be zero }portinfo_t; typedef portinfo_t *pportinfo_t; //redefine the portinfo_t /**************** declaration the fuction to set the uart *******************/ int PortOpen(pportinfo_t pportinfo); //open the uart int PortSet(int fdcom, const pportinfo_t pportinfo); //set the uart void PortClose(int fdcom); //close the uart int PortSend(int fdcom, char *data, int datalen); //send the datas int PortRecv(int fdcom, char *data, int datalen, int baudrate);//receive the datas #endif // MYCOM_H