ssi.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. //*****************************************************************************
  2. //
  3. // ssi.h - Prototypes for the Synchronous Serial Interface Driver.
  4. //
  5. // Copyright (c) 2005-2011 Texas Instruments Incorporated. All rights reserved.
  6. // Software License Agreement
  7. //
  8. // Texas Instruments (TI) is supplying this software for use solely and
  9. // exclusively on TI's microcontroller products. The software is owned by
  10. // TI and/or its suppliers, and is protected under applicable copyright
  11. // laws. You may not combine this software with "viral" open-source
  12. // software in order to form a larger program.
  13. //
  14. // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
  15. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
  16. // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  17. // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
  18. // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
  19. // DAMAGES, FOR ANY REASON WHATSOEVER.
  20. //
  21. // This is part of revision 8264 of the Stellaris Peripheral Driver Library.
  22. //
  23. //*****************************************************************************
  24. #ifndef __SSI_H__
  25. #define __SSI_H__
  26. //*****************************************************************************
  27. //
  28. // If building with a C++ compiler, make all of the definitions in this header
  29. // have a C binding.
  30. //
  31. //*****************************************************************************
  32. #ifdef __cplusplus
  33. extern "C"
  34. {
  35. #endif
  36. //*****************************************************************************
  37. //
  38. // Values that can be passed to SSIIntEnable, SSIIntDisable, and SSIIntClear
  39. // as the ulIntFlags parameter, and returned by SSIIntStatus.
  40. //
  41. //*****************************************************************************
  42. #define SSI_TXFF 0x00000008 // TX FIFO half full or less
  43. #define SSI_RXFF 0x00000004 // RX FIFO half full or more
  44. #define SSI_RXTO 0x00000002 // RX timeout
  45. #define SSI_RXOR 0x00000001 // RX overrun
  46. //*****************************************************************************
  47. //
  48. // Values that can be passed to SSIConfigSetExpClk.
  49. //
  50. //*****************************************************************************
  51. #define SSI_FRF_MOTO_MODE_0 0x00000000 // Moto fmt, polarity 0, phase 0
  52. #define SSI_FRF_MOTO_MODE_1 0x00000002 // Moto fmt, polarity 0, phase 1
  53. #define SSI_FRF_MOTO_MODE_2 0x00000001 // Moto fmt, polarity 1, phase 0
  54. #define SSI_FRF_MOTO_MODE_3 0x00000003 // Moto fmt, polarity 1, phase 1
  55. #define SSI_FRF_TI 0x00000010 // TI frame format
  56. #define SSI_FRF_NMW 0x00000020 // National MicroWire frame format
  57. #define SSI_MODE_MASTER 0x00000000 // SSI master
  58. #define SSI_MODE_SLAVE 0x00000001 // SSI slave
  59. #define SSI_MODE_SLAVE_OD 0x00000002 // SSI slave with output disabled
  60. //*****************************************************************************
  61. //
  62. // Values that can be passed to SSIDMAEnable() and SSIDMADisable().
  63. //
  64. //*****************************************************************************
  65. #define SSI_DMA_TX 0x00000002 // Enable DMA for transmit
  66. #define SSI_DMA_RX 0x00000001 // Enable DMA for receive
  67. //*****************************************************************************
  68. //
  69. // Values that can be passed to SSIClockSourceSet() or returned from
  70. // SSIClockSourceGet().
  71. //
  72. //*****************************************************************************
  73. #define SSI_CLOCK_SYSTEM 0x00000000
  74. #define SSI_CLOCK_PIOSC 0x00000001
  75. //*****************************************************************************
  76. //
  77. // Prototypes for the APIs.
  78. //
  79. //*****************************************************************************
  80. extern void SSIConfigSetExpClk(unsigned long ulBase, unsigned long ulSSIClk,
  81. unsigned long ulProtocol, unsigned long ulMode,
  82. unsigned long ulBitRate,
  83. unsigned long ulDataWidth);
  84. extern void SSIDataGet(unsigned long ulBase, unsigned long *pulData);
  85. extern long SSIDataGetNonBlocking(unsigned long ulBase,
  86. unsigned long *pulData);
  87. extern void SSIDataPut(unsigned long ulBase, unsigned long ulData);
  88. extern long SSIDataPutNonBlocking(unsigned long ulBase, unsigned long ulData);
  89. extern void SSIDisable(unsigned long ulBase);
  90. extern void SSIEnable(unsigned long ulBase);
  91. extern void SSIIntClear(unsigned long ulBase, unsigned long ulIntFlags);
  92. extern void SSIIntDisable(unsigned long ulBase, unsigned long ulIntFlags);
  93. extern void SSIIntEnable(unsigned long ulBase, unsigned long ulIntFlags);
  94. extern void SSIIntRegister(unsigned long ulBase, void(*pfnHandler)(void));
  95. extern unsigned long SSIIntStatus(unsigned long ulBase, tBoolean bMasked);
  96. extern void SSIIntUnregister(unsigned long ulBase);
  97. extern void SSIDMAEnable(unsigned long ulBase, unsigned long ulDMAFlags);
  98. extern void SSIDMADisable(unsigned long ulBase, unsigned long ulDMAFlags);
  99. extern tBoolean SSIBusy(unsigned long ulBase);
  100. extern void SSIClockSourceSet(unsigned long ulBase, unsigned long ulSource);
  101. extern unsigned long SSIClockSourceGet(unsigned long ulBase);
  102. //*****************************************************************************
  103. //
  104. // Several SSI APIs have been renamed, with the original function name being
  105. // deprecated. These defines provide backward compatibility.
  106. //
  107. //*****************************************************************************
  108. #ifndef DEPRECATED
  109. #include "driverlib/sysctl.h"
  110. #define SSIConfig(a, b, c, d, e) \
  111. SSIConfigSetExpClk(a, SysCtlClockGet(), b, c, d, e)
  112. #define SSIDataNonBlockingGet(a, b) \
  113. SSIDataGetNonBlocking(a, b)
  114. #define SSIDataNonBlockingPut(a, b) \
  115. SSIDataPutNonBlocking(a, b)
  116. #endif
  117. //*****************************************************************************
  118. //
  119. // Mark the end of the C bindings section for C++ compilers.
  120. //
  121. //*****************************************************************************
  122. #ifdef __cplusplus
  123. }
  124. #endif
  125. #endif // __SSI_H__