// uart_lib.h #ifndef UART_LIB_H #define UART_LIB_H #ifdef __cplusplus extern "C" { #endif #include #include /*Unix 标准函数定义*/ #include #include #include /*文件控制定义*/ #include /*POSIX 终端控制定义*/ #include /*错误号定义*/ #include /*字符串功能函数*/ #include /* perror */ typedef int UART_HANDLE; extern const UART_HANDLE UART_INVALID_HANDLE; // 初始化/反初始化 UART_HANDLE UartInit(const char *dev, int baudrate, int byteSize, int stopBits, int parity); int UartUninit(UART_HANDLE handle); // 数据收发 int UartSend(UART_HANDLE handle, const void *buf, size_t size); int UartRecv(UART_HANDLE handle, void *buf, size_t size); #ifdef __cplusplus } #endif #endif // UART_LIB_H