uart_user.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /******************************************************************************
  2. 版权所有:
  3. 文件名称: uart.c
  4. 文件版本: 01.01
  5. 创建作者:
  6. 创建日期: 2008-06-25
  7. 功能说明: UART驱动程序头文件
  8. 其它说明:
  9. 修改记录:
  10. */
  11. #ifndef __UART_H__
  12. #define __UART_H__
  13. /*------------------------------ 头文件 -------------------------------------
  14. */
  15. #include "bspconfig.h"
  16. /*------------------------------ 宏定义 -------------------------------------
  17. */
  18. //奇偶校验宏定义
  19. #ifndef PARITY_NONE
  20. #define PARITY_NONE 0 // 无校验
  21. #endif
  22. #ifndef PARITY_EVEN
  23. #define PARITY_EVEN 1 // 偶校验
  24. #endif
  25. #ifndef PARITY_ODD
  26. #define PARITY_ODD 2 // 奇校验
  27. #endif
  28. #ifndef PARITY_NONE_1
  29. #define PARITY_NONE_1 0 // 无校验
  30. #endif
  31. // 内核输出此变量,让应用不使用控制台串口
  32. extern int g_con_uart_index;
  33. extern s8 UART_CHANNEL[];
  34. int uart_init(void);
  35. int uart_open(int channel, uint32_t baudRate,int setting);
  36. void uart_close(int channel);
  37. int uart_select(int channel);
  38. char uart_getchar (int channel);
  39. void uart_putchar (int channel, char ch);
  40. void uart_puts (int channel,char *ch);
  41. int uart_write(int channel, const char *data, int count);
  42. int uart_read(int channel, char *data, int count);
  43. int uart_test(void);
  44. #endif /* __UART_H__ */
  45. /*------------------------------ 文件结束 -------------------------------------
  46. */