fm3_uart.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * File : fm3_uart.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2006-03-13 Bernard first version
  13. * 2011-05-15 lgnq modified according bernard's implementaion.
  14. */
  15. #ifndef __FM3_UART_H__
  16. #define __FM3_UART_H__
  17. #include <rtthread.h>
  18. #include "mb9bf506r.h"
  19. #define SMR_SOE 0x01U
  20. #define SMR_BDS 0x04U
  21. #define SMR_SBL 0x08U
  22. #define SMR_WUCR 0x10U
  23. #define SMR_MD_UART 0x00U
  24. #define SMR_MD_UART_MP 0x20U
  25. #define SMR_MD_SIO 0x40U
  26. #define SMR_MD_LIN 0x60U
  27. #define SMR_MD_I2C 0x80U
  28. #define SCR_TXE 0x01U
  29. #define SCR_RXE 0x02U
  30. #define SCR_TBIE 0x04U
  31. #define SCR_TIE 0x08U
  32. #define SCR_RIE 0x10U
  33. #define SCR_UPGL 0x80U
  34. #define SSR_TBI 0x01U
  35. #define SSR_TDRE 0x02U
  36. #define SSR_RDRF 0x04U
  37. #define SSR_ORE 0x08U
  38. #define SSR_FRE 0x10U
  39. #define SSR_PE 0x20U
  40. #define SSR_REC 0x80U
  41. #define ESCR_P 0x08U
  42. #define ESCR_PEN 0x10U
  43. #define ESCR_INV 0x20U
  44. #define ESCR_ESBL 0x40U
  45. #define ESCR_FLWEN 0x80U
  46. #define ESCR_DATABITS_8 0x00U
  47. #define ESCR_DATABITS_5 0x01U
  48. #define ESCR_DATABITS_6 0x02U
  49. #define ESCR_DATABITS_7 0x03U
  50. #define ESCR_DATABITS_9 0x04U
  51. #define FIFO_SIZE 16
  52. /*
  53. * Enable/DISABLE Interrupt Controller
  54. */
  55. /* deviation from MISRA-C:2004 Rule 19.7 */
  56. #define UART_ENABLE_IRQ(n) NVIC_EnableIRQ((n))
  57. #define UART_DISABLE_IRQ(n) NVIC_DisableIRQ((n))
  58. struct uart03_device
  59. {
  60. FM3_MFS03_UART_TypeDef *uart_regs;
  61. /* irq number */
  62. IRQn_Type rx_irq;
  63. IRQn_Type tx_irq;
  64. };
  65. struct uart47_device
  66. {
  67. FM3_MFS47_UART_TypeDef *uart_regs;
  68. /* irq number */
  69. IRQn_Type rx_irq;
  70. IRQn_Type tx_irq;
  71. rt_uint8_t fifo_size;
  72. };
  73. void rt_hw_serial_init(void);
  74. #endif