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