uart_comm.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef __UART_COMM_H__
  2. #define __UART_COMM_H__
  3. #define MAIN_BOARD 0x00
  4. #define HMI_BOARD 0x01
  5. #define PDA_BOARD 0x02
  6. #define GPRS_BOARD 0x03
  7. #define MAINTAIN_BOARD 0x04
  8. #define UART_FRAME_LEN 256
  9. #define UART_MAX_INST_BUFS 32
  10. extern bool hmi_status;
  11. typedef struct UART_INST
  12. {
  13. BYTE flag;
  14. BYTE len;
  15. BYTE para[256];
  16. }UART_INST_DEF;
  17. typedef struct UART_INST_BUF
  18. {
  19. BYTE tail;
  20. BYTE head;
  21. UART_INST_DEF tInst[UART_MAX_INST_BUFS];
  22. }UART_INST_BUF_DEF;
  23. typedef struct UART_COMM_STRUCT
  24. {
  25. BYTE type;
  26. BYTE cTypeCounter;
  27. BYTE cRecvLenth;
  28. BYTE cRecvCnt;
  29. BYTE cSendLenth;
  30. BYTE cSendCnt;
  31. BYTE sum;
  32. bool bData;
  33. bool bSend;
  34. BYTE src_addr;
  35. BYTE dst_addr;
  36. BYTE arrSendBuf[UART_FRAME_LEN];
  37. BYTE arrRecvBuf[UART_FRAME_LEN];
  38. }UART_COMM_STRUCT;
  39. int Add_Uart_Frame(int prior,int len,BYTE *para) ;
  40. void uart_comm_init(UART_COMM_STRUCT *pt,BYTE chnl);
  41. void Reset_Uart_Link(UART_COMM_STRUCT *pt);
  42. void Uart_Comm_Send(void);
  43. void Uart_Comm_Recv(void);
  44. void Sub_Uart_Frame(int board ) ;
  45. #endif