hw_uart.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. //###########################################################################
  2. //
  3. // FILE: hw_uart.h
  4. //
  5. // TITLE: Definitions for the C28x SCI registers.
  6. //
  7. //###########################################################################
  8. // $TI Release: F2837xD Support Library v3.05.00.00 $
  9. // $Release Date: Tue Jun 26 03:15:23 CDT 2018 $
  10. // $Copyright:
  11. // Copyright (C) 2013-2018 Texas Instruments Incorporated - http://www.ti.com/
  12. //
  13. // Redistribution and use in source and binary forms, with or without
  14. // modification, are permitted provided that the following conditions
  15. // are met:
  16. //
  17. // Redistributions of source code must retain the above copyright
  18. // notice, this list of conditions and the following disclaimer.
  19. //
  20. // Redistributions in binary form must reproduce the above copyright
  21. // notice, this list of conditions and the following disclaimer in the
  22. // documentation and/or other materials provided with the
  23. // distribution.
  24. //
  25. // Neither the name of Texas Instruments Incorporated nor the names of
  26. // its contributors may be used to endorse or promote products derived
  27. // from this software without specific prior written permission.
  28. //
  29. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  30. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  31. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  32. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  33. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  34. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  35. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  36. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  37. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  38. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  39. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. // $
  41. //###########################################################################
  42. #ifndef __HW_UART_H__
  43. #define __HW_UART_H__
  44. //*****************************************************************************
  45. //
  46. // The following are defines for the SCI register offsets
  47. //
  48. //*****************************************************************************
  49. #define UART_O_CCR 0x0 // Communications control register
  50. #define UART_O_CTL1 0x1 // Control register 1
  51. #define UART_O_HBAUD 0x2 // Baud rate (high) register
  52. #define UART_O_LBAUD 0x3 // Baud rate (low) register
  53. #define UART_O_CTL2 0x4 // Control register 2
  54. #define UART_O_RXST 0x5 // Receive status register
  55. #define UART_O_RXEMU 0x6 // Receive emulation buffer
  56. // register
  57. #define UART_O_RXBUF 0x7 // Receive data buffer
  58. #define UART_O_TXBUF 0x9 // Transmit data buffer
  59. #define UART_O_FFTX 0xA // FIFO transmit register
  60. #define UART_O_FFRX 0xB // FIFO receive register
  61. #define UART_O_FFCT 0xC // FIFO control register
  62. #define UART_O_PRI 0xF // FIFO Priority control
  63. //*****************************************************************************
  64. //
  65. // The following are defines for the bit fields in the SCICCR register
  66. //
  67. //*****************************************************************************
  68. #define UART_CCR_SCICHAR_S 0
  69. #define UART_CCR_SCICHAR_M 0x7 // Character length control
  70. #define UART_CCR_ADDRIDLE_MODE 0x8 // ADDR/IDLE Mode control
  71. #define UART_CCR_LOOPBKENA 0x10 // Loop Back enable
  72. #define UART_CCR_PARITYENA 0x20 // Parity enable
  73. #define UART_CCR_PARITY 0x40 // Even or Odd Parity
  74. #define UART_CCR_STOPBITS 0x80 // Number of Stop Bits
  75. //*****************************************************************************
  76. //
  77. // The following are defines for the bit fields in the SCICTL1 register
  78. //
  79. //*****************************************************************************
  80. #define UART_CTL1_RXENA 0x1 // SCI receiver enable
  81. #define UART_CTL1_TXENA 0x2 // SCI transmitter enable
  82. #define UART_CTL1_SLEEP 0x4 // SCI sleep
  83. #define UART_CTL1_TXWAKE 0x8 // Transmitter wakeup method
  84. #define UART_CTL1_SWRESET 0x20 // Software reset
  85. #define UART_CTL1_RXERRINTENA 0x40 // Receive __interrupt enable
  86. //*****************************************************************************
  87. //
  88. // The following are defines for the bit fields in the SCIHBAUD register
  89. //
  90. //*****************************************************************************
  91. #define UART_HBAUD_BAUD_S 0
  92. #define UART_HBAUD_BAUD_M 0xFFFF // SCI 16-bit baud selection
  93. // Registers SCIHBAUD
  94. //*****************************************************************************
  95. //
  96. // The following are defines for the bit fields in the SCILBAUD register
  97. //
  98. //*****************************************************************************
  99. #define UART_LBAUD_BAUD_S 0
  100. #define UART_LBAUD_BAUD_M 0xFFFF // SCI 16-bit baud selection
  101. // Registers SCILBAUD
  102. //*****************************************************************************
  103. //
  104. // The following are defines for the bit fields in the SCICTL2 register
  105. //
  106. //*****************************************************************************
  107. #define UART_CTL2_TXINTENA 0x1 // Transmit __interrupt enable
  108. #define UART_CTL2_RXBKINTENA 0x2 // Receiver-buffer break enable
  109. #define UART_CTL2_TXEMPTY 0x40 // Transmitter empty flag
  110. #define UART_CTL2_TXRDY 0x80 // Transmitter ready flag
  111. //*****************************************************************************
  112. //
  113. // The following are defines for the bit fields in the SCIRXST register
  114. //
  115. //*****************************************************************************
  116. #define UART_RXST_RXWAKE 0x2 // Receiver wakeup detect flag
  117. #define UART_RXST_PE 0x4 // Parity error flag
  118. #define UART_RXST_OE 0x8 // Overrun error flag
  119. #define UART_RXST_FE 0x10 // Framing error flag
  120. #define UART_RXST_BRKDT 0x20 // Break-detect flag
  121. #define UART_RXST_RXRDY 0x40 // Receiver ready flag
  122. #define UART_RXST_RXERROR 0x80 // Receiver error flag
  123. //*****************************************************************************
  124. //
  125. // The following are defines for the bit fields in the SCIRXEMU register
  126. //
  127. //*****************************************************************************
  128. #define UART_RXEMU_ERXDT_S 0
  129. #define UART_RXEMU_ERXDT_M 0xFF // Receive emulation buffer data
  130. //*****************************************************************************
  131. //
  132. // The following are defines for the bit fields in the SCIRXBUF register
  133. //
  134. //*****************************************************************************
  135. #define UART_RXBUF_SAR_S 0
  136. #define UART_RXBUF_SAR_M 0xFF // Receive Character bits
  137. #define UART_RXBUF_SCIFFPE 0x4000 // Receiver error flag
  138. #define UART_RXBUF_SCIFFFE 0x8000 // Receiver error flag
  139. //*****************************************************************************
  140. //
  141. // The following are defines for the bit fields in the SCITXBUF register
  142. //
  143. //*****************************************************************************
  144. #define UART_TXBUF_TXDT_S 0
  145. #define UART_TXBUF_TXDT_M 0xFF // Transmit data buffer
  146. //*****************************************************************************
  147. //
  148. // The following are defines for the bit fields in the SCIFFTX register
  149. //
  150. //*****************************************************************************
  151. #define UART_FFTX_TXFFIL_S 0
  152. #define UART_FFTX_TXFFIL_M 0x1F // Interrupt level
  153. #define UART_FFTX_TXFFIENA 0x20 // Interrupt enable
  154. #define UART_FFTX_TXFFINTCLR 0x40 // Clear INT flag
  155. #define UART_FFTX_TXFFINT 0x80 // INT flag
  156. #define UART_FFTX_TXFFST_S 8
  157. #define UART_FFTX_TXFFST_M 0x1F00 // FIFO status
  158. #define UART_FFTX_TXFIFORESET 0x2000 // FIFO reset
  159. #define UART_FFTX_SCIFFENA 0x4000 // Enhancement enable
  160. #define UART_FFTX_SCIRST 0x8000 // SCI reset rx/tx channels
  161. //*****************************************************************************
  162. //
  163. // The following are defines for the bit fields in the SCIFFRX register
  164. //
  165. //*****************************************************************************
  166. #define UART_FFRX_RXFFIL_S 0
  167. #define UART_FFRX_RXFFIL_M 0x1F // Interrupt level
  168. #define UART_FFRX_RXFFIENA 0x20 // Interrupt enable
  169. #define UART_FFRX_RXFFINTCLR 0x40 // Clear INT flag
  170. #define UART_FFRX_RXFFINT 0x80 // INT flag
  171. #define UART_FFRX_RXFFST_S 8
  172. #define UART_FFRX_RXFFST_M 0x1F00 // FIFO status
  173. #define UART_FFRX_RXFIFORESET 0x2000 // FIFO reset
  174. #define UART_FFRX_RXFFOVRCLR 0x4000 // Clear overflow
  175. #define UART_FFRX_RXFFOVF 0x8000 // FIFO overflow
  176. //*****************************************************************************
  177. //
  178. // The following are defines for the bit fields in the SCIFFCT register
  179. //
  180. //*****************************************************************************
  181. #define UART_FFCT_FFTXDLY_S 0
  182. #define UART_FFCT_FFTXDLY_M 0xFF // FIFO transmit delay
  183. #define UART_FFCT_CDC 0x2000 // Auto baud mode enable
  184. #define UART_FFCT_ABDCLR 0x4000 // Auto baud clear
  185. #define UART_FFCT_ABD 0x8000 // Auto baud detect
  186. //*****************************************************************************
  187. //
  188. // The following are defines for the bit fields in the SCIPRI register
  189. //
  190. //*****************************************************************************
  191. #define UART_PRI_FREESOFT_S 3
  192. #define UART_PRI_FREESOFT_M 0x18 // Emulation modes
  193. #endif