ssi.h 5.9 KB

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