Serial.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /********************************************************************************
  2. * File Name: Serial.h
  3. * Function Describe: Header file for Serial.c
  4. * Explain:
  5. * Writer: ShiLiangWen
  6. * Date: 2015-1-30
  7. *******************************************************************************/
  8. #ifndef _Serial_H__
  9. #define _Serial_H__
  10. /***************************************************************************/
  11. #include <rtl.h>
  12. #define COM_SEL_MCU 0
  13. #define COM_SEL_GPS 1
  14. #define COM_SEL_MODEM 2
  15. typedef enum {INF = 0, DEBUG =1} TRACE_TYPE;
  16. #define UART1_RX_BUFFER_SIZE 200
  17. #define UART2_RX_BUFFER_SIZE (1024+20) //(IAP_RX_BUF+20)//+ZIPRECVU:1,256,xxx
  18. #define UART3_RX_BUFFER_SIZE 200
  19. extern unsigned char RxBuffer1[];
  20. extern unsigned char TxBuffer1[];
  21. extern unsigned short g_usUart1RecvLen;
  22. extern unsigned char RxBuffer2[];
  23. extern unsigned char TxBuffer2[];
  24. extern unsigned short g_usRx2Len;
  25. extern unsigned char g_ucUARTSel;
  26. extern unsigned char g_ucUART1RxMode;
  27. void Uart1Init(void);
  28. void Uart2Init(void);
  29. void UART1RxTxISRHandler(void);//串口1中断中回调此函数
  30. void UART2RxTxISRHandler(void);//串口2中断中回调此函数
  31. void SlwTrace(TRACE_TYPE type,char *buf,char );
  32. void ComSelect(unsigned char sel);
  33. void Uart1Send(char *txbuf,int len);
  34. void Uart2Send(unsigned char *txbuf,int len);
  35. void Uart1RxEnable(int en);
  36. void Uart1RecvProcess(void);
  37. void Uart2RecvProcess(void);
  38. //通过DMA发送
  39. void USART1_Send(char *pbuffer, unsigned short size);
  40. void USART1_SendWaitCompleted(void);
  41. void USART2_Send(char *pbuffer, unsigned short size);
  42. void USART2_SendWaitCompleted(void);
  43. void Uart3Init(void);
  44. void UART3RxTxISRHandler(void);
  45. extern unsigned short g_usRx3Len;
  46. extern unsigned short rx3_ct;
  47. extern unsigned char RxBuffer3[UART3_RX_BUFFER_SIZE];
  48. /***************************************************************************/
  49. #endif