i2s.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. //*****************************************************************************
  2. //
  3. // i2s.h - Prototypes and macros for the I2S controller.
  4. //
  5. // Copyright (c) 2008-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 __I2S_H__
  25. #define __I2S_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 I2STxConfigSet() and I2SRxConfigSet()
  39. //
  40. //*****************************************************************************
  41. #define I2S_CONFIG_FORMAT_MASK 0x3C000000 // JST, DLY, SCP, LRP
  42. #define I2S_CONFIG_FORMAT_I2S 0x14000000 // !JST, DLY, !SCP, LRP
  43. #define I2S_CONFIG_FORMAT_LEFT_JUST \
  44. 0x00000000 // !JST, !DLY, !SCP, !LRP
  45. #define I2S_CONFIG_FORMAT_RIGHT_JUST \
  46. 0x20000000 // JST, !DLY, !SCP, !LRP
  47. #define I2S_CONFIG_SCLK_INVERT 0x08000000
  48. #define I2S_CONFIG_MODE_MASK 0x03000000
  49. #define I2S_CONFIG_MODE_DUAL 0x00000000
  50. #define I2S_CONFIG_MODE_COMPACT_16 \
  51. 0x01000000
  52. #define I2S_CONFIG_MODE_COMPACT_8 \
  53. 0x03000000
  54. #define I2S_CONFIG_MODE_MONO 0x02000000
  55. #define I2S_CONFIG_EMPTY_MASK 0x00800000
  56. #define I2S_CONFIG_EMPTY_ZERO 0x00000000
  57. #define I2S_CONFIG_EMPTY_REPEAT 0x00800000
  58. #define I2S_CONFIG_CLK_MASK 0x00400000
  59. #define I2S_CONFIG_CLK_MASTER 0x00400000
  60. #define I2S_CONFIG_CLK_SLAVE 0x00000000
  61. #define I2S_CONFIG_SAMPLE_SIZE_MASK \
  62. 0x0000FC00
  63. #define I2S_CONFIG_SAMPLE_SIZE_32 \
  64. 0x00007C00
  65. #define I2S_CONFIG_SAMPLE_SIZE_24 \
  66. 0x00005C00
  67. #define I2S_CONFIG_SAMPLE_SIZE_20 \
  68. 0x00004C00
  69. #define I2S_CONFIG_SAMPLE_SIZE_16 \
  70. 0x00003C00
  71. #define I2S_CONFIG_SAMPLE_SIZE_8 \
  72. 0x00001C00
  73. #define I2S_CONFIG_WIRE_SIZE_MASK \
  74. 0x000003F0
  75. #define I2S_CONFIG_WIRE_SIZE_32 0x000001F0
  76. #define I2S_CONFIG_WIRE_SIZE_24 0x00000170
  77. #define I2S_CONFIG_WIRE_SIZE_20 0x00000130
  78. #define I2S_CONFIG_WIRE_SIZE_16 0x000000F0
  79. #define I2S_CONFIG_WIRE_SIZE_8 0x00000070
  80. //*****************************************************************************
  81. //
  82. // Values that can be passed to I2SMasterClockSelect()
  83. //
  84. //*****************************************************************************
  85. #define I2S_TX_MCLK_EXT 0x00000010
  86. #define I2S_TX_MCLK_INT 0x00000000
  87. #define I2S_RX_MCLK_EXT 0x00000020
  88. #define I2S_RX_MCLK_INT 0x00000000
  89. //*****************************************************************************
  90. //
  91. // Values that can be passed to I2SIntEnable(), I2SIntDisable(), and
  92. // I2SIntClear()
  93. //
  94. //*****************************************************************************
  95. #define I2S_INT_RXERR 0x00000020
  96. #define I2S_INT_RXREQ 0x00000010
  97. #define I2S_INT_TXERR 0x00000002
  98. #define I2S_INT_TXREQ 0x00000001
  99. //*****************************************************************************
  100. //
  101. // API Function prototypes
  102. //
  103. //*****************************************************************************
  104. extern void I2STxEnable(unsigned long ulBase);
  105. extern void I2STxDisable(unsigned long ulBase);
  106. extern void I2STxDataPut(unsigned long ulBase, unsigned long ulData);
  107. extern long I2STxDataPutNonBlocking(unsigned long ulBase,
  108. unsigned long ulData);
  109. extern void I2STxConfigSet(unsigned long ulBase, unsigned long ulConfig);
  110. extern void I2STxFIFOLimitSet(unsigned long ulBase, unsigned long ulLevel);
  111. extern unsigned long I2STxFIFOLimitGet(unsigned long ulBase);
  112. extern unsigned long I2STxFIFOLevelGet(unsigned long ulBase);
  113. extern void I2SRxEnable(unsigned long ulBase);
  114. extern void I2SRxDisable(unsigned long ulBase);
  115. extern void I2SRxDataGet(unsigned long ulBase, unsigned long *pulData);
  116. extern long I2SRxDataGetNonBlocking(unsigned long ulBase,
  117. unsigned long *pulData);
  118. extern void I2SRxConfigSet(unsigned long ulBase, unsigned long ulConfig);
  119. extern void I2SRxFIFOLimitSet(unsigned long ulBase, unsigned long ulLevel);
  120. extern unsigned long I2SRxFIFOLimitGet(unsigned long ulBase);
  121. extern unsigned long I2SRxFIFOLevelGet(unsigned long ulBase);
  122. extern void I2STxRxEnable(unsigned long ulBase);
  123. extern void I2STxRxDisable(unsigned long ulBase);
  124. extern void I2STxRxConfigSet(unsigned long ulBase, unsigned long ulConfig);
  125. extern void I2SMasterClockSelect(unsigned long ulBase, unsigned long ulMClock);
  126. extern void I2SIntEnable(unsigned long ulBase, unsigned long ulIntFlags);
  127. extern void I2SIntDisable(unsigned long ulBase, unsigned long ulIntFlags);
  128. extern unsigned long I2SIntStatus(unsigned long ulBase, tBoolean bMasked);
  129. extern void I2SIntClear(unsigned long ulBase, unsigned long ulIntFlags);
  130. extern void I2SIntRegister(unsigned long ulBase, void (*pfnHandler)(void));
  131. extern void I2SIntUnregister(unsigned long ulBase);
  132. //*****************************************************************************
  133. //
  134. // Mark the end of the C bindings section for C++ compilers.
  135. //
  136. //*****************************************************************************
  137. #ifdef __cplusplus
  138. }
  139. #endif
  140. #endif // __I2S_H__