bsp_uart.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef __BSP_UART_H_
  2. #define __BSP_UART_H_
  3. #include <stdint.h>
  4. #define BAUD_1000000 0x00100011
  5. #define BAUD_921600 0x24002711
  6. #define BAUD_460800 0x12002711
  7. #define BAUD_256000 0x060007D3
  8. #define BAUD_230400 0x09002711
  9. #define BAUD_128000 0x030007D3
  10. #define BAUD_115200 0x04802711
  11. #define BAUD_57600 0x04802712
  12. #define BAUD_38400 0x04802713
  13. #define BAUD_23040 0x04802715
  14. #define BAUD_19200 0x04802716
  15. #define BAUD_14400 0x04802718
  16. #define BAUD_12800 0x04802719
  17. #define BAUD_9600 0x0480271C
  18. #define BAUD_4800 0x0240271C
  19. #define BAUD_2400 0x0120271C
  20. typedef uint32_t (*uHandler_callback)(uint8_t ch);
  21. void Init_uart(uint32_t ch , uint32_t baud);
  22. void Uart_Register_Callback(uint32_t no, uHandler_callback callback);
  23. void Uart_Send_Char(uint32_t ch, uint8_t c);
  24. void Uart_Send_String(uint32_t ch, uint8_t *s);
  25. void Uart_Send_Buf(uint32_t ch, uint8_t *s,uint32_t length);
  26. void Uart_DMA_Send(uint8_t ch,uint8_t *s,uint32_t length);
  27. #define QUEUE_SIZE (128)
  28. typedef struct
  29. {
  30. uint8_t data[QUEUE_SIZE];
  31. uint16_t head;
  32. uint16_t tail;
  33. } QUEUE_Init_TypeDef;
  34. #endif