ssi.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. //*****************************************************************************
  2. //
  3. // ssi.h - Prototypes for the Synchronous Serial Interface Driver.
  4. //
  5. // Copyright (c) 2005-2014 Texas Instruments Incorporated. All rights reserved.
  6. // Software License Agreement
  7. //
  8. // Redistribution and use in source and binary forms, with or without
  9. // modification, are permitted provided that the following conditions
  10. // are met:
  11. //
  12. // Redistributions of source code must retain the above copyright
  13. // notice, this list of conditions and the following disclaimer.
  14. //
  15. // Redistributions in binary form must reproduce the above copyright
  16. // notice, this list of conditions and the following disclaimer in the
  17. // documentation and/or other materials provided with the
  18. // distribution.
  19. //
  20. // Neither the name of Texas Instruments Incorporated nor the names of
  21. // its contributors may be used to endorse or promote products derived
  22. // from this software without specific prior written permission.
  23. //
  24. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  25. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  26. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  27. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  28. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  29. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  30. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  31. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  32. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  33. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  34. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. //
  36. // This is part of revision 2.1.0.12573 of the Tiva Peripheral Driver Library.
  37. //
  38. //*****************************************************************************
  39. #ifndef __DRIVERLIB_SSI_H__
  40. #define __DRIVERLIB_SSI_H__
  41. //*****************************************************************************
  42. //
  43. // If building with a C++ compiler, make all of the definitions in this header
  44. // have a C binding.
  45. //
  46. //*****************************************************************************
  47. #ifdef __cplusplus
  48. extern "C"
  49. {
  50. #endif
  51. //*****************************************************************************
  52. //
  53. // Values that can be passed to SSIIntEnable, SSIIntDisable, and SSIIntClear
  54. // as the ui32IntFlags parameter, and returned by SSIIntStatus.
  55. //
  56. //*****************************************************************************
  57. #define SSI_TXEOT 0x00000040 // Transmit FIFO is empty
  58. #define SSI_DMATX 0x00000020 // DMA Transmit complete
  59. #define SSI_DMARX 0x00000010 // DMA Receive complete
  60. #define SSI_TXFF 0x00000008 // TX FIFO half full or less
  61. #define SSI_RXFF 0x00000004 // RX FIFO half full or more
  62. #define SSI_RXTO 0x00000002 // RX timeout
  63. #define SSI_RXOR 0x00000001 // RX overrun
  64. //*****************************************************************************
  65. //
  66. // Values that can be passed to SSIConfigSetExpClk.
  67. //
  68. //*****************************************************************************
  69. #define SSI_FRF_MOTO_MODE_0 0x00000000 // Moto fmt, polarity 0, phase 0
  70. #define SSI_FRF_MOTO_MODE_1 0x00000002 // Moto fmt, polarity 0, phase 1
  71. #define SSI_FRF_MOTO_MODE_2 0x00000001 // Moto fmt, polarity 1, phase 0
  72. #define SSI_FRF_MOTO_MODE_3 0x00000003 // Moto fmt, polarity 1, phase 1
  73. #define SSI_FRF_TI 0x00000010 // TI frame format
  74. #define SSI_FRF_NMW 0x00000020 // National MicroWire frame format
  75. #define SSI_MODE_MASTER 0x00000000 // SSI master
  76. #define SSI_MODE_SLAVE 0x00000001 // SSI slave
  77. #define SSI_MODE_SLAVE_OD 0x00000002 // SSI slave with output disabled
  78. //*****************************************************************************
  79. //
  80. // Values that can be passed to SSIDMAEnable() and SSIDMADisable().
  81. //
  82. //*****************************************************************************
  83. #define SSI_DMA_TX 0x00000002 // Enable DMA for transmit
  84. #define SSI_DMA_RX 0x00000001 // Enable DMA for receive
  85. //*****************************************************************************
  86. //
  87. // Values that can be passed to SSIClockSourceSet() or returned from
  88. // SSIClockSourceGet().
  89. //
  90. //*****************************************************************************
  91. #define SSI_CLOCK_SYSTEM 0x00000000
  92. #define SSI_CLOCK_PIOSC 0x00000005
  93. //*****************************************************************************
  94. //
  95. // Values that can be passed to SSIAdvModeSet().
  96. //
  97. //*****************************************************************************
  98. #define SSI_ADV_MODE_LEGACY 0x00000000
  99. #define SSI_ADV_MODE_READ_WRITE 0x000001c0
  100. #define SSI_ADV_MODE_WRITE 0x000000c0
  101. #define SSI_ADV_MODE_BI_READ 0x00000140
  102. #define SSI_ADV_MODE_BI_WRITE 0x00000040
  103. #define SSI_ADV_MODE_QUAD_READ 0x00000180
  104. #define SSI_ADV_MODE_QUAD_WRITE 0x00000080
  105. //*****************************************************************************
  106. //
  107. // Prototypes for the APIs.
  108. //
  109. //*****************************************************************************
  110. extern void SSIConfigSetExpClk(uint32_t ui32Base, uint32_t ui32SSIClk,
  111. uint32_t ui32Protocol, uint32_t ui32Mode,
  112. uint32_t ui32BitRate,
  113. uint32_t ui32DataWidth);
  114. extern void SSIDataGet(uint32_t ui32Base, uint32_t *pui32Data);
  115. extern int32_t SSIDataGetNonBlocking(uint32_t ui32Base,
  116. uint32_t *pui32Data);
  117. extern void SSIDataPut(uint32_t ui32Base, uint32_t ui32Data);
  118. extern int32_t SSIDataPutNonBlocking(uint32_t ui32Base, uint32_t ui32Data);
  119. extern void SSIDisable(uint32_t ui32Base);
  120. extern void SSIEnable(uint32_t ui32Base);
  121. extern void SSIIntClear(uint32_t ui32Base, uint32_t ui32IntFlags);
  122. extern void SSIIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags);
  123. extern void SSIIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags);
  124. extern void SSIIntRegister(uint32_t ui32Base, void (*pfnHandler)(void));
  125. extern uint32_t SSIIntStatus(uint32_t ui32Base, bool bMasked);
  126. extern void SSIIntUnregister(uint32_t ui32Base);
  127. extern void SSIDMAEnable(uint32_t ui32Base, uint32_t ui32DMAFlags);
  128. extern void SSIDMADisable(uint32_t ui32Base, uint32_t ui32DMAFlags);
  129. extern bool SSIBusy(uint32_t ui32Base);
  130. extern void SSIClockSourceSet(uint32_t ui32Base, uint32_t ui32Source);
  131. extern uint32_t SSIClockSourceGet(uint32_t ui32Base);
  132. extern void SSIAdvModeSet(uint32_t ui32Base, uint32_t ui32Mode);
  133. extern void SSIAdvDataPutFrameEnd(uint32_t ui32Base, uint32_t ui32Data);
  134. extern int32_t SSIAdvDataPutFrameEndNonBlocking(uint32_t ui32Base,
  135. uint32_t ui32Data);
  136. extern void SSIAdvFrameHoldEnable(uint32_t ui32Base);
  137. extern void SSIAdvFrameHoldDisable(uint32_t ui32Base);
  138. //*****************************************************************************
  139. //
  140. // Mark the end of the C bindings section for C++ compilers.
  141. //
  142. //*****************************************************************************
  143. #ifdef __cplusplus
  144. }
  145. #endif
  146. #endif // __DRIVERLIB_SSI_H__