F2837xD_spi.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. //###########################################################################
  2. //
  3. // FILE: F2837xD_spi.h
  4. //
  5. // TITLE: SPI Register Definitions.
  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 __F2837xD_SPI_H__
  43. #define __F2837xD_SPI_H__
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47. //---------------------------------------------------------------------------
  48. // SPI Individual Register Bit Definitions:
  49. struct SPICCR_BITS { // bits description
  50. Uint16 SPICHAR:4; // 3:0 Character Length Control
  51. Uint16 SPILBK:1; // 4 SPI Loopback
  52. Uint16 HS_MODE:1; // 5 High Speed mode control
  53. Uint16 CLKPOLARITY:1; // 6 Shift Clock Polarity
  54. Uint16 SPISWRESET:1; // 7 SPI Software Reset
  55. Uint16 rsvd1:8; // 15:8 Reserved
  56. };
  57. union SPICCR_REG {
  58. Uint16 all;
  59. struct SPICCR_BITS bit;
  60. };
  61. struct SPICTL_BITS { // bits description
  62. Uint16 SPIINTENA:1; // 0 SPI Interupt Enable
  63. Uint16 TALK:1; // 1 Master/Slave Transmit Enable
  64. Uint16 MASTER_SLAVE:1; // 2 SPI Network Mode Control
  65. Uint16 CLK_PHASE:1; // 3 SPI Clock Phase
  66. Uint16 OVERRUNINTENA:1; // 4 Overrun Interrupt Enable
  67. Uint16 rsvd1:11; // 15:5 Reserved
  68. };
  69. union SPICTL_REG {
  70. Uint16 all;
  71. struct SPICTL_BITS bit;
  72. };
  73. struct SPISTS_BITS { // bits description
  74. Uint16 rsvd1:5; // 4:0 Reserved
  75. Uint16 BUFFULL_FLAG:1; // 5 SPI Transmit Buffer Full Flag
  76. Uint16 INT_FLAG:1; // 6 SPI Interrupt Flag
  77. Uint16 OVERRUN_FLAG:1; // 7 SPI Receiver Overrun Flag
  78. Uint16 rsvd2:8; // 15:8 Reserved
  79. };
  80. union SPISTS_REG {
  81. Uint16 all;
  82. struct SPISTS_BITS bit;
  83. };
  84. struct SPIBRR_BITS { // bits description
  85. Uint16 SPI_BIT_RATE:7; // 6:0 SPI Bit Rate Control
  86. Uint16 rsvd1:9; // 15:7 Reserved
  87. };
  88. union SPIBRR_REG {
  89. Uint16 all;
  90. struct SPIBRR_BITS bit;
  91. };
  92. struct SPIFFTX_BITS { // bits description
  93. Uint16 TXFFIL:5; // 4:0 TXFIFO Interrupt Level
  94. Uint16 TXFFIENA:1; // 5 TXFIFO Interrupt Enable
  95. Uint16 TXFFINTCLR:1; // 6 TXFIFO Interrupt Clear
  96. Uint16 TXFFINT:1; // 7 TXFIFO Interrupt Flag
  97. Uint16 TXFFST:5; // 12:8 Transmit FIFO Status
  98. Uint16 TXFIFO:1; // 13 TXFIFO Reset
  99. Uint16 SPIFFENA:1; // 14 FIFO Enhancements Enable
  100. Uint16 SPIRST:1; // 15 SPI Reset
  101. };
  102. union SPIFFTX_REG {
  103. Uint16 all;
  104. struct SPIFFTX_BITS bit;
  105. };
  106. struct SPIFFRX_BITS { // bits description
  107. Uint16 RXFFIL:5; // 4:0 RXFIFO Interrupt Level
  108. Uint16 RXFFIENA:1; // 5 RXFIFO Interrupt Enable
  109. Uint16 RXFFINTCLR:1; // 6 RXFIFO Interupt Clear
  110. Uint16 RXFFINT:1; // 7 RXFIFO Interrupt Flag
  111. Uint16 RXFFST:5; // 12:8 Receive FIFO Status
  112. Uint16 RXFIFORESET:1; // 13 RXFIFO Reset
  113. Uint16 RXFFOVFCLR:1; // 14 Receive FIFO Overflow Clear
  114. Uint16 RXFFOVF:1; // 15 Receive FIFO Overflow Flag
  115. };
  116. union SPIFFRX_REG {
  117. Uint16 all;
  118. struct SPIFFRX_BITS bit;
  119. };
  120. struct SPIFFCT_BITS { // bits description
  121. Uint16 TXDLY:8; // 7:0 FIFO Transmit Delay Bits
  122. Uint16 rsvd1:8; // 15:8 Reserved
  123. };
  124. union SPIFFCT_REG {
  125. Uint16 all;
  126. struct SPIFFCT_BITS bit;
  127. };
  128. struct SPIPRI_BITS { // bits description
  129. Uint16 TRIWIRE:1; // 0 3-wire mode select bit
  130. Uint16 STEINV:1; // 1 SPISTE inversion bit
  131. Uint16 rsvd1:2; // 3:2 Reserved
  132. Uint16 FREE:1; // 4 Free emulation mode
  133. Uint16 SOFT:1; // 5 Soft emulation mode
  134. Uint16 rsvd2:1; // 6 Reserved
  135. Uint16 rsvd3:9; // 15:7 Reserved
  136. };
  137. union SPIPRI_REG {
  138. Uint16 all;
  139. struct SPIPRI_BITS bit;
  140. };
  141. struct SPI_REGS {
  142. union SPICCR_REG SPICCR; // SPI Configuration Control Register
  143. union SPICTL_REG SPICTL; // SPI Operation Control Register
  144. union SPISTS_REG SPISTS; // SPI Status Register
  145. Uint16 rsvd1; // Reserved
  146. union SPIBRR_REG SPIBRR; // SPI Baud Rate Register
  147. Uint16 rsvd2; // Reserved
  148. Uint16 SPIRXEMU; // SPI Emulation Buffer Register
  149. Uint16 SPIRXBUF; // SPI Serial Input Buffer Register
  150. Uint16 SPITXBUF; // SPI Serial Output Buffer Register
  151. Uint16 SPIDAT; // SPI Serial Data Register
  152. union SPIFFTX_REG SPIFFTX; // SPI FIFO Transmit Register
  153. union SPIFFRX_REG SPIFFRX; // SPI FIFO Receive Register
  154. union SPIFFCT_REG SPIFFCT; // SPI FIFO Control Register
  155. Uint16 rsvd3[2]; // Reserved
  156. union SPIPRI_REG SPIPRI; // SPI Priority Control Register
  157. };
  158. //---------------------------------------------------------------------------
  159. // SPI External References & Function Declarations:
  160. //
  161. #ifdef CPU1
  162. extern volatile struct SPI_REGS SpiaRegs;
  163. extern volatile struct SPI_REGS SpibRegs;
  164. extern volatile struct SPI_REGS SpicRegs;
  165. #endif
  166. #ifdef CPU2
  167. extern volatile struct SPI_REGS SpiaRegs;
  168. extern volatile struct SPI_REGS SpibRegs;
  169. extern volatile struct SPI_REGS SpicRegs;
  170. #endif
  171. #ifdef __cplusplus
  172. }
  173. #endif /* extern "C" */
  174. #endif
  175. //===========================================================================
  176. // End of file.
  177. //===========================================================================