1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- /********************************************************************************
- * File Name: Serial.h
- * Function Describe: Header file for Serial.c
- * Explain:
- * Writer: ShiLiangWen
- * Date: 2015-1-30
- *******************************************************************************/
- #ifndef _Serial_H__
- #define _Serial_H__
- /***************************************************************************/
- #include <rtl.h>
- #define COM_SEL_MCU 0
- #define COM_SEL_GPS 1
- #define COM_SEL_MODEM 2
- typedef enum {INF = 0, DEBUG =1} TRACE_TYPE;
- #define UART1_TX_USE_DMA 0
- #define UART2_TX_USE_DMA 0
- #if UART1_TX_USE_DMA==0
- #define UART1_TX_BUFFER_SIZE 1 //UART1 USE FOR PC
- #else
- #define UART1_TX_BUFFER_SIZE 200 //UART1 USE FOR PC
- #endif
- #define UART1_RX_BUFFER_SIZE 200
- #define UART3_TX_BUFFER_SIZE 1 //UART2 USE FOR GPS
- #define UART3_RX_BUFFER_SIZE 300 //(IAP_RX_BUF+20)//+ZIPRECVU:1,256,xxx
- #if UART2_TX_USE_DMA==0
- #define UART2_TX_BUFFER_SIZE 1 //UART3 USE FOR MODEM
- #else
- #define UART2_TX_BUFFER_SIZE 200 //UART3 USE FOR MODEM 200
- #endif
- #define UART2_RX_BUFFER_SIZE 1024+256 //(IAP_RX_BUF+20)//+ZIPRECVU:1,256,xxx
- extern unsigned char RxBuffer1[];
- extern unsigned char TxBuffer1[];
- extern unsigned short g_usUart1RecvLen;
- extern unsigned char RxBuffer3[];
- extern unsigned char TxBuffer3[];
- extern unsigned short g_usUart3RecvLen;
- extern unsigned char RxBuffer2[];
- extern unsigned char TxBuffer2[];
- extern unsigned short g_usRx2Len;
- extern unsigned char g_ucUARTSel;
- extern unsigned short rx1_ct;
- void Uart1Init();
- void Uart2Init(void);
- void Uart3Init(void);
- void UART1RxTxISRHandler(void);//串口1中断中回调此函数
- void UART3RxTxISRHandler(void);//串口2中断中回调此函数
- void UART2RxTxISRHandler(void);//串口3中断中回调此函数
- void SlwTrace(TRACE_TYPE type,char *buf,char needEnd);
- void ComSelect(unsigned char sel);
- void Uart1Send(char *txbuf,int len);
- void Uart2Send(unsigned char *txbuf,unsigned short len);
- void Uart1RxEnable(int en);
- void Uart1RxEnable2(int en);
- void Uart1RecvProcess(void);
- void Uart2RecvProcess(void);
- //通过DMA发送
- void USART1_Send(char *pbuffer, unsigned short size);
- void USART1_SendOK_IQ(void);
- void USART1_SendWaitCompleted(void);
- void USART2_Send(char *pbuffer, unsigned short size);
- void USART2_SendOK_IQ(void);
- void USART3_SendWaitCompleted(void);
- /***************************************************************************/
- #endif
|