uart.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * uart.h -- ColdFire internal UART support defines.
  3. *
  4. * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
  5. * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. */
  9. /****************************************************************************/
  10. #ifndef uart_h
  11. #define uart_h
  12. /****************************************************************************/
  13. /* UART module registers */
  14. /* Register read/write struct */
  15. typedef struct uart {
  16. u8 umr; /* 0x00 Mode Register */
  17. u8 resv0[0x3];
  18. union {
  19. u8 usr; /* 0x04 Status Register */
  20. u8 ucsr; /* 0x04 Clock Select Register */
  21. };
  22. u8 resv1[0x3];
  23. u8 ucr; /* 0x08 Command Register */
  24. u8 resv2[0x3];
  25. union {
  26. u8 utb; /* 0x0c Transmit Buffer */
  27. u8 urb; /* 0x0c Receive Buffer */
  28. };
  29. u8 resv3[0x3];
  30. union {
  31. u8 uipcr; /* 0x10 Input Port Change Register */
  32. u8 uacr; /* 0x10 Auxiliary Control reg */
  33. };
  34. u8 resv4[0x3];
  35. union {
  36. u8 uimr; /* 0x14 Interrupt Mask reg */
  37. u8 uisr; /* 0x14 Interrupt Status reg */
  38. };
  39. u8 resv5[0x3];
  40. u8 ubg1; /* 0x18 Counter Timer Upper Register */
  41. u8 resv6[0x3];
  42. u8 ubg2; /* 0x1c Counter Timer Lower Register */
  43. u8 resv7[0x17];
  44. u8 uip; /* 0x34 Input Port Register */
  45. u8 resv8[0x3];
  46. u8 uop1; /* 0x38 Output Port Set Register */
  47. u8 resv9[0x3];
  48. u8 uop0; /* 0x3c Output Port Reset Register */
  49. } uart_t;
  50. /*********************************************************************
  51. * Universal Asynchronous Receiver Transmitter (UART)
  52. *********************************************************************/
  53. /* Bit definitions and macros for UMR */
  54. #define UART_UMR_BC(x) (((x)&0x03))
  55. #define UART_UMR_PT (0x04)
  56. #define UART_UMR_PM(x) (((x)&0x03)<<3)
  57. #define UART_UMR_ERR (0x20)
  58. #define UART_UMR_RXIRQ (0x40)
  59. #define UART_UMR_RXRTS (0x80)
  60. #define UART_UMR_SB(x) (((x)&0x0F))
  61. #define UART_UMR_TXCTS (0x10) /* Trsnsmit CTS */
  62. #define UART_UMR_TXRTS (0x20) /* Transmit RTS */
  63. #define UART_UMR_CM(x) (((x)&0x03)<<6) /* CM bits */
  64. #define UART_UMR_PM_MULTI_ADDR (0x1C)
  65. #define UART_UMR_PM_MULTI_DATA (0x18)
  66. #define UART_UMR_PM_NONE (0x10)
  67. #define UART_UMR_PM_FORCE_HI (0x0C)
  68. #define UART_UMR_PM_FORCE_LO (0x08)
  69. #define UART_UMR_PM_ODD (0x04)
  70. #define UART_UMR_PM_EVEN (0x00)
  71. #define UART_UMR_BC_5 (0x00)
  72. #define UART_UMR_BC_6 (0x01)
  73. #define UART_UMR_BC_7 (0x02)
  74. #define UART_UMR_BC_8 (0x03)
  75. #define UART_UMR_CM_NORMAL (0x00)
  76. #define UART_UMR_CM_ECH (0x40)
  77. #define UART_UMR_CM_LOCAL_LOOP (0x80)
  78. #define UART_UMR_CM_REMOTE_LOOP (0xC0)
  79. #define UART_UMR_SB_STOP_BITS_1 (0x07)
  80. #define UART_UMR_SB_STOP_BITS_15 (0x08)
  81. #define UART_UMR_SB_STOP_BITS_2 (0x0F)
  82. /* Bit definitions and macros for USR */
  83. #define UART_USR_RXRDY (0x01)
  84. #define UART_USR_FFULL (0x02)
  85. #define UART_USR_TXRDY (0x04)
  86. #define UART_USR_TXEMP (0x08)
  87. #define UART_USR_OE (0x10)
  88. #define UART_USR_PE (0x20)
  89. #define UART_USR_FE (0x40)
  90. #define UART_USR_RB (0x80)
  91. /* Bit definitions and macros for UCSR */
  92. #define UART_UCSR_TCS(x) (((x)&0x0F))
  93. #define UART_UCSR_RCS(x) (((x)&0x0F)<<4)
  94. #define UART_UCSR_RCS_SYS_CLK (0xD0)
  95. #define UART_UCSR_RCS_CTM16 (0xE0)
  96. #define UART_UCSR_RCS_CTM (0xF0)
  97. #define UART_UCSR_TCS_SYS_CLK (0x0D)
  98. #define UART_UCSR_TCS_CTM16 (0x0E)
  99. #define UART_UCSR_TCS_CTM (0x0F)
  100. /* Bit definitions and macros for UCR */
  101. #define UART_UCR_RXC(x) (((x)&0x03))
  102. #define UART_UCR_TXC(x) (((x)&0x03)<<2)
  103. #define UART_UCR_MISC(x) (((x)&0x07)<<4)
  104. #define UART_UCR_NONE (0x00)
  105. #define UART_UCR_STOP_BREAK (0x70)
  106. #define UART_UCR_START_BREAK (0x60)
  107. #define UART_UCR_BKCHGINT (0x50)
  108. #define UART_UCR_RESET_ERROR (0x40)
  109. #define UART_UCR_RESET_TX (0x30)
  110. #define UART_UCR_RESET_RX (0x20)
  111. #define UART_UCR_RESET_MR (0x10)
  112. #define UART_UCR_TX_DISABLED (0x08)
  113. #define UART_UCR_TX_ENABLED (0x04)
  114. #define UART_UCR_RX_DISABLED (0x02)
  115. #define UART_UCR_RX_ENABLED (0x01)
  116. /* Bit definitions and macros for UIPCR */
  117. #define UART_UIPCR_CTS (0x01)
  118. #define UART_UIPCR_COS (0x10)
  119. /* Bit definitions and macros for UACR */
  120. #define UART_UACR_IEC (0x01)
  121. /* Bit definitions and macros for UIMR */
  122. #define UART_UIMR_TXRDY (0x01)
  123. #define UART_UIMR_RXRDY_FU (0x02)
  124. #define UART_UIMR_DB (0x04)
  125. #define UART_UIMR_COS (0x80)
  126. /* Bit definitions and macros for UISR */
  127. #define UART_UISR_TXRDY (0x01)
  128. #define UART_UISR_RXRDY_FU (0x02)
  129. #define UART_UISR_DB (0x04)
  130. #define UART_UISR_RXFTO (0x08)
  131. #define UART_UISR_TXFIFO (0x10)
  132. #define UART_UISR_RXFIFO (0x20)
  133. #define UART_UISR_COS (0x80)
  134. /* Bit definitions and macros for UIP */
  135. #define UART_UIP_CTS (0x01)
  136. /* Bit definitions and macros for UOP1 */
  137. #define UART_UOP1_RTS (0x01)
  138. /* Bit definitions and macros for UOP0 */
  139. #define UART_UOP0_RTS (0x01)
  140. /****************************************************************************/
  141. #endif /* mcfuart_h */