#ifndef __DRV_UART_H_
#define __DRV_UART_H_

#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>

#define RS485_1 "/dev/ttyS9"
#define RS485_2 "/dev/ttyS5"
#define RS485_3 "/dev/ttyS3"
#define RS485_4 "/dev/ttyS4"
#define RS485_5 "/dev/ttyS7"
#define RS485_6 "/dev/ttyS8"
#define RS485_7 "/dev/ttyS0"
#define RS485_8 "/dev/ttyXRUSB1"
#define RS485_9 "/dev/ttyXRUSB2"
#define RS485_10 "/dev/ttyXRUSB3"
#define RS485_11 "/dev/ttyXRUSB0"

#define MAX_UART_NUM     6 
#define UART_DATA_LEN    256

static struct	termios termios_old, termios_new;

//串口驱动结构体设计
typedef struct{
	int32_t fd;			//串口对应的标识符
	int32_t uartId;		//第几个串口
	int32_t baudrate;
	int32_t databit;
	int32_t sendDataLen;
	int32_t receiveDataLen;
	const char *stopbit;
	char parity;
	uint8_t sendBuffer[UART_DATA_LEN]; 		//point to send buffer
	uint8_t receiveBuffer[UART_DATA_LEN];	//point to receive buffer
}UartLib_T;

int drv_uart_open(char *dev, int32_t baudrate, int32_t databit, char parity, char stopbit);

#endif