ssi.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. //*****************************************************************************
  2. //
  3. // ssi.h - Prototypes for the Synchronous Serial Interface Driver.
  4. //
  5. // Copyright (c) 2005-2010 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 6459 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. // Prototypes for the APIs.
  70. //
  71. //*****************************************************************************
  72. extern void SSIConfigSetExpClk(unsigned long ulBase, unsigned long ulSSIClk,
  73. unsigned long ulProtocol, unsigned long ulMode,
  74. unsigned long ulBitRate,
  75. unsigned long ulDataWidth);
  76. extern void SSIDataGet(unsigned long ulBase, unsigned long *pulData);
  77. extern long SSIDataGetNonBlocking(unsigned long ulBase,
  78. unsigned long *pulData);
  79. extern void SSIDataPut(unsigned long ulBase, unsigned long ulData);
  80. extern long SSIDataPutNonBlocking(unsigned long ulBase, unsigned long ulData);
  81. extern void SSIDisable(unsigned long ulBase);
  82. extern void SSIEnable(unsigned long ulBase);
  83. extern void SSIIntClear(unsigned long ulBase, unsigned long ulIntFlags);
  84. extern void SSIIntDisable(unsigned long ulBase, unsigned long ulIntFlags);
  85. extern void SSIIntEnable(unsigned long ulBase, unsigned long ulIntFlags);
  86. extern void SSIIntRegister(unsigned long ulBase, void(*pfnHandler)(void));
  87. extern unsigned long SSIIntStatus(unsigned long ulBase, tBoolean bMasked);
  88. extern void SSIIntUnregister(unsigned long ulBase);
  89. extern void SSIDMAEnable(unsigned long ulBase, unsigned long ulDMAFlags);
  90. extern void SSIDMADisable(unsigned long ulBase, unsigned long ulDMAFlags);
  91. extern tBoolean SSIBusy(unsigned long ulBase);
  92. //*****************************************************************************
  93. //
  94. // Several SSI APIs have been renamed, with the original function name being
  95. // deprecated. These defines provide backward compatibility.
  96. //
  97. //*****************************************************************************
  98. #ifndef DEPRECATED
  99. #include "driverlib/sysctl.h"
  100. #define SSIConfig(a, b, c, d, e) \
  101. SSIConfigSetExpClk(a, SysCtlClockGet(), b, c, d, e)
  102. #define SSIDataNonBlockingGet(a, b) \
  103. SSIDataGetNonBlocking(a, b)
  104. #define SSIDataNonBlockingPut(a, b) \
  105. SSIDataPutNonBlocking(a, b)
  106. #endif
  107. //*****************************************************************************
  108. //
  109. // Mark the end of the C bindings section for C++ compilers.
  110. //
  111. //*****************************************************************************
  112. #ifdef __cplusplus
  113. }
  114. #endif
  115. #endif // __SSI_H__