i2s_001.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. /*
  2. * @brief I2S Registers and control functions
  3. *
  4. * @note
  5. * Copyright(C) NXP Semiconductors, 2012
  6. * All rights reserved.
  7. *
  8. * @par
  9. * Software that is described herein is for illustrative purposes only
  10. * which provides customers with programming information regarding the
  11. * LPC products. This software is supplied "AS IS" without any warranties of
  12. * any kind, and NXP Semiconductors and its licensor disclaim any and
  13. * all warranties, express or implied, including all implied warranties of
  14. * merchantability, fitness for a particular purpose and non-infringement of
  15. * intellectual property rights. NXP Semiconductors assumes no responsibility
  16. * or liability for the use of the software, conveys no license or rights under any
  17. * patent, copyright, mask work right, or any other intellectual property rights in
  18. * or to any products. NXP Semiconductors reserves the right to make changes
  19. * in the software without notification. NXP Semiconductors also makes no
  20. * representation or warranty that such application will be suitable for the
  21. * specified use without further testing or modification.
  22. *
  23. * @par
  24. * Permission to use, copy, modify, and distribute this software and its
  25. * documentation is hereby granted, under NXP Semiconductors' and its
  26. * licensor's relevant copyrights in the software, without fee, provided that it
  27. * is used in conjunction with NXP Semiconductors microcontrollers. This
  28. * copyright, permission, and disclaimer notice must appear in all copies of
  29. * this code.
  30. */
  31. #ifndef __I2S_001_H_
  32. #define __I2S_001_H_
  33. #include "sys_config.h"
  34. #include "cmsis.h"
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38. /** @defgroup IP_I2S_001 IP: I2S register block and driver
  39. * @ingroup IP_Drivers
  40. * @{
  41. */
  42. /**
  43. * @brief I2S register block structure
  44. */
  45. typedef struct { /*!< I2S Structure */
  46. __IO uint32_t DAO; /*!< I2S Digital Audio Output Register. Contains control bits for the I2S transmit channel */
  47. __IO uint32_t DAI; /*!< I2S Digital Audio Input Register. Contains control bits for the I2S receive channel */
  48. __O uint32_t TXFIFO; /*!< I2S Transmit FIFO. Access register for the 8 x 32-bit transmitter FIFO */
  49. __I uint32_t RXFIFO; /*!< I2S Receive FIFO. Access register for the 8 x 32-bit receiver FIFO */
  50. __I uint32_t STATE; /*!< I2S Status Feedback Register. Contains status information about the I2S interface */
  51. __IO uint32_t DMA1; /*!< I2S DMA Configuration Register 1. Contains control information for DMA request 1 */
  52. __IO uint32_t DMA2; /*!< I2S DMA Configuration Register 2. Contains control information for DMA request 2 */
  53. __IO uint32_t IRQ; /*!< I2S Interrupt Request Control Register. Contains bits that control how the I2S interrupt request is generated */
  54. __IO uint32_t TXRATE; /*!< I2S Transmit MCLK divider. This register determines the I2S TX MCLK rate by specifying the value to divide PCLK by in order to produce MCLK */
  55. __IO uint32_t RXRATE; /*!< I2S Receive MCLK divider. This register determines the I2S RX MCLK rate by specifying the value to divide PCLK by in order to produce MCLK */
  56. __IO uint32_t TXBITRATE; /*!< I2S Transmit bit rate divider. This register determines the I2S transmit bit rate by specifying the value to divide TX_MCLK by in order to produce the transmit bit clock */
  57. __IO uint32_t RXBITRATE; /*!< I2S Receive bit rate divider. This register determines the I2S receive bit rate by specifying the value to divide RX_MCLK by in order to produce the receive bit clock */
  58. __IO uint32_t TXMODE; /*!< I2S Transmit mode control */
  59. __IO uint32_t RXMODE; /*!< I2S Receive mode control */
  60. } IP_I2S_001_Type;
  61. /**
  62. * @brief I2S configuration parameter defines
  63. */
  64. /** I2S Wordwidth bit */
  65. #define I2S_WORDWIDTH_8 (0UL << 0)
  66. #define I2S_WORDWIDTH_16 (1UL << 0)
  67. #define I2S_WORDWIDTH_32 (3UL << 0)
  68. /** I2S Channel bit */
  69. #define I2S_STEREO (0UL << 2)
  70. #define I2S_MONO (1UL << 2)
  71. /** I2S Master/Slave mode bit */
  72. #define I2S_MASTER_MODE (0UL << 5)
  73. #define I2S_SLAVE_MODE (1UL << 5)
  74. /** I2S Stop bit */
  75. #define I2S_STOP_ENABLE (0UL << 3)
  76. #define I2S_STOP_DISABLE (1UL << 3)
  77. /** I2S Reset bit */
  78. #define I2S_RESET_ENABLE (1UL << 4)
  79. #define I2S_RESET_DISABLE (0UL << 4)
  80. /** I2S Mute bit */
  81. #define I2S_MUTE_ENABLE (1UL << 15)
  82. #define I2S_MUTE_DISABLE (0UL << 15)
  83. /**
  84. * @brief Macro defines for DAO-Digital Audio Output register
  85. */
  86. /** I2S wordwide - the number of bytes in data*/
  87. #define I2S_DAO_WORDWIDTH_8 ((uint32_t) (0)) /** 8 bit */
  88. #define I2S_DAO_WORDWIDTH_16 ((uint32_t) (1)) /** 16 bit */
  89. #define I2S_DAO_WORDWIDTH_32 ((uint32_t) (3)) /** 32 bit */
  90. #define I2S_DAO_WORDWIDTH_MASK ((uint32_t) (3))
  91. /** I2S control mono or stereo format */
  92. #define I2S_DAO_MONO ((uint32_t) (1 << 2))
  93. /** I2S control stop mode */
  94. #define I2S_DAO_STOP ((uint32_t) (1 << 3))
  95. /** I2S control reset mode */
  96. #define I2S_DAO_RESET ((uint32_t) (1 << 4))
  97. /** I2S control master/slave mode */
  98. #define I2S_DAO_SLAVE ((uint32_t) (1 << 5))
  99. /** I2S word select half period minus one */
  100. #define I2S_DAO_WS_HALFPERIOD(n) ((uint32_t) ((n & 0x1FF) << 6))
  101. #define I2S_DAO_WS_HALFPERIOD_MASK ((uint32_t) ((0x1FF) << 6))
  102. /** I2S control mute mode */
  103. #define I2S_DAO_MUTE ((uint32_t) (1 << 15))
  104. /**
  105. * @brief Macro defines for DAI-Digital Audio Input register
  106. */
  107. /** I2S wordwide - the number of bytes in data*/
  108. #define I2S_DAI_WORDWIDTH_8 ((uint32_t) (0)) /** 8 bit */
  109. #define I2S_DAI_WORDWIDTH_16 ((uint32_t) (1)) /** 16 bit */
  110. #define I2S_DAI_WORDWIDTH_32 ((uint32_t) (3)) /** 32 bit */
  111. #define I2S_DAI_WORDWIDTH_MASK ((uint32_t) (3))
  112. /** I2S control mono or stereo format */
  113. #define I2S_DAI_MONO ((uint32_t) (1 << 2))
  114. /** I2S control stop mode */
  115. #define I2S_DAI_STOP ((uint32_t) (1 << 3))
  116. /** I2S control reset mode */
  117. #define I2S_DAI_RESET ((uint32_t) (1 << 4))
  118. /** I2S control master/slave mode */
  119. #define I2S_DAI_SLAVE ((uint32_t) (1 << 5))
  120. /** I2S word select half period minus one (9 bits)*/
  121. #define I2S_DAI_WS_HALFPERIOD(n) ((uint32_t) ((n & 0x1FF) << 6))
  122. #define I2S_DAI_WS_HALFPERIOD_MASK ((uint32_t) ((0x1FF) << 6))
  123. /**
  124. * @brief Macro defines for STAT register (Status Feedback register)
  125. */
  126. /** I2S Status Receive or Transmit Interrupt */
  127. #define I2S_STATE_IRQ ((uint32_t) (1))
  128. /** I2S Status Receive or Transmit DMA1 */
  129. #define I2S_STATE_DMA1 ((uint32_t) (1 << 1))
  130. /** I2S Status Receive or Transmit DMA2 */
  131. #define I2S_STATE_DMA2 ((uint32_t) (1 << 2))
  132. /** I2S Status Current level of the Receive FIFO (5 bits)*/
  133. #define I2S_STATE_RX_LEVEL(n) ((uint32_t) ((n & 1F) << 8))
  134. /** I2S Status Current level of the Transmit FIFO (5 bits)*/
  135. #define I2S_STATE_TX_LEVEL(n) ((uint32_t) ((n & 1F) << 16))
  136. /**
  137. * @brief Macro defines for DMA1 register (DMA1 Configuration register)
  138. */
  139. /** I2S control DMA1 for I2S receive */
  140. #define I2S_DMA1_RX_ENABLE ((uint32_t) (1))
  141. /** I2S control DMA1 for I2S transmit */
  142. #define I2S_DMA1_TX_ENABLE ((uint32_t) (1 << 1))
  143. /** I2S set FIFO level that trigger a receive DMA request on DMA1 */
  144. #define I2S_DMA1_RX_DEPTH(n) ((uint32_t) ((n & 0x1F) << 8))
  145. /** I2S set FIFO level that trigger a transmit DMA request on DMA1 */
  146. #define I2S_DMA1_TX_DEPTH(n) ((uint32_t) ((n & 0x1F) << 16))
  147. /**
  148. * @brief Macro defines for DMA2 register (DMA2 Configuration register)
  149. */
  150. /** I2S control DMA2 for I2S receive */
  151. #define I2S_DMA2_RX_ENABLE ((uint32_t) (1))
  152. /** I2S control DMA1 for I2S transmit */
  153. #define I2S_DMA2_TX_ENABLE ((uint32_t) (1 << 1))
  154. /** I2S set FIFO level that trigger a receive DMA request on DMA1 */
  155. #define I2S_DMA2_RX_DEPTH(n) ((uint32_t) ((n & 0x1F) << 8))
  156. /** I2S set FIFO level that trigger a transmit DMA request on DMA1 */
  157. #define I2S_DMA2_TX_DEPTH(n) ((uint32_t) ((n & 0x1F) << 16))
  158. /**
  159. * @brief Macro defines for IRQ register (Interrupt Request Control register)
  160. */
  161. /** I2S control I2S receive interrupt */
  162. #define I2S_IRQ_RX_ENABLE ((uint32_t) (1))
  163. /** I2S control I2S transmit interrupt */
  164. #define I2S_IRQ_TX_ENABLE ((uint32_t) (1 << 1))
  165. /** I2S set the FIFO level on which to create an irq request */
  166. #define I2S_IRQ_RX_DEPTH(n) ((uint32_t) ((n & 0x0F) << 8))
  167. #define I2S_IRQ_RX_DEPTH_MASK ((uint32_t) ((0x0F) << 8))
  168. /** I2S set the FIFO level on which to create an irq request */
  169. #define I2S_IRQ_TX_DEPTH(n) ((uint32_t) ((n & 0x0F) << 16))
  170. #define I2S_IRQ_TX_DEPTH_MASK ((uint32_t) ((0x0F) << 16))
  171. /**
  172. * @brief Macro defines for TXRATE/RXRATE register (Transmit/Receive Clock Rate register)
  173. */
  174. /** I2S Transmit MCLK rate denominator */
  175. #define I2S_TXRATE_Y_DIVIDER(n) ((uint32_t) (n & 0xFF))
  176. /** I2S Transmit MCLK rate denominator */
  177. #define I2S_TXRATE_X_DIVIDER(n) ((uint32_t) ((n & 0xFF) << 8))
  178. /** I2S Receive MCLK rate denominator */
  179. #define I2S_RXRATE_Y_DIVIDER(n) ((uint32_t) (n & 0xFF))
  180. /** I2S Receive MCLK rate denominator */
  181. #define I2S_RXRATE_X_DIVIDER(n) ((uint32_t) ((n & 0xFF) << 8))
  182. /**
  183. * @brief Macro defines for TXBITRATE & RXBITRATE register (Transmit/Receive Bit Rate register)
  184. */
  185. #define I2S_TXBITRATE(n) ((uint32_t) (n & 0x3F))
  186. #define I2S_RXBITRATE(n) ((uint32_t) (n & 0x3F))
  187. /**
  188. * @brief Macro defines for TXMODE/RXMODE register (Transmit/Receive Mode Control register)
  189. */
  190. /** I2S Transmit select clock source (2 bits)*/
  191. #define I2S_TXMODE_CLKSEL(n) ((uint32_t) (n & 0x03))
  192. /** I2S Transmit control 4-pin mode */
  193. #define I2S_TXMODE_4PIN_ENABLE ((uint32_t) (1 << 2))
  194. /** I2S Transmit control the TX_MCLK output */
  195. #define I2S_TXMODE_MCENA ((uint32_t) (1 << 3))
  196. /** I2S Receive select clock source */
  197. #define I2S_RXMODE_CLKSEL(n) ((uint32_t) (n & 0x03))
  198. /** I2S Receive control 4-pin mode */
  199. #define I2S_RXMODE_4PIN_ENABLE ((uint32_t) (1 << 2))
  200. /** I2S Receive control the TX_MCLK output */
  201. #define I2S_RXMODE_MCENA ((uint32_t) (1 << 3))
  202. /**
  203. * @brief I2S transmit/receive mode for configuration
  204. */
  205. typedef enum {
  206. I2S_TX_MODE,
  207. I2S_RX_MODE,
  208. } IP_I2S_TRxMode_Type;
  209. /**
  210. * @brief I2S DMA request channel define
  211. */
  212. typedef enum {
  213. IP_I2S_DMA_REQUEST_NUMBER_1,
  214. IP_I2S_DMA_REQUEST_NUMBER_2,
  215. } IP_I2S_DMARequestNumber_Type;
  216. /**********************************************************************************
  217. * I2S Init/DeInit functions
  218. *********************************************************************************/
  219. /**
  220. * @brief Initialize for I2S
  221. * @param pI2S : The base of I2S peripheral on the chip
  222. * @return Nothing
  223. */
  224. void IP_I2S_Init(IP_I2S_001_Type *pI2S);
  225. /**
  226. * @brief Shutdown I2S
  227. * @param pI2S : The base of I2S peripheral on the chip
  228. * @return Nothing
  229. * Reset all relative registers (DMA, transmit/receive control, interrupt) to default value
  230. */
  231. void IP_I2S_DeInit(IP_I2S_001_Type *pI2S);
  232. /**********************************************************************************
  233. * I2S configuration functions
  234. *********************************************************************************/
  235. /**
  236. * @brief Selects the number of bytes in data
  237. * @param pI2S : The base of I2S peripheral on the chip
  238. * @param TRMode : Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
  239. * @param wordwidth : Data width, should be :
  240. * - I2S_WORDWIDTH_8
  241. * - I2S_WORDWIDTH_16
  242. * - I2S_WORDWIDTH_32
  243. * @return Nothing
  244. */
  245. void IP_I2S_SetWordWidth(IP_I2S_001_Type *pI2S, uint8_t TRMode, uint32_t wordwidth);
  246. /**
  247. * @brief Set I2S data format is monaural or stereo
  248. * @param pI2S : The base of I2S peripheral on the chip
  249. * @param TRMode : Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
  250. * @param mono : Data channel, should be
  251. * - I2S_STEREO
  252. * - I2S_MONO
  253. * @return Nothing
  254. */
  255. void IP_I2S_SetMono(IP_I2S_001_Type *pI2S, uint8_t TRMode, uint32_t mono);
  256. /**
  257. * @brief Set I2S interface in master/slave mode
  258. * @param pI2S : The base of I2S peripheral on the chip
  259. * @param TRMode : Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
  260. * @param mode : Interface mode, should be
  261. * - I2S_MASTER_MODE
  262. * - I2S_SLAVE_MODE
  263. * @return Nothing
  264. */
  265. void IP_I2S_SetMasterSlaveMode(IP_I2S_001_Type *pI2S, uint8_t TRMode, uint32_t mode);
  266. /**
  267. * @brief Set the clock frequency for I2S interface
  268. * @param pI2S : The base of I2S peripheral on the chip
  269. * @param TRMode : Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
  270. * @param mclk_divider : Clock divider. This value plus one is used to divide MCLK to produce the clock frequency for I2S interface
  271. * @return Nothing
  272. * The value depends on the audio sample rate desired and the data size and format(stereo/mono) used.
  273. * For example, a 48 kHz sample rate for 16-bit stereo data requires a bit rate of 48 000 x 16 x 2 = 1.536 MHz. So the mclk_divider should be MCLK/1.536 MHz
  274. */
  275. void IP_I2S_SetBitRate(IP_I2S_001_Type *pI2S, uint8_t TRMode, uint32_t mclk_divider);
  276. /**
  277. * @brief Set the MCLK rate by using a fractional rate generator, dividing down the frequency of PCLK
  278. * @param pI2S : The base of I2S peripheral on the chip
  279. * @param TRMode : Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
  280. * @param x_divider : I2S transmit MCLK rate numerator
  281. * @param y_devider : I2S transmit MCLK rate denominator
  282. * @return Nothing
  283. * Values of the numerator (X) and the denominator (Y) must be chosen to
  284. * produce a frequency twice that desired for the transmitter MCLK, which
  285. * must be an integer multiple of the transmitter bit clock rate.
  286. * The equation for the fractional rate generator is:
  287. * MCLK = PCLK * (X/Y) /2
  288. * Note: If the value of X or Y is 0, then no clock is generated. Also, the value of Y must be
  289. * greater than or equal to X.
  290. */
  291. void IP_I2S_SetXYDivider(IP_I2S_001_Type *pI2S, uint8_t TRMode, uint8_t x_divider, uint8_t y_devider);
  292. /**
  293. * @brief Set word select (WS) half period
  294. * @param pI2S : The base of I2S peripheral on the chip
  295. * @param TRMode : Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
  296. * @param ws_halfperiod : I2S word select half period minus one
  297. * @return Nothing
  298. * The Word Select period is configured separately for I2S input and I2S output.
  299. * For example: if the WS is 64clk period -> ws_halfperiod = 31
  300. */
  301. void IP_I2S_SetWS_Halfperiod(IP_I2S_001_Type *pI2S, uint8_t TRMode, uint32_t ws_halfperiod);
  302. /**
  303. * @brief Set the I2S operating modes
  304. * @param pI2S : The base of I2S peripheral on the chip
  305. * @param TRMode : Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
  306. * @param clksel : Clock source selection for the receive bit clock divider
  307. * @param fpin : Receive 4-pin mode selection
  308. * @param mcena : Enable for the RX_MCLK output
  309. * @return Nothing
  310. * In addition to master and slave modes, which are independently configurable for
  311. * the transmitter and the receiver, several different clock sources are possible,
  312. * including variations that share the clock and/or WS between the transmitter and
  313. * receiver. It also allows using I2S with fewer pins, typically four.
  314. */
  315. void IP_I2S_ModeConfig(IP_I2S_001_Type *pI2S, uint8_t TRMode, uint32_t clksel, uint32_t fpin, uint32_t mcena);
  316. /**
  317. * @brief Get the current level of the Transmit/Receive FIFO
  318. * @param pI2S : The base of I2S peripheral on the chip
  319. * @param TRMode : Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
  320. * @return Current level of the Transmit/Receive FIFO
  321. */
  322. uint8_t IP_I2S_GetLevel(IP_I2S_001_Type *pI2S, uint8_t TRMode);
  323. /**********************************************************************************
  324. * I2S operate functions
  325. *********************************************************************************/
  326. /**
  327. * @brief Send a 32-bit data to TXFIFO for transmition
  328. * @param pI2S : The base of I2S peripheral on the chip
  329. * @param data : Data to be transmited
  330. * @return Nothing
  331. * The function writes to TXFIFO without checking any condition.
  332. */
  333. void IP_I2S_Send(IP_I2S_001_Type *pI2S, uint32_t data);
  334. /**
  335. * @brief Get received data from RXFIFO
  336. * @param pI2S : The base of I2S peripheral on the chip
  337. * @return Data received in RXFIFO
  338. * The function reads from RXFIFO without checking any condition.
  339. */
  340. uint32_t IP_I2S_Receive(IP_I2S_001_Type *pI2S);
  341. /**
  342. * @brief Start the I2S
  343. * @param pI2S : The base of I2S peripheral on the chip
  344. * @param TRMode : Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
  345. * @return Nothing
  346. */
  347. void IP_I2S_Start(IP_I2S_001_Type *pI2S, uint8_t TRMode);
  348. /**
  349. * @brief Disables accesses on FIFOs, places the transmit channel in mute mode
  350. * @param pI2S : The base of I2S peripheral on the chip
  351. * @param TRMode : Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
  352. * @return Nothing
  353. */
  354. void IP_I2S_Pause(IP_I2S_001_Type *pI2S, uint8_t TRMode);
  355. /**
  356. * @brief Transmit channel sends only zeroes
  357. * @param pI2S : The base of I2S peripheral on the chip
  358. * @param NewState : Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
  359. * @return Nothing
  360. * The data output from I2S transmit channel is always zeroes
  361. */
  362. void IP_I2S_Mute(IP_I2S_001_Type *pI2S, FunctionalState NewState);
  363. /**
  364. * @brief Stop I2S asynchronously
  365. * @param pI2S : The base of I2S peripheral on the chip
  366. * @param TRMode : Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
  367. * @return Nothing
  368. * Pause, resets the transmit channel and FIFO asynchronously
  369. */
  370. void IP_I2S_Stop(IP_I2S_001_Type *pI2S, uint8_t TRMode);
  371. /**********************************************************************************
  372. * I2S DMA functions
  373. *********************************************************************************/
  374. /**
  375. * @brief Set the FIFO level on which to create an DMA request
  376. * @param pI2S : The base of I2S peripheral on the chip
  377. * @param TRMode : Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
  378. * @param DMANum : I2S DMA request number, should be
  379. * - IP_I2S_DMA_REQUEST_NUMBER_1
  380. * - IP_I2S_DMA_REQUEST_NUMBER_2
  381. * @param depth : FIFO level on which to create an DMA request
  382. * @return Nothing
  383. * DMA request is generated when rx_depth_dma <= rx_level or tx_depth_dma >= tx_level
  384. */
  385. void IP_I2S_SetFIFODepthDMA(IP_I2S_001_Type *pI2S, uint8_t TRMode, IP_I2S_DMARequestNumber_Type DMANum, uint32_t depth);
  386. /**
  387. * @brief Enable/Disable DMA for the I2S
  388. * @param pI2S : The base of I2S peripheral on the chip
  389. * @param TRMode : Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
  390. * @param DMANum : I2S DMA request number, should be
  391. * - IP_I2S_DMA_REQUEST_NUMBER_1
  392. * - IP_I2S_DMA_REQUEST_NUMBER_2
  393. * @param NewState : ENABLE or DISABLE DMA
  394. * @return Nothing
  395. */
  396. void IP_I2S_DMACmd(IP_I2S_001_Type *pI2S, IP_I2S_DMARequestNumber_Type DMANum, uint8_t TRMode, FunctionalState NewState);
  397. /**********************************************************************************
  398. * I2S IRQ functions
  399. *********************************************************************************/
  400. /**
  401. * @brief Enable/Disable interrupt for the I2S
  402. * @param pI2S : The base of I2S peripheral on the chip
  403. * @param TRMode : Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
  404. * @param NewState : ENABLE or DISABLE Interrupt
  405. * @return Nothing
  406. * Interrupt request is generated when rx_depth_irq <= rx_level or tx_depth_irq >= tx_level
  407. */
  408. void IP_I2S_InterruptCmd(IP_I2S_001_Type *pI2S, uint8_t TRMode, FunctionalState NewState);
  409. /**
  410. * @brief Set the FIFO level on which to create an irq request
  411. * @param pI2S : The base of I2S peripheral on the chip
  412. * @param TRMode : Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
  413. * @param depth : FIFO level on which to create an irq request
  414. * @return Nothing
  415. */
  416. void IP_I2S_SetFIFODepthIRQ(IP_I2S_001_Type *pI2S, uint8_t TRMode, uint32_t depth);
  417. /**
  418. * @brief Get the status of I2S interrupt
  419. * @param pI2S : The base of I2S peripheral on the chip
  420. * @param TRMode : Transmit/Receive mode, should be I2S_RX_MODE or I2S_TX_MODE
  421. * @return I2S interrupt status, SET or RESET
  422. */
  423. Status IP_I2S_GetIntStatus(IP_I2S_001_Type *pI2S, uint8_t TRMode);
  424. /**
  425. * @}
  426. */
  427. #ifdef __cplusplus
  428. }
  429. #endif
  430. #endif /* __I2S_001_H_ */