#ifndef __AI8051U_UART_H__
#define __AI8051U_UART_H__

#include "type.h"
#include "global.h"

#define TIMEOUT				40UL

typedef enum
{
    Uart1_Tx = 128, /* 串口1发送缓冲区数组最大长度 */
    Uart2_Tx = 64,  /* 串口2发送缓冲区数组最大长度 */
    Uart3_Tx = 64,  /* 串口3发送缓冲区数组最大长度 */
    Uart4_Tx = 64,  /* 串口4发送缓冲区数组最大长度 */
    Uart1_Rx = 128, /* 串口1接收缓冲区数组最大长度 */
    Uart2_Rx = 64,  /* 串口2接收缓冲区数组最大长度 */
    Uart3_Rx = 128, /* 串口3接收缓冲区数组最大长度 */
    Uart4_Rx = 24    /* 串口4接收缓冲区数组最大长度 */
}uart_len;

extern uint8_t xdata uart1_tx_buff[Uart1_Tx];
extern uint8_t xdata uart1_rx_buff[Uart1_Rx];		

//uint8_t xdata uart2_tx_buff[Uart2_Tx];
extern uint8_t xdata uart2_rx_buff[Uart2_Rx];	

extern uint8_t xdata uart3_tx_buff[Uart3_Tx];
extern uint8_t xdata uart3_rx_buff[Uart3_Rx];		

extern uint8_t xdata uart4_tx_buff[Uart4_Tx];
extern uint8_t xdata uart4_rx_buff[Uart4_Rx];	

void uart1_init(uint32 baud);
void uart2_init(uint32 baud);
void uart3_init(uint32 baud);
void uart4_init(uint32 baud);

void uart1_SendByte(char dat);
void uart1_Sendstring(char *p);

void uart2_SendByte(char dat);
void uart2_Sendstring(char *p);

void uart4_SendByte(char dat);
void uart4_Sendstring(char *p);

#endif