gr55xx_ll_i2s.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file gr55xx_ll_i2s.h
5 * @author BLE Driver Team
6 * @brief Header file containing functions prototypes of I2S LL library.
7 *
8 ****************************************************************************************
9 * @attention
10 #####Copyright (c) 2019 GOODIX
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 * Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 * Neither the name of GOODIX nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 ****************************************************************************************
36 */
37
38 /** @addtogroup PERIPHERAL Peripheral Driver
39 * @{
40 */
41
42 /** @addtogroup LL_DRIVER LL Driver
43 * @{
44 */
45
46 /** @defgroup LL_I2S I2S
47 * @brief I2S LL module driver.
48 * @{
49 */
50
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR55xx_LL_I2S_H__
53 #define __GR55xx_LL_I2S_H__
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr55xx.h"
61
62 #if defined (I2S_M) || defined (I2S_S)
63
64 /** @defgroup LL_I2S_DRIVER_STRUCTURES Structures
65 * @{
66 */
67
68 /* Exported types ------------------------------------------------------------*/
69 /** @defgroup I2S_LL_ES_INIT I2S Exported init structure
70 * @{
71 */
72
73 /**
74 * @brief LL I2S init structures definition
75 */
76 typedef struct _ll_i2s_init_t
77 {
78 uint32_t rxdata_size; /**< Specifies the I2S receive data size.
79 This parameter can be a value of @ref I2S_LL_EC_DATASIZE.
80
81 This feature can be modified afterwards using unitary function @ref ll_i2s_set_rxsize().*/
82
83 uint32_t txdata_size; /**< Specifies the I2S transmit data size.
84 This parameter can be a value of @ref I2S_LL_EC_DATASIZE.
85
86 This feature can be modified afterwards using unitary function @ref ll_i2s_set_txsize().*/
87
88 uint32_t rx_threshold; /**< Specifies the I2S receive FIFO threshold.
89 This parameter can be a value of @ref I2S_LL_EC_FIFO_THRESHOLD.
90
91 This feature can be modified afterwards using unitary function @ref ll_i2s_set_rx_fifo_threshold().*/
92
93 uint32_t tx_threshold; /**< Specifies the I2S transmit FIFO threshold.
94 This parameter can be a value of @ref I2S_LL_EC_FIFO_THRESHOLD.
95
96 This feature can be modified afterwards using unitary function @ref ll_i2s_set_tx_fifo_threshold().*/
97
98 uint32_t clock_source; /**< Specifies the source of the I2S clock.
99 This parameter can be a value of @ref I2S_LL_EC_CLOCK_SOURCE.
100
101 This feature can be modified afterwards using unitary function @ref ll_i2s_set_clock_src().*/
102
103 uint32_t ws_cycles; /**< Specifies the I2S Word Select Line Cycles.
104 This parameter can be a value of @ref I2S_LL_EC_WS_CYCLES.
105 This feature can be modified afterwards using unitary function @ref ll_i2s_set_wss().*/
106
107 uint32_t audio_freq; /**< Specifies the frequency selected for the I2S communication.
108
109 This feature can be modified afterwards using unitary function @ref ll_i2s_set_clock_div().*/
110
111 } ll_i2s_init_t;
112
113 /** @} */
114
115 /** @} */
116
117 /**
118 * @defgroup I2S_LL_MACRO Defines
119 * @{
120 */
121
122 /* Exported constants --------------------------------------------------------*/
123 /** @defgroup I2S_LL_Exported_Constants I2S Exported Constants
124 * @{
125 */
126
127 /** @defgroup I2S_LL_EC_GET_FLAG Get Flags Defines
128 * @brief Flags definitions which can be used with LL_I2S_ReadReg function
129 * @{
130 */
131 #define LL_I2S_STATUS_TXFO I2S_INT_STAT_TX_FIFO_OVER /**< TX FIFO write overflow flag */
132 #define LL_I2S_STATUS_TXFE I2S_INT_STAT_TX_FIFO_EMPTY /**< TX FIFO threshold level is not reached flag */
133 #define LL_I2S_STATUS_RXFO I2S_INT_STAT_RX_FIFO_OVER /**< RX FIFO receive overflow flag */
134 #define LL_I2S_STATUS_RXDA I2S_INT_STAT_RX_DATA_AVL /**< RX FIFO threshold level is reached flag */
135 /** @} */
136
137 /** @defgroup I2S_LL_EC_INTERRUPT Interrupt Defines
138 * @brief Interrupt definitions which can be used with LL_SPI_ReadReg and LL_SPI_WriteReg functions
139 * @{
140 */
141 #define LL_I2S_INT_TXFO I2S_INT_MASK_TX_FOM /**< TX FIFO write overflow interrupt */
142 #define LL_I2S_INT_TXFE I2S_INT_MASK_TX_FEM /**< TX FIFO threshold level is not reached interrupt */
143 #define LL_I2S_INT_RXFO I2S_INT_MASK_RX_FOM /**< RX FIFO receive overflow interrupt */
144 #define LL_I2S_INT_RXDA I2S_INT_MASK_RX_DAM /**< RX FIFO threshold level is reached interrupt */
145 /** @} */
146
147 /** @defgroup I2S_LL_EC_CLOCK_SOURCE I2S Clock Source
148 * @{
149 */
150 #define LL_I2S_CLOCK_SRC_96M (0x00000000UL) /**< I2S clock source select: 96M */
151 #define LL_I2S_CLOCK_SRC_64M (1UL << 18) /**< I2S clock source select: 64M */
152 #define LL_I2S_CLOCK_SRC_32M (2UL << 18) /**< I2S clock source select: 32M */
153 /** @} */
154
155 /** @defgroup I2S_LL_EC_DATASIZE Transfer Data width
156 * @{
157 */
158 #define LL_I2S_DATASIZE_IGNORE (0x00000000UL) /**< Data size for I2S transfer: 32 bits */
159 #define LL_I2S_DATASIZE_12BIT (1UL << I2S_RX_CFG_WORD_LEN_POS) /**< Data size for I2S transfer: 12 bits */
160 #define LL_I2S_DATASIZE_16BIT (2UL << I2S_RX_CFG_WORD_LEN_POS) /**< Data size for I2S transfer: 16 bits */
161 #define LL_I2S_DATASIZE_20BIT (3UL << I2S_RX_CFG_WORD_LEN_POS) /**< Data size for I2S transfer: 20 bits */
162 #define LL_I2S_DATASIZE_24BIT (4UL << I2S_RX_CFG_WORD_LEN_POS) /**< Data size for I2S transfer: 24 bits */
163 #define LL_I2S_DATASIZE_32BIT (5UL << I2S_RX_CFG_WORD_LEN_POS) /**< Data size for I2S transfer: 32 bits */
164 /** @} */
165
166 /** @defgroup I2S_LL_EC_TRANSFER_MODE Transfer Mode
167 * @{
168 */
169 #define LL_I2S_SIMPLEX_TX (1UL) /**< Simplex TX mode. */
170 #define LL_I2S_SIMPLEX_RX (2UL) /**< Simplex RX mode. */
171 #define LL_I2S_FULL_DUPLEX (3UL) /**< Full-Duplex mode. */
172 /** @} */
173
174 /** @defgroup I2S_LL_EC_FIFO_THRESHOLD FIFO Threshold
175 * @{
176 */
177 #define LL_I2S_THRESHOLD_1FIFO (0x00000000UL) /**< Trigger level for FIFO: 1 depth. */
178 #define LL_I2S_THRESHOLD_2FIFO (1UL << I2S_RX_FIFO_CFG_RX_FIFO_TL_POS) /**< Trigger level for FIFO: 2 depth. */
179 #define LL_I2S_THRESHOLD_3FIFO (2UL << I2S_RX_FIFO_CFG_RX_FIFO_TL_POS) /**< Trigger level for FIFO: 3 depth. */
180 #define LL_I2S_THRESHOLD_4FIFO (3UL << I2S_RX_FIFO_CFG_RX_FIFO_TL_POS) /**< Trigger level for FIFO: 4 depth. */
181 #define LL_I2S_THRESHOLD_5FIFO (4UL << I2S_RX_FIFO_CFG_RX_FIFO_TL_POS) /**< Trigger level for FIFO: 5 depth. */
182 #define LL_I2S_THRESHOLD_6FIFO (5UL << I2S_RX_FIFO_CFG_RX_FIFO_TL_POS) /**< Trigger level for FIFO: 6 depth. */
183 #define LL_I2S_THRESHOLD_7FIFO (6UL << I2S_RX_FIFO_CFG_RX_FIFO_TL_POS) /**< Trigger level for FIFO: 7 depth. */
184 #define LL_I2S_THRESHOLD_8FIFO (7UL << I2S_RX_FIFO_CFG_RX_FIFO_TL_POS) /**< Trigger level for FIFO: 8 depth. */
185 #define LL_I2S_THRESHOLD_9FIFO (8UL << I2S_RX_FIFO_CFG_RX_FIFO_TL_POS) /**< Trigger level for FIFO: 9 depth. */
186 #define LL_I2S_THRESHOLD_10FIFO (9UL << I2S_RX_FIFO_CFG_RX_FIFO_TL_POS) /**< Trigger level for FIFO: 10 depth. */
187 #define LL_I2S_THRESHOLD_11FIFO (10UL << I2S_RX_FIFO_CFG_RX_FIFO_TL_POS) /**< Trigger level for FIFO: 11 depth. */
188 #define LL_I2S_THRESHOLD_12FIFO (11UL << I2S_RX_FIFO_CFG_RX_FIFO_TL_POS) /**< Trigger level for FIFO: 12 depth. */
189 #define LL_I2S_THRESHOLD_13FIFO (12UL << I2S_RX_FIFO_CFG_RX_FIFO_TL_POS) /**< Trigger level for FIFO: 13 depth. */
190 #define LL_I2S_THRESHOLD_14FIFO (13UL << I2S_RX_FIFO_CFG_RX_FIFO_TL_POS) /**< Trigger level for FIFO: 14 depth. */
191 #define LL_I2S_THRESHOLD_15FIFO (14UL << I2S_RX_FIFO_CFG_RX_FIFO_TL_POS) /**< Trigger level for FIFO: 15 depth. */
192 #define LL_I2S_THRESHOLD_16FIFO (15UL << I2S_RX_FIFO_CFG_RX_FIFO_TL_POS) /**< Trigger level for FIFO: 16 depth. */
193 /** @} */
194
195 /** @defgroup I2S_LL_EC_WS_CYCLES Word Select Line Cycles
196 * @{
197 */
198 #define LL_I2S_WS_CYCLES_16 (0x00000000UL) /**< 16 SCLK cycles in word select line. */
199 #define LL_I2S_WS_CYCLES_24 (0x1UL << I2S_SCLK_CFG_WS_SCLK_POS) /**< 24 SCLK cycles in word select line. */
200 #define LL_I2S_WS_CYCLES_32 (0x2UL << I2S_SCLK_CFG_WS_SCLK_POS) /**< 32 SCLK cycles in word select line. */
201 /** @} */
202
203 /** @defgroup I2S_LL_EC_SCLK_GATE SCLK Gate
204 * @{
205 */
206 #define LL_I2S_SCLKG_NONE (0x00000000UL) /**< Clock gating is disabled. */
207 #define LL_I2S_SCLKG_CYCLES_12 (0x1UL << I2S_SCLK_CFG_SCLK_GAT_POS) /**< Gating after 12 sclk cycles. */
208 #define LL_I2S_SCLKG_CYCLES_16 (0x2UL << I2S_SCLK_CFG_SCLK_GAT_POS) /**< Gating after 16 sclk cycles. */
209 #define LL_I2S_SCLKG_CYCLES_20 (0x3UL << I2S_SCLK_CFG_SCLK_GAT_POS) /**< Gating after 20 sclk cycles. */
210 #define LL_I2S_SCLKG_CYCLES_24 (0x4UL << I2S_SCLK_CFG_SCLK_GAT_POS) /**< Gating after 24 sclk cycles. */
211 /** @} */
212
213 /** @defgroup I2S_LL_EC_RESOLUTION RX/TX resolution of one channel
214 * @{
215 */
216 #define LL_I2S_RESOLUTION_12BIT (0UL) /**< 12 bits resolution. */
217 #define LL_I2S_RESOLUTION_16BIT (1UL) /**< 16 bits resolution. */
218 #define LL_I2S_RESOLUTION_20BIT (2UL) /**< 20 bits resolution. */
219 #define LL_I2S_RESOLUTION_24BIT (3UL) /**< 24 bits resolution. */
220 #define LL_I2S_RESOLUTION_32BIT (4UL) /**< 32 bits resolution. */
221 /** @} */
222
223 /** @defgroup I2S_LL_EC_CHANNELS the number of RX/TX channels
224 * @{
225 */
226 #define LL_I2S_CHANNEL_NUM_1 (0UL) /**< 1 channel. */
227 #define LL_I2S_CHANNEL_NUM_2 (1UL) /**< 2 channels. */
228 #define LL_I2S_CHANNEL_NUM_3 (2UL) /**< 3 channels. */
229 #define LL_I2S_CHANNEL_NUM_4 (3UL) /**< 4 channels. */
230 /** @} */
231
232 /** @defgroup I2S_LL_EC_FIFO_DEPTH RX/TX FIFO depth
233 * @{
234 */
235 #define LL_I2S_FIFO_DEPTH_2 (0UL) /**< FIFO depth is 2 . */
236 #define LL_I2S_FIFO_DEPTH_4 (1UL) /**< FIFO depth is 4 . */
237 #define LL_I2S_FIFO_DEPTH_8 (2UL) /**< FIFO depth is 8 . */
238 #define LL_I2S_FIFO_DEPTH_16 (3UL) /**< FIFO depth is 16. */
239 /** @} */
240
241 /** @defgroup I2S_LL_EC_APB_WIDTH APB data width
242 * @{
243 */
244 #define LL_I2S_APB_WIDTH_8BIT (0UL) /**< 8 bits APB data width. */
245 #define LL_I2S_APB_WIDTH_16BIT (1UL) /**< 16 bits APB data width. */
246 #define LL_I2S_APB_WIDTH_32BIT (2UL) /**< 32 bits APB data width. */
247 /** @} */
248
249 /** @defgroup I2S_LL_EC_DEFAULT_CONFIG InitStrcut default configuartion
250 * @{
251 */
252
253 /**
254 * @brief LL I2S InitStrcut default configuartion
255 */
256 #define LL_I2S_DEFAULT_CONFIG \
257 { \
258 .rxdata_size = LL_I2S_DATASIZE_16BIT, \
259 .txdata_size = LL_I2S_DATASIZE_16BIT, \
260 .rx_threshold = LL_I2S_THRESHOLD_1FIFO, \
261 .tx_threshold = LL_I2S_THRESHOLD_9FIFO, \
262 .clock_source = LL_I2S_CLOCK_SRC_32M, \
263 .audio_freq = 48000 \
264 }
265
266 /** @} */
267
268 /** @} */
269
270 /* Exported macro ------------------------------------------------------------*/
271 /** @defgroup I2S_LL_Exported_Macros I2S Exported Macros
272 * @{
273 */
274
275 /** @defgroup I2S_LL_EM_WRITE_READ Common Write and read registers Macros
276 * @{
277 */
278
279 /**
280 * @brief Write a value in I2S register
281 * @param __instance__ I2S instance
282 * @param __REG__ Register to be written
283 * @param __VALUE__ Value to be written in the register
284 * @retval None
285 */
286 #define LL_I2S_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__))
287
288 /**
289 * @brief Read a value in I2S register
290 * @param __instance__ I2S instance
291 * @param __REG__ Register to be read
292 * @retval Register value
293 */
294 #define LL_I2S_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__)
295
296 /** @} */
297
298 /** @} */
299
300 /** @} */
301
302 /* Exported functions --------------------------------------------------------*/
303 /** @defgroup I2S_LL_DRIVER_FUNCTIONS Functions
304 * @{
305 */
306
307 /** @defgroup I2S_LL_EF_Configuration Configuration functions
308 * @{
309 */
310
311 /**
312 * @brief Enable I2S
313 *
314 * Register|BitsName
315 * --------|--------
316 * ENABLE | EN
317 *
318 * @param I2Sx I2S instance
319 * @retval None
320 */
321 __STATIC_INLINE void ll_i2s_enable(i2s_regs_t *I2Sx)
322 {
323 SET_BITS(I2Sx->EN, I2S_EN_I2S_EN);
324 }
325
326 /**
327 * @brief Disable I2S
328 *
329 * Register|BitsName
330 * --------|--------
331 * ENABLE | EN
332 *
333 * @param I2Sx I2S instance
334 * @retval None
335 */
336 __STATIC_INLINE void ll_i2s_disable(i2s_regs_t *I2Sx)
337 {
338 CLEAR_BITS(I2Sx->EN, I2S_EN_I2S_EN);
339 }
340
341 /**
342 * @brief Check if I2S is enabled
343 *
344 * Register|BitsName
345 * --------|--------
346 * ENABLE | EN
347 *
348 * @param I2Sx I2S instance
349 * @retval State of bit (1 or 0).
350 */
351 __STATIC_INLINE uint32_t ll_i2s_is_enabled(i2s_regs_t *I2Sx)
352 {
353 return (READ_BITS(I2Sx->EN, I2S_EN_I2S_EN) == (I2S_EN_I2S_EN));
354 }
355
356 /**
357 * @brief Enable I2S RX block
358 *
359 * Register|BitsName
360 * --------|--------
361 * RBEN | EN
362 *
363 * @param I2Sx I2S instance
364 * @retval None
365 */
366 __STATIC_INLINE void ll_i2s_enable_rxblock(i2s_regs_t *I2Sx)
367 {
368 SET_BITS(I2Sx->RX_EN, I2S_RX_EN_RX_EN);
369 }
370
371 /**
372 * @brief Disable I2S RX block
373 *
374 * Register|BitsName
375 * --------|--------
376 * RBEN | EN
377 *
378 * @param I2Sx I2S instance
379 * @retval None
380 */
381 __STATIC_INLINE void ll_i2s_disable_rxblock(i2s_regs_t *I2Sx)
382 {
383 CLEAR_BITS(I2Sx->RX_EN, I2S_RX_EN_RX_EN);
384 }
385
386 /**
387 * @brief Check if I2S RX block is enabled
388 *
389 * Register|BitsName
390 * --------|--------
391 * RBEN | EN
392 *
393 * @param I2Sx I2S instance
394 * @retval State of bit (1 or 0).
395 */
396 __STATIC_INLINE uint32_t ll_i2s_is_enabled_rxblock(i2s_regs_t *I2Sx)
397 {
398 return (READ_BITS(I2Sx->RX_EN, I2S_RX_EN_RX_EN) == (I2S_RX_EN_RX_EN));
399 }
400
401 /**
402 * @brief Enable I2S TX block
403 *
404 * Register|BitsName
405 * --------|--------
406 * TBEN | EN
407 *
408 * @param I2Sx I2S instance
409 * @retval None
410 */
411 __STATIC_INLINE void ll_i2s_enable_txblock(i2s_regs_t *I2Sx)
412 {
413 SET_BITS(I2Sx->TX_EN, I2S_TX_EN_TX_EN);
414 }
415
416 /**
417 * @brief Disable I2S TX block
418 *
419 * Register|BitsName
420 * --------|--------
421 * TBEN | EN
422 *
423 * @param I2Sx I2S instance
424 * @retval None
425 */
426 __STATIC_INLINE void ll_i2s_disable_txblock(i2s_regs_t *I2Sx)
427 {
428 CLEAR_BITS(I2Sx->TX_EN, I2S_TX_EN_TX_EN);
429 }
430
431 /**
432 * @brief Check if I2S TX block is enabled
433 *
434 * Register|BitsName
435 * --------|--------
436 * TBEN | EN
437 *
438 * @param I2Sx I2S instance
439 * @retval State of bit (1 or 0).
440 */
441 __STATIC_INLINE uint32_t ll_i2s_is_enabled_txblock(i2s_regs_t *I2Sx)
442 {
443 return (READ_BITS(I2Sx->TX_EN, I2S_TX_EN_TX_EN) == (I2S_TX_EN_TX_EN));
444 }
445
446 /**
447 * @brief Enable I2S clock
448 *
449 * Register|BitsName
450 * --------|--------
451 * CLKEN | EN
452 *
453 * @param I2Sx I2S instance
454 * @retval None
455 */
456 __STATIC_INLINE void ll_i2s_enable_clock(i2s_regs_t *I2Sx)
457 {
458 SET_BITS(I2Sx->CLK_EN, I2S_CLK_EN_CLK_EN);
459 }
460
461 /**
462 * @brief Disable I2S clock
463 *
464 * Register|BitsName
465 * --------|--------
466 * CLKEN | EN
467 *
468 * @param I2Sx I2S instance
469 * @retval None
470 */
471 __STATIC_INLINE void ll_i2s_disable_clock(i2s_regs_t *I2Sx)
472 {
473 CLEAR_BITS(I2Sx->CLK_EN, I2S_CLK_EN_CLK_EN);
474 }
475
476 /**
477 * @brief Check if I2S clock is enabled
478 *
479 * Register|BitsName
480 * --------|--------
481 * CLKEN | EN
482 *
483 * @param I2Sx I2S instance
484 * @retval State of bit (1 or 0).
485 */
486 __STATIC_INLINE uint32_t ll_i2s_is_enabled_clock(i2s_regs_t *I2Sx)
487 {
488 return (READ_BITS(I2Sx->CLK_EN, I2S_CLK_EN_CLK_EN) == (I2S_CLK_EN_CLK_EN));
489 }
490
491 /**
492 * @brief Set word select line cycles for left or right sample
493 * @note This bit should be written only when I2S is disabled (I2S_EN = 0) for correct operation.
494 *
495 * Register|BitsName
496 * --------|--------
497 * CLKCONFIG | WSS
498 *
499 * @param I2Sx I2S instance
500 * @param cycles This parameter can be one of the following values:
501 * @arg @ref LL_I2S_WS_CYCLES_16
502 * @arg @ref LL_I2S_WS_CYCLES_24
503 * @arg @ref LL_I2S_WS_CYCLES_32
504 * @retval None
505 */
506 __STATIC_INLINE void ll_i2s_set_wss(i2s_regs_t *I2Sx, uint32_t cycles)
507 {
508 MODIFY_REG(I2Sx->SCLK_CFG, I2S_SCLK_CFG_WS_SCLK, cycles);
509 }
510
511 /**
512 * @brief Get word select line cycles for left or right sample
513 *
514 * Register|BitsName
515 * --------|--------
516 * CLKCONFIG | WSS
517 *
518 * @param I2Sx I2S instance
519 * @retval Returned Value can be one of the following values:
520 * @arg @ref LL_I2S_WS_CYCLES_16
521 * @arg @ref LL_I2S_WS_CYCLES_24
522 * @arg @ref LL_I2S_WS_CYCLES_32
523 */
524 __STATIC_INLINE uint32_t ll_i2s_get_wss(i2s_regs_t *I2Sx)
525 {
526 return (uint32_t)(READ_BITS(I2Sx->SCLK_CFG, I2S_SCLK_CFG_WS_SCLK));
527 }
528
529 /**
530 * @brief Set the gating of sclk
531 *
532 * Register|BitsName
533 * --------|--------
534 * CLKCONFIG | SCLKG
535 *
536 * @param I2Sx I2S instance
537 * @param cycles This parameter can be one of the following values:
538 * @arg @ref LL_I2S_SCLKG_NONE
539 * @arg @ref LL_I2S_SCLKG_CYCLES_12
540 * @arg @ref LL_I2S_SCLKG_CYCLES_16
541 * @arg @ref LL_I2S_SCLKG_CYCLES_20
542 * @arg @ref LL_I2S_SCLKG_CYCLES_24
543 * @retval None
544 */
545 __STATIC_INLINE void ll_i2s_set_sclkg(i2s_regs_t *I2Sx, uint32_t cycles)
546 {
547 MODIFY_REG(I2Sx->SCLK_CFG, I2S_SCLK_CFG_SCLK_GAT, cycles);
548 }
549
550 /**
551 * @brief Get the gating of sclk
552 *
553 * Register|BitsName
554 * --------|--------
555 * CLKCONFIG | SCLKG
556 *
557 * @param I2Sx I2S instance
558 * @retval Returned Value can be one of the following values:
559 * @arg @ref LL_I2S_SCLKG_NONE
560 * @arg @ref LL_I2S_SCLKG_CYCLES_12
561 * @arg @ref LL_I2S_SCLKG_CYCLES_16
562 * @arg @ref LL_I2S_SCLKG_CYCLES_20
563 * @arg @ref LL_I2S_SCLKG_CYCLES_24
564 */
565 __STATIC_INLINE uint32_t ll_i2s_get_sclkg(i2s_regs_t *I2Sx)
566 {
567 return (uint32_t)(READ_BITS(I2Sx->SCLK_CFG, I2S_SCLK_CFG_SCLK_GAT));
568 }
569
570 /**
571 * @brief Clear I2S RX FIFO in all channels
572 *
573 * Register|BitsName
574 * --------|--------
575 * RXFIFO_RST | RST
576 *
577 * @param I2Sx I2S instance
578 * @retval None
579 */
580 __STATIC_INLINE void ll_i2s_clr_rxfifo_all(i2s_regs_t *I2Sx)
581 {
582 WRITE_REG(I2Sx->RX_FIFO_RST, I2S_RX_FIFO_RST_RX_FIFO_RST);
583 }
584
585 /**
586 * @brief Clear I2S TX FIFO in all channels
587 *
588 * Register|BitsName
589 * --------|--------
590 * TXFIFO_RST | RST
591 *
592 * @param I2Sx I2S instance
593 * @retval None
594 */
595 __STATIC_INLINE void ll_i2s_clr_txfifo_all(i2s_regs_t *I2Sx)
596 {
597 WRITE_REG(I2Sx->TX_FIFO_RST, I2S_TX_FIFO_RST_TX_FIFO_RST);
598 }
599
600 /**
601 * @brief Set I2S clock divider
602 *
603 * Register|BitsName
604 * --------|--------
605 * I2S_CLK_CFG | DIV
606 *
607 * @param div This parameter can between: 0 ~ 0xFFF
608 * @retval None
609 */
610 __STATIC_INLINE void ll_i2s_set_clock_div(uint32_t div)
611 {
612 MODIFY_REG(MCU_SUB->I2S_CLK_CFG, MCU_SUB_I2S_CLK_CFG_DIV_CNT, div);
613 }
614
615 /**
616 * @brief Get I2S clock divider
617 *
618 * Register|BitsName
619 * --------|--------
620 * I2S_CLK_CFG | DIV
621 *
622 * @retval Returned Value can between: 0 ~ 0xFFF
623 */
624 __STATIC_INLINE uint32_t ll_i2s_get_clock_div(void)
625 {
626 return (uint32_t)(READ_BITS(MCU_SUB->I2S_CLK_CFG, MCU_SUB_I2S_CLK_CFG_DIV_CNT));
627 }
628
629 /**
630 * @brief Enable I2S clock divider
631 *
632 * Register|BitsName
633 * --------|--------
634 * I2S_CLK_CFG | DIV_EN
635 *
636 * @retval None
637 */
638 __STATIC_INLINE void ll_i2s_enable_clock_div(void)
639 {
640 SET_BITS(MCU_SUB->I2S_CLK_CFG, MCU_SUB_I2S_CLK_CFG_CLK_DIV_EN);
641 }
642
643 /**
644 * @brief Disable I2S clock divider
645 *
646 * Register|BitsName
647 * --------|--------
648 * I2S_CLK_CFG | DIV_EN
649 *
650 * @retval None
651 */
652 __STATIC_INLINE void ll_i2s_disable_clock_div(void)
653 {
654 CLEAR_BITS(MCU_SUB->I2S_CLK_CFG, MCU_SUB_I2S_CLK_CFG_CLK_DIV_EN);
655 }
656
657 /**
658 * @brief Check if I2S clock divider is enabled
659 *
660 * Register|BitsName
661 * --------|--------
662 * I2S_CLK_CFG | DIV_EN
663 *
664 * @retval State of bit (1 or 0).
665 */
666 __STATIC_INLINE uint32_t ll_i2s_is_enabled_clock_div(void)
667 {
668 return (READ_BITS(MCU_SUB->I2S_CLK_CFG, MCU_SUB_I2S_CLK_CFG_CLK_DIV_EN) == (MCU_SUB_I2S_CLK_CFG_CLK_DIV_EN));
669 }
670
671 /**
672 * @brief Set I2S clock source
673 *
674 * Register|BitsName
675 * --------|--------
676 * I2S_CLK_CFG | SRC
677 *
678 * @param src This parameter can be one of the following values:
679 * @arg @ref LL_I2S_CLOCK_SRC_96M
680 * @arg @ref LL_I2S_CLOCK_SRC_64M
681 * @arg @ref LL_I2S_CLOCK_SRC_32M
682 * @retval None
683 */
684 __STATIC_INLINE void ll_i2s_set_clock_src(uint32_t src)
685 {
686 MODIFY_REG(MCU_SUB->I2S_CLK_CFG, MCU_SUB_I2S_CLK_CFG_SRC_CLK_SEL, src);
687 }
688
689 /**
690 * @brief Get I2S clock source
691 *
692 * Register|BitsName
693 * --------|--------
694 * I2S_CLK_CFG | SRC
695 *
696 * @retval Returned Value can be one of the following values:
697 * @arg @ref LL_I2S_CLOCK_SRC_96M
698 * @arg @ref LL_I2S_CLOCK_SRC_32M
699 */
700 __STATIC_INLINE uint32_t ll_i2s_get_clock_src(void)
701 {
702 return (uint32_t)(READ_BITS(MCU_SUB->I2S_CLK_CFG, MCU_SUB_I2S_CLK_CFG_SRC_CLK_SEL));
703 }
704
705 /**
706 * @brief Enable I2S clock
707 *
708 * Register|BitsName
709 * --------|--------
710 * I2S_CLK_CFG | DIV_EN
711 *
712 * @retval None
713 */
714 __STATIC_INLINE void ll_i2s_enable_src_clock(void)
715 {
716 SET_BITS(MCU_SUB->I2S_CLK_CFG, MCU_SUB_I2S_CLK_CFG_SRC_CLK_EN);
717 }
718
719 /**
720 * @brief Disable I2S clock divider
721 *
722 * Register|BitsName
723 * --------|--------
724 * I2S_CLK_CFG | DIV_EN
725 *
726 * @retval None
727 */
728 __STATIC_INLINE void ll_i2s_disable_src_clock(void)
729 {
730 CLEAR_BITS(MCU_SUB->I2S_CLK_CFG, MCU_SUB_I2S_CLK_CFG_SRC_CLK_EN);
731 }
732
733 /**
734 * @brief Check if I2S clock divider is enabled
735 *
736 * Register|BitsName
737 * --------|--------
738 * I2S_CLK_CFG | DIV_EN
739 *
740 * @retval State of bit (1 or 0).
741 */
742 __STATIC_INLINE uint32_t ll_i2s_is_enabled_src_clock(void)
743 {
744 return (READ_BITS(MCU_SUB->I2S_CLK_CFG, MCU_SUB_I2S_CLK_CFG_SRC_CLK_EN) == (MCU_SUB_I2S_CLK_CFG_SRC_CLK_EN));
745 }
746
747 /** @} */
748
749 /** @defgroup I2S_LL_EF_Channel Channel Configuration functions
750 * @{
751 */
752
753 /**
754 * @brief Read one data from left RX FIFO in a channel
755 *
756 * Register|BitsName
757 * --------|--------
758 * DATA_L | DATA
759 *
760 * @param I2Sx I2S instance
761 * @retval None
762 */
763 __STATIC_INLINE uint32_t ll_i2s_receive_ldata(i2s_regs_t *I2Sx)
764 {
765 return (uint32_t)(READ_REG(I2Sx->LEFT_BUF));
766 }
767
768 /**
769 * @brief Read one data from right RX FIFO in a channel
770 *
771 * Register|BitsName
772 * --------|--------
773 * DATA_R | DATA
774 *
775 * @param I2Sx I2S instance
776 * @retval None
777 */
778 __STATIC_INLINE uint32_t ll_i2s_receive_rdata(i2s_regs_t *I2Sx)
779 {
780 return (uint32_t)(READ_REG(I2Sx->RIGHT_BUF));
781 }
782
783 /**
784 * @brief Write one data to left TX FIFO in a channel
785 *
786 * Register|BitsName
787 * --------|--------
788 * DATA_L | DATA
789 *
790 * @param I2Sx I2S instance
791 * @param data The data to send
792 * @retval None
793 */
794 __STATIC_INLINE void ll_i2s_transmit_ldata(i2s_regs_t *I2Sx, uint32_t data)
795 {
796 WRITE_REG(I2Sx->LEFT_BUF, data);
797 }
798
799 /**
800 * @brief Write one data to right TX FIFO in a channel
801 *
802 * Register|BitsName
803 * --------|--------
804 * DATA_R | DATA
805 *
806 * @param I2Sx I2S instance
807 * @param data The data to send
808 * @retval None
809 */
810 __STATIC_INLINE void ll_i2s_transmit_rdata(i2s_regs_t *I2Sx, uint32_t data)
811 {
812 WRITE_REG(I2Sx->RIGHT_BUF, data);
813 }
814
815 /**
816 * @brief Enable RX in a channel
817 *
818 * Register|BitsName
819 * --------|--------
820 * RXEN | EN
821 *
822 * @param I2Sx I2S instance
823 * @retval None
824 */
825 __STATIC_INLINE void ll_i2s_enable_rx(i2s_regs_t *I2Sx)
826 {
827 SET_BITS(I2Sx->RX_CH_EN, I2S_RX_CH_EN_RX_CH_EN);
828 }
829
830 /**
831 * @brief Disable RX in a channel
832 *
833 * Register|BitsName
834 * --------|--------
835 * RXEN | EN
836 *
837 * @param I2Sx I2S instance
838 * @retval None
839 */
840 __STATIC_INLINE void ll_i2s_disable_rx(i2s_regs_t *I2Sx)
841 {
842 CLEAR_BITS(I2Sx->RX_CH_EN, I2S_RX_CH_EN_RX_CH_EN);
843 }
844
845 /**
846 * @brief Check if RX in a channel is enabled
847 *
848 * Register|BitsName
849 * --------|--------
850 * RXEN | EN
851 *
852 * @param I2Sx I2S instance
853 * @retval State of bit (1 or 0).
854 */
855 __STATIC_INLINE uint32_t ll_i2s_is_enabled_rx(i2s_regs_t *I2Sx)
856 {
857 return (READ_BITS(I2Sx->RX_CH_EN, I2S_RX_CH_EN_RX_CH_EN) == (I2S_RX_CH_EN_RX_CH_EN));
858 }
859
860 /**
861 * @brief Enable TX in a channel
862 *
863 * Register|BitsName
864 * --------|--------
865 * TXEN | EN
866 *
867 * @param I2Sx I2S instance
868 * @retval None
869 */
870 __STATIC_INLINE void ll_i2s_enable_tx(i2s_regs_t *I2Sx)
871 {
872 SET_BITS(I2Sx->TX_CH_EN, I2S_TX_CH_EN_TX_CH_EN);
873 }
874
875 /**
876 * @brief Disable TX in a channel
877 *
878 * Register|BitsName
879 * --------|--------
880 * TXEN | EN
881 *
882 * @param I2Sx I2S instance
883 * @retval None
884 */
885 __STATIC_INLINE void ll_i2s_disable_tx(i2s_regs_t *I2Sx)
886 {
887 CLEAR_BITS(I2Sx->TX_CH_EN, I2S_TX_CH_EN_TX_CH_EN);
888 }
889
890 /**
891 * @brief Check if TX in a channel is enabled
892 *
893 * Register|BitsName
894 * --------|--------
895 * TXEN | EN
896 *
897 * @param I2Sx I2S instance
898 * @retval State of bit (1 or 0).
899 */
900 __STATIC_INLINE uint32_t ll_i2s_is_enabled_tx(i2s_regs_t *I2Sx)
901 {
902 return (READ_BITS(I2Sx->TX_CH_EN, I2S_TX_CH_EN_TX_CH_EN) == (I2S_TX_CH_EN_TX_CH_EN));
903 }
904
905 /**
906 * @brief Set receive data width in a channel
907 * @note These bits should not be changed when channel is enabled.
908 *
909 * Register|BitsName
910 * --------|--------
911 * RXSIZE | WLEN
912 *
913 * @param I2Sx I2S instance
914 * @param size This parameter can be one of the following values:
915 * @arg @ref LL_I2S_DATASIZE_IGNORE
916 * @arg @ref LL_I2S_DATASIZE_12BIT
917 * @arg @ref LL_I2S_DATASIZE_16BIT
918 * @arg @ref LL_I2S_DATASIZE_20BIT
919 * @arg @ref LL_I2S_DATASIZE_24BIT
920 * @arg @ref LL_I2S_DATASIZE_32BIT
921 * @retval None
922 */
923 __STATIC_INLINE void ll_i2s_set_rxsize(i2s_regs_t *I2Sx, uint32_t size)
924 {
925 MODIFY_REG(I2Sx->RX_CFG, I2S_RX_CFG_WORD_LEN, size);
926 }
927
928 /**
929 * @brief Get receive data width in a channel
930 *
931 * Register|BitsName
932 * --------|--------
933 * RXSIZE | WLEN
934 *
935 * @param I2Sx I2S instance
936 * @retval Returned Value can be one of the following values:
937 * @arg @ref LL_I2S_DATASIZE_IGNORE
938 * @arg @ref LL_I2S_DATASIZE_12BIT
939 * @arg @ref LL_I2S_DATASIZE_16BIT
940 * @arg @ref LL_I2S_DATASIZE_20BIT
941 * @arg @ref LL_I2S_DATASIZE_24BIT
942 * @arg @ref LL_I2S_DATASIZE_32BIT
943 */
944 __STATIC_INLINE uint32_t ll_i2s_get_rxsize(i2s_regs_t *I2Sx)
945 {
946 return (uint32_t)(READ_BITS(I2Sx->RX_CFG, I2S_RX_CFG_WORD_LEN));
947 }
948
949 /**
950 * @brief Set transmit data width in a channel
951 * @note These bits should not be changed when channel is enabled.
952 *
953 * Register|BitsName
954 * --------|--------
955 * TXSIZE | WLEN
956 *
957 * @param I2Sx I2S instance
958 * @param size This parameter can be one of the following values:
959 * @arg @ref LL_I2S_DATASIZE_IGNORE
960 * @arg @ref LL_I2S_DATASIZE_12BIT
961 * @arg @ref LL_I2S_DATASIZE_16BIT
962 * @arg @ref LL_I2S_DATASIZE_20BIT
963 * @arg @ref LL_I2S_DATASIZE_24BIT
964 * @arg @ref LL_I2S_DATASIZE_32BIT
965 * @retval None
966 */
967 __STATIC_INLINE void ll_i2s_set_txsize(i2s_regs_t *I2Sx,uint32_t size)
968 {
969 MODIFY_REG(I2Sx->TX_CFG, I2S_TX_CFG_WORD_LEN, size);
970 }
971
972 /**
973 * @brief Get transmit data width in a channel
974 *
975 * Register|BitsName
976 * --------|--------
977 * TXSIZE | WLEN
978 *
979 * @param I2Sx I2S instance
980 * @retval Returned Value can be one of the following values:
981 * @arg @ref LL_I2S_DATASIZE_IGNORE
982 * @arg @ref LL_I2S_DATASIZE_12BIT
983 * @arg @ref LL_I2S_DATASIZE_16BIT
984 * @arg @ref LL_I2S_DATASIZE_20BIT
985 * @arg @ref LL_I2S_DATASIZE_24BIT
986 * @arg @ref LL_I2S_DATASIZE_32BIT
987 */
988 __STATIC_INLINE uint32_t ll_i2s_get_txsize(i2s_regs_t *I2Sx)
989 {
990 return (uint32_t)(READ_BITS(I2Sx->TX_CFG, I2S_TX_CFG_WORD_LEN));
991 }
992
993 /**
994 * @brief Get interrupt flag in a channel
995 *
996 * Register|BitsName
997 * --------|--------
998 * INTSTAT | TXFO
999 * INTSTAT | TXFE
1000 * INTSTAT | RXFO
1001 * INTSTAT | RXDA
1002 *
1003 * @param I2Sx I2S instance
1004 * @retval Returned Value can be one or more of the following values:
1005 * @arg @ref LL_I2S_STATUS_TXFO
1006 * @arg @ref LL_I2S_STATUS_TXFE
1007 * @arg @ref LL_I2S_STATUS_RXFO
1008 * @arg @ref LL_I2S_STATUS_RXDA
1009 */
1010 __STATIC_INLINE uint32_t ll_i2s_get_it_flag(i2s_regs_t *I2Sx)
1011 {
1012 return (uint32_t)(READ_BITS(I2Sx->INT_STAT, I2S_INT_STAT_TX_FIFO_OVER | I2S_INT_STAT_TX_FIFO_EMPTY | \
1013 I2S_INT_STAT_RX_FIFO_OVER | I2S_INT_STAT_RX_DATA_AVL));
1014 }
1015
1016 /**
1017 * @brief Check interrupt flag in a channel
1018 *
1019 * Register|BitsName
1020 * --------|--------
1021 * INTSTAT | TXFO
1022 * INTSTAT | TXFE
1023 * INTSTAT | RXFO
1024 * INTSTAT | RXDA
1025 *
1026 * @param I2Sx I2S instance
1027 * @param flag Interrupt flag in a channel
1028 * @retval flag This parameter can be one or more of the following values:
1029 * @arg @ref LL_I2S_STATUS_TXFO
1030 * @arg @ref LL_I2S_STATUS_TXFE
1031 * @arg @ref LL_I2S_STATUS_RXFO
1032 * @arg @ref LL_I2S_STATUS_RXDA
1033 * @retval State of bit (1 or 0).
1034 */
1035 __STATIC_INLINE uint32_t ll_i2s_is_active_it_flag(i2s_regs_t *I2Sx, uint32_t flag)
1036 {
1037 return (uint32_t)(READ_BITS(I2Sx->INT_STAT, flag) == flag);
1038 }
1039
1040 /**
1041 * @brief Enable interrupt in a channel
1042 *
1043 * Register|BitsName
1044 * --------|--------
1045 * INTMASK | TXFO
1046 * INTMASK | TXFE
1047 * INTMASK | RXFO
1048 * INTMASK | RXDA
1049 *
1050 * @param I2Sx I2S instance
1051 * @param mask This parameter can be one or more of the following values:
1052 * @arg @ref LL_I2S_INT_TXFO
1053 * @arg @ref LL_I2S_INT_TXFE
1054 * @arg @ref LL_I2S_INT_RXFO
1055 * @arg @ref LL_I2S_INT_RXDA
1056 * @retval None
1057 */
1058 __STATIC_INLINE void ll_i2s_enable_it(i2s_regs_t *I2Sx, uint32_t mask)
1059 {
1060 CLEAR_BITS(I2Sx->INT_MASK, mask);
1061 }
1062
1063 /**
1064 * @brief Disable interrupt in a channel
1065 *
1066 * Register|BitsName
1067 * --------|--------
1068 * INTMASK | TXFO
1069 * INTMASK | TXFE
1070 * INTMASK | RXFO
1071 * INTMASK | RXDA
1072 *
1073 * @param I2Sx I2S instance
1074 * @param mask This parameter can be one or more of the following values:
1075 * @arg @ref LL_I2S_INT_TXFO
1076 * @arg @ref LL_I2S_INT_TXFE
1077 * @arg @ref LL_I2S_INT_RXFO
1078 * @arg @ref LL_I2S_INT_RXDA
1079 * @retval None
1080 */
1081 __STATIC_INLINE void ll_i2s_disable_it(i2s_regs_t *I2Sx, uint32_t mask)
1082 {
1083 SET_BITS(I2Sx->INT_MASK, mask);
1084 }
1085
1086 /**
1087 * @brief Check if interrupt in a channel is enabled
1088 *
1089 * Register|BitsName
1090 * --------|--------
1091 * INTMASK | TXFO
1092 * INTMASK | TXFE
1093 * INTMASK | RXFO
1094 * INTMASK | RXDA
1095 *
1096 * @param I2Sx I2S instance
1097 * @param mask This parameter can be one or more of the following values:
1098 * @arg @ref LL_I2S_INT_TXFO
1099 * @arg @ref LL_I2S_INT_TXFE
1100 * @arg @ref LL_I2S_INT_RXFO
1101 * @arg @ref LL_I2S_INT_RXDA
1102 * @retval State of bit (1 or 0).
1103 */
1104 __STATIC_INLINE uint32_t ll_i2s_is_enabled_it(i2s_regs_t *I2Sx, uint32_t mask)
1105 {
1106 return ((READ_BITS(I2Sx->INT_MASK, mask) ^ (mask)) == (mask));
1107 }
1108
1109 /**
1110 * @brief Clear RX FIFO data overrun interrupt flag in a channel
1111 *
1112 * Register|BitsName
1113 * --------|--------
1114 * RXOVR | RXCHO
1115 *
1116 * @param I2Sx I2S instance
1117 * @retval State of bit (1 or 0).
1118 */
1119 __STATIC_INLINE uint32_t ll_i2s_clear_it_rxovr(i2s_regs_t *I2Sx)
1120 {
1121 return (READ_BITS(I2Sx->RX_OVER, I2S_RX_OVER_RX_CLR_FDO));
1122 }
1123
1124 /**
1125 * @brief Clear TX FIFO data overrun interrupt flag in a channel
1126 *
1127 * Register|BitsName
1128 * --------|--------
1129 * TXOVR | TXCHO
1130 *
1131 * @param I2Sx I2S instance
1132 * @retval State of bit (1 or 0).
1133 */
1134 __STATIC_INLINE uint32_t ll_i2s_clear_it_txovr(i2s_regs_t *I2Sx)
1135 {
1136 return (READ_BITS(I2Sx->TX_OVER, I2S_TX_OVER_TX_CLR_FDO));
1137 }
1138
1139 /**
1140 * @brief Set threshold of RXFIFO in a channel that triggers an RXDA event
1141 *
1142 * Register|BitsName
1143 * --------|--------
1144 * RXFIFO_TL | TL
1145 *
1146 * @param I2Sx I2S instance
1147 * @param threshold This parameter can be one of the following values:
1148 * @arg @ref LL_I2S_THRESHOLD_1FIFO
1149 * @arg @ref LL_I2S_THRESHOLD_2FIFO
1150 * @arg @ref LL_I2S_THRESHOLD_3FIFO
1151 * @arg @ref LL_I2S_THRESHOLD_4FIFO
1152 * @arg @ref LL_I2S_THRESHOLD_5FIFO
1153 * @arg @ref LL_I2S_THRESHOLD_6FIFO
1154 * @arg @ref LL_I2S_THRESHOLD_7FIFO
1155 * @arg @ref LL_I2S_THRESHOLD_8FIFO
1156 * @arg @ref LL_I2S_THRESHOLD_9FIFO
1157 * @arg @ref LL_I2S_THRESHOLD_10FIFO
1158 * @arg @ref LL_I2S_THRESHOLD_11FIFO
1159 * @arg @ref LL_I2S_THRESHOLD_12FIFO
1160 * @arg @ref LL_I2S_THRESHOLD_13FIFO
1161 * @arg @ref LL_I2S_THRESHOLD_14FIFO
1162 * @arg @ref LL_I2S_THRESHOLD_15FIFO
1163 * @arg @ref LL_I2S_THRESHOLD_16FIFO
1164 * @retval None
1165 */
1166 __STATIC_INLINE void ll_i2s_set_rx_fifo_threshold(i2s_regs_t *I2Sx, uint32_t threshold)
1167 {
1168 WRITE_REG(I2Sx->RX_FIFO_CFG, threshold);
1169 }
1170
1171 /**
1172 * @brief Get threshold of RXFIFO in a channel that triggers an RXDA event
1173 *
1174 * Register|BitsName
1175 * --------|--------
1176 * RXFIFO_TL | TL
1177 *
1178 * @param I2Sx I2S instance
1179 * @retval Returned Value can be one of the following values:
1180 * @arg @ref LL_I2S_THRESHOLD_1FIFO
1181 * @arg @ref LL_I2S_THRESHOLD_2FIFO
1182 * @arg @ref LL_I2S_THRESHOLD_3FIFO
1183 * @arg @ref LL_I2S_THRESHOLD_4FIFO
1184 * @arg @ref LL_I2S_THRESHOLD_5FIFO
1185 * @arg @ref LL_I2S_THRESHOLD_6FIFO
1186 * @arg @ref LL_I2S_THRESHOLD_7FIFO
1187 * @arg @ref LL_I2S_THRESHOLD_8FIFO
1188 * @arg @ref LL_I2S_THRESHOLD_9FIFO
1189 * @arg @ref LL_I2S_THRESHOLD_10FIFO
1190 * @arg @ref LL_I2S_THRESHOLD_11FIFO
1191 * @arg @ref LL_I2S_THRESHOLD_12FIFO
1192 * @arg @ref LL_I2S_THRESHOLD_13FIFO
1193 * @arg @ref LL_I2S_THRESHOLD_14FIFO
1194 * @arg @ref LL_I2S_THRESHOLD_15FIFO
1195 * @arg @ref LL_I2S_THRESHOLD_16FIFO
1196 */
1197 __STATIC_INLINE uint32_t ll_i2s_get_rx_fifo_threshold(i2s_regs_t *I2Sx)
1198 {
1199 return (uint32_t)(READ_BITS(I2Sx->RX_FIFO_CFG, I2S_RX_FIFO_CFG_RX_FIFO_TL));
1200 }
1201
1202 /**
1203 * @brief Set threshold of TXFIFO in a channel that triggers an TXFE event
1204 *
1205 * Register|BitsName
1206 * --------|--------
1207 * TXFIFO_TL | TL
1208 *
1209 * @param I2Sx I2S instance
1210 * @param threshold This parameter can be one of the following values:
1211 * @arg @ref LL_I2S_THRESHOLD_1FIFO
1212 * @arg @ref LL_I2S_THRESHOLD_2FIFO
1213 * @arg @ref LL_I2S_THRESHOLD_3FIFO
1214 * @arg @ref LL_I2S_THRESHOLD_4FIFO
1215 * @arg @ref LL_I2S_THRESHOLD_5FIFO
1216 * @arg @ref LL_I2S_THRESHOLD_6FIFO
1217 * @arg @ref LL_I2S_THRESHOLD_7FIFO
1218 * @arg @ref LL_I2S_THRESHOLD_8FIFO
1219 * @arg @ref LL_I2S_THRESHOLD_9FIFO
1220 * @arg @ref LL_I2S_THRESHOLD_10FIFO
1221 * @arg @ref LL_I2S_THRESHOLD_11FIFO
1222 * @arg @ref LL_I2S_THRESHOLD_12FIFO
1223 * @arg @ref LL_I2S_THRESHOLD_13FIFO
1224 * @arg @ref LL_I2S_THRESHOLD_14FIFO
1225 * @arg @ref LL_I2S_THRESHOLD_15FIFO
1226 * @arg @ref LL_I2S_THRESHOLD_16FIFO
1227 * @retval None
1228 */
1229 __STATIC_INLINE void ll_i2s_set_tx_fifo_threshold(i2s_regs_t *I2Sx, uint32_t threshold)
1230 {
1231 WRITE_REG(I2Sx->TX_FIFO_CFG, threshold);
1232 }
1233
1234 /**
1235 * @brief Get threshold of TXFIFO in a channel that triggers an TXFE event
1236 *
1237 * Register|BitsName
1238 * --------|--------
1239 * TXFIFO_TL | TL
1240 *
1241 * @param I2Sx I2S instance
1242 * @retval Returned Value can be one of the following values:
1243 * @arg @ref LL_I2S_THRESHOLD_1FIFO
1244 * @arg @ref LL_I2S_THRESHOLD_2FIFO
1245 * @arg @ref LL_I2S_THRESHOLD_3FIFO
1246 * @arg @ref LL_I2S_THRESHOLD_4FIFO
1247 * @arg @ref LL_I2S_THRESHOLD_5FIFO
1248 * @arg @ref LL_I2S_THRESHOLD_6FIFO
1249 * @arg @ref LL_I2S_THRESHOLD_7FIFO
1250 * @arg @ref LL_I2S_THRESHOLD_8FIFO
1251 * @arg @ref LL_I2S_THRESHOLD_9FIFO
1252 * @arg @ref LL_I2S_THRESHOLD_10FIFO
1253 * @arg @ref LL_I2S_THRESHOLD_11FIFO
1254 * @arg @ref LL_I2S_THRESHOLD_12FIFO
1255 * @arg @ref LL_I2S_THRESHOLD_13FIFO
1256 * @arg @ref LL_I2S_THRESHOLD_14FIFO
1257 * @arg @ref LL_I2S_THRESHOLD_15FIFO
1258 * @arg @ref LL_I2S_THRESHOLD_16FIFO
1259 */
1260 __STATIC_INLINE uint32_t ll_i2s_get_tx_fifo_threshold(i2s_regs_t *I2Sx)
1261 {
1262 return (uint32_t)(READ_BITS(I2Sx->TX_FIFO_CFG, I2S_TX_FIFO_CFG_TX_FIFO_TL));
1263 }
1264
1265 /**
1266 * @brief Clear RX FIFO data in a channel
1267 *
1268 * Register|BitsName
1269 * --------|--------
1270 * RXFIFO_FLUSH | FLUSH
1271 *
1272 * @param I2Sx I2S instance
1273 * @retval None
1274 */
1275 __STATIC_INLINE void ll_i2s_clr_rxfifo_channel(i2s_regs_t *I2Sx)
1276 {
1277 WRITE_REG(I2Sx->RX_FIFO_FLUSH, I2S_RX_FIFO_FLUSH_RX_FIFO_RST);
1278 }
1279
1280 /**
1281 * @brief Clear TX FIFO data in a channel
1282 *
1283 * Register|BitsName
1284 * --------|--------
1285 * TXFIFO_FLUSH | FLUSH
1286 *
1287 * @param I2Sx I2S instance
1288 * @retval None
1289 */
1290 __STATIC_INLINE void ll_i2s_clr_txfifo_channel(i2s_regs_t *I2Sx)
1291 {
1292 WRITE_REG(I2Sx->TX_FIFO_FLUSH, I2S_TX_FIFO_FLUSH_TX_FIFO_RST);
1293 }
1294
1295 /** @} */
1296
1297 /** @defgroup I2S_LL_EF_DMA_Management DMA Management Functions
1298 * @{
1299 */
1300
1301 /**
1302 * @brief Reset RX block DMA
1303 * @note The RX DMA can be reset to the lowest channel via this register.
1304 *
1305 * Register|BitsName
1306 * --------|--------
1307 * RXDMA_RST | RST
1308 *
1309 * @param I2Sx I2S instance
1310 * @retval None
1311 */
1312 __STATIC_INLINE void ll_i2s_rst_rxdma(i2s_regs_t *I2Sx)
1313 {
1314 WRITE_REG(I2Sx->RST_RX_DMA, I2S_RST_RX_DMA_RST_RX_DMA);
1315 }
1316
1317 /**
1318 * @brief Reset TX block DMA
1319 * @note The TX DMA can be reset to the lowest channel via this register.
1320 *
1321 * Register|BitsName
1322 * --------|--------
1323 * TXDMA_RST | RST
1324 *
1325 * @param I2Sx I2S instance
1326 * @retval None
1327 */
1328 __STATIC_INLINE void ll_i2s_rst_txdma(i2s_regs_t *I2Sx)
1329 {
1330 WRITE_REG(I2Sx->RST_TX_DMA, I2S_RST_TX_DMA_RST_TX_DMA);
1331 }
1332
1333
1334 /**
1335 * @brief Enable I2S DMA
1336 *
1337 * Register|BitsName
1338 * --------|--------
1339 * DMA_ACC_SEL | QSPI1_I2S_M_SEL
1340 * DMA_ACC_SEL | I2C1_I2S_S_SEL
1341 *
1342 * @param I2Sx I2S instance
1343 * @retval None
1344 */
1345 __STATIC_INLINE void ll_i2s_enable_dma(i2s_regs_t *I2Sx)
1346 {
1347 if (I2S_M == I2Sx)
1348 SET_BITS(MCU_SUB->I2S_DMA_MODE, MCU_SUB_I2S_DMA_MODE_SET);
1349 else
1350 SET_BITS(MCU_SUB->I2S_DMA_MODE, MCU_SUB_I2S_DMA_MODE_S_SET);
1351 }
1352
1353 /**
1354 * @brief Disable I2S DMA
1355 *
1356 * Register|BitsName
1357 * --------|--------
1358 * DMA_ACC_SEL | QSPI1_I2S_M_SEL
1359 * DMA_ACC_SEL | I2C1_I2S_S_SEL
1360 *
1361 * @param I2Sx I2S instance
1362 * @retval None
1363 */
1364 __STATIC_INLINE void ll_i2s_disable_dma(i2s_regs_t *I2Sx)
1365 {
1366 if (I2S_M == I2Sx)
1367 CLEAR_BITS(MCU_SUB->I2S_DMA_MODE, MCU_SUB_I2S_DMA_MODE_SET);
1368 else
1369 CLEAR_BITS(MCU_SUB->I2S_DMA_MODE, MCU_SUB_I2S_DMA_MODE_S_SET);
1370 }
1371
1372 /**
1373 * @brief Check if I2S DMA is enabled
1374 *
1375 * Register|BitsName
1376 * --------|--------
1377 * DMA_ACC_SEL | QSPI1_I2S_M_SEL
1378 * DMA_ACC_SEL | I2C1_I2S_S_SEL
1379 *
1380 * @param I2Sx I2S instance
1381 * @retval State of bit (1 or 0).
1382 */
1383 __STATIC_INLINE uint32_t ll_i2s_is_enabled_dma(i2s_regs_t *I2Sx)
1384 {
1385 if (I2S_M == I2Sx)
1386 return (READ_BITS(MCU_SUB->I2S_DMA_MODE, MCU_SUB_I2S_DMA_MODE_SET) == MCU_SUB_I2S_DMA_MODE_SET);
1387 else
1388 return (READ_BITS(MCU_SUB->I2S_DMA_MODE, MCU_SUB_I2S_DMA_MODE_S_SET) == MCU_SUB_I2S_DMA_MODE_S_SET);
1389 }
1390
1391 /**
1392 * @brief Enable I2S DMA mode
1393 *
1394 * Register|BitsName
1395 * --------|--------
1396 * DMA_ACC_SEL | MCU_SUB_I2S_DMA_MODE_SET
1397 * DMA_ACC_SEL | MCU_SUB_I2S_DMA_MODE_S_SET
1398 *
1399 * @param I2Sx I2S instance
1400 * @retval None
1401 */
1402 __STATIC_INLINE void ll_i2s_enable_dma_mode(i2s_regs_t *I2Sx)
1403 {
1404 if (I2S_M == I2Sx)
1405 SET_BITS(MCU_SUB->I2S_DMA_MODE, MCU_SUB_I2S_DMA_MODE_SET);
1406 else
1407 SET_BITS(MCU_SUB->I2S_DMA_MODE, MCU_SUB_I2S_DMA_MODE_S_SET);
1408 }
1409
1410 /**
1411 * @brief Disable I2S DMA mode
1412 *
1413 * Register|BitsName
1414 * --------|--------
1415 * DMA_ACC_SEL | MCU_SUB_I2S_DMA_MODE_SET
1416 * DMA_ACC_SEL | MCU_SUB_I2S_DMA_MODE_S_SET
1417 *
1418 * @param I2Sx I2S instance
1419 * @retval None
1420 */
1421 __STATIC_INLINE void ll_i2s_disable_dma_mode(i2s_regs_t *I2Sx)
1422 {
1423 if (I2S_M == I2Sx)
1424 CLEAR_BITS(MCU_SUB->I2S_DMA_MODE, MCU_SUB_I2S_DMA_MODE_SET);
1425 else
1426 CLEAR_BITS(MCU_SUB->I2S_DMA_MODE, MCU_SUB_I2S_DMA_MODE_S_SET);
1427 }
1428
1429
1430 /**
1431 * @brief Check if I2S DMA mode is enabled
1432 *
1433 * Register|BitsName
1434 * --------|--------
1435 * DMA_ACC_SEL | MCU_SUB_I2S_DMA_MODE_SET
1436 * DMA_ACC_SEL | I2C1_I2S_S_SEL
1437 *
1438 * @param I2Sx I2S instance
1439 * @retval State of bit (1 or 0).
1440 */
1441 __STATIC_INLINE uint32_t ll_i2s_is_enabled_dma_mode(i2s_regs_t *I2Sx)
1442 {
1443 if (I2S_M == I2Sx)
1444 return (READ_BITS(MCU_SUB->I2S_DMA_MODE, MCU_SUB_I2S_DMA_MODE_SET) == MCU_SUB_I2S_DMA_MODE_SET);
1445 else
1446 return (READ_BITS(MCU_SUB->I2S_DMA_MODE, MCU_SUB_I2S_DMA_MODE_S_SET) == MCU_SUB_I2S_DMA_MODE_S_SET);
1447 }
1448
1449 /** @} */
1450
1451 /** @defgroup I2S_LL_EF_Init I2S_M Initialization and de-initialization functions
1452 * @{
1453 */
1454
1455 /**
1456 * @brief De-initialize I2S registers (Registers restored to their default values).
1457 * @param I2Sx I2S instance
1458 * @retval An error_status_t enumeration value:
1459 * - SUCCESS: I2S registers are de-initialized
1460 * - ERROR: I2S registers are not de-initialized
1461 */
1462 error_status_t ll_i2s_deinit(i2s_regs_t *I2Sx);
1463
1464 /**
1465 * @brief Initialize I2S_M registers according to the specified
1466 * parameters in p_i2s_init.
1467 * @param I2Sx I2S instance
1468 * @param p_i2s_init Pointer to a ll_i2s_init_t structure that contains the configuration
1469 * information for the specified I2S_M peripheral.
1470 * @retval An error_status_t enumeration value:
1471 * - SUCCESS: I2S registers are initialized according to p_i2s_init content
1472 * - ERROR: Problem occurred during I2S Registers initialization
1473 */
1474 error_status_t ll_i2s_init(i2s_regs_t *I2Sx, ll_i2s_init_t *p_i2s_init);
1475
1476 /**
1477 * @brief Set each field of a @ref ll_i2s_init_t type structure to default value.
1478 * @param p_i2s_init Pointer to a @ref ll_i2s_init_t structure
1479 * whose fields will be set to default values.
1480 * @retval None
1481 */
1482 void ll_i2s_struct_init(ll_i2s_init_t *p_i2s_init);
1483
1484 /** @} */
1485
1486 /** @} */
1487
1488 #endif /* I2S_M || I2S_S */
1489
1490 #ifdef __cplusplus
1491 }
1492 #endif
1493
1494 #endif /* __GR55xx_LL_I2S_H__ */
1495
1496 /** @} */
1497
1498 /** @} */
1499
1500 /** @} */
ll_i2s_enable_clock
__STATIC_INLINE void ll_i2s_enable_clock(i2s_regs_t *I2Sx)
Enable I2S clock.
Definition: gr55xx_ll_i2s.h:456
ll_i2s_enable
__STATIC_INLINE void ll_i2s_enable(i2s_regs_t *I2Sx)
Enable I2S.
Definition: gr55xx_ll_i2s.h:321
ll_i2s_get_wss
__STATIC_INLINE uint32_t ll_i2s_get_wss(i2s_regs_t *I2Sx)
Get word select line cycles for left or right sample.
Definition: gr55xx_ll_i2s.h:524
ll_i2s_is_enabled_clock
__STATIC_INLINE uint32_t ll_i2s_is_enabled_clock(i2s_regs_t *I2Sx)
Check if I2S clock is enabled.
Definition: gr55xx_ll_i2s.h:486
ll_i2s_disable_txblock
__STATIC_INLINE void ll_i2s_disable_txblock(i2s_regs_t *I2Sx)
Disable I2S TX block.
Definition: gr55xx_ll_i2s.h:426
ll_i2s_set_txsize
__STATIC_INLINE void ll_i2s_set_txsize(i2s_regs_t *I2Sx, uint32_t size)
Set transmit data width in a channel.
Definition: gr55xx_ll_i2s.h:967
ll_i2s_disable_dma_mode
__STATIC_INLINE void ll_i2s_disable_dma_mode(i2s_regs_t *I2Sx)
Disable I2S DMA mode.
Definition: gr55xx_ll_i2s.h:1421
ll_i2s_enable_rx
__STATIC_INLINE void ll_i2s_enable_rx(i2s_regs_t *I2Sx)
Enable RX in a channel.
Definition: gr55xx_ll_i2s.h:825
ll_i2s_transmit_rdata
__STATIC_INLINE void ll_i2s_transmit_rdata(i2s_regs_t *I2Sx, uint32_t data)
Write one data to right TX FIFO in a channel.
Definition: gr55xx_ll_i2s.h:810
ll_i2s_struct_init
void ll_i2s_struct_init(ll_i2s_init_t *p_i2s_init)
Set each field of a ll_i2s_init_t type structure to default value.
ll_i2s_clr_rxfifo_all
__STATIC_INLINE void ll_i2s_clr_rxfifo_all(i2s_regs_t *I2Sx)
Clear I2S RX FIFO in all channels.
Definition: gr55xx_ll_i2s.h:580
ll_i2s_clr_txfifo_all
__STATIC_INLINE void ll_i2s_clr_txfifo_all(i2s_regs_t *I2Sx)
Clear I2S TX FIFO in all channels.
Definition: gr55xx_ll_i2s.h:595
_ll_i2s_init_t::ws_cycles
uint32_t ws_cycles
Definition: gr55xx_ll_i2s.h:103
ll_i2s_enable_dma_mode
__STATIC_INLINE void ll_i2s_enable_dma_mode(i2s_regs_t *I2Sx)
Enable I2S DMA mode.
Definition: gr55xx_ll_i2s.h:1402
ll_i2s_disable_dma
__STATIC_INLINE void ll_i2s_disable_dma(i2s_regs_t *I2Sx)
Disable I2S DMA.
Definition: gr55xx_ll_i2s.h:1364
ll_i2s_receive_ldata
__STATIC_INLINE uint32_t ll_i2s_receive_ldata(i2s_regs_t *I2Sx)
Read one data from left RX FIFO in a channel.
Definition: gr55xx_ll_i2s.h:763
_ll_i2s_init_t::tx_threshold
uint32_t tx_threshold
Definition: gr55xx_ll_i2s.h:93
ll_i2s_set_wss
__STATIC_INLINE void ll_i2s_set_wss(i2s_regs_t *I2Sx, uint32_t cycles)
Set word select line cycles for left or right sample.
Definition: gr55xx_ll_i2s.h:506
ll_i2s_disable_rx
__STATIC_INLINE void ll_i2s_disable_rx(i2s_regs_t *I2Sx)
Disable RX in a channel.
Definition: gr55xx_ll_i2s.h:840
ll_i2s_clear_it_txovr
__STATIC_INLINE uint32_t ll_i2s_clear_it_txovr(i2s_regs_t *I2Sx)
Clear TX FIFO data overrun interrupt flag in a channel.
Definition: gr55xx_ll_i2s.h:1134
_ll_i2s_init_t::clock_source
uint32_t clock_source
Definition: gr55xx_ll_i2s.h:98
ll_i2s_enable_dma
__STATIC_INLINE void ll_i2s_enable_dma(i2s_regs_t *I2Sx)
Enable I2S DMA.
Definition: gr55xx_ll_i2s.h:1345
ll_i2s_clr_rxfifo_channel
__STATIC_INLINE void ll_i2s_clr_rxfifo_channel(i2s_regs_t *I2Sx)
Clear RX FIFO data in a channel.
Definition: gr55xx_ll_i2s.h:1275
ll_i2s_get_rx_fifo_threshold
__STATIC_INLINE uint32_t ll_i2s_get_rx_fifo_threshold(i2s_regs_t *I2Sx)
Get threshold of RXFIFO in a channel that triggers an RXDA event.
Definition: gr55xx_ll_i2s.h:1197
ll_i2s_is_active_it_flag
__STATIC_INLINE uint32_t ll_i2s_is_active_it_flag(i2s_regs_t *I2Sx, uint32_t flag)
Check interrupt flag in a channel.
Definition: gr55xx_ll_i2s.h:1035
ll_i2s_is_enabled_src_clock
__STATIC_INLINE uint32_t ll_i2s_is_enabled_src_clock(void)
Check if I2S clock divider is enabled.
Definition: gr55xx_ll_i2s.h:742
ll_i2s_rst_rxdma
__STATIC_INLINE void ll_i2s_rst_rxdma(i2s_regs_t *I2Sx)
Reset RX block DMA.
Definition: gr55xx_ll_i2s.h:1312
_ll_i2s_init_t::rx_threshold
uint32_t rx_threshold
Definition: gr55xx_ll_i2s.h:88
ll_i2s_set_clock_src
__STATIC_INLINE void ll_i2s_set_clock_src(uint32_t src)
Set I2S clock source.
Definition: gr55xx_ll_i2s.h:684
ll_i2s_disable_src_clock
__STATIC_INLINE void ll_i2s_disable_src_clock(void)
Disable I2S clock divider.
Definition: gr55xx_ll_i2s.h:728
ll_i2s_is_enabled_tx
__STATIC_INLINE uint32_t ll_i2s_is_enabled_tx(i2s_regs_t *I2Sx)
Check if TX in a channel is enabled.
Definition: gr55xx_ll_i2s.h:900
_ll_i2s_init_t::rxdata_size
uint32_t rxdata_size
Definition: gr55xx_ll_i2s.h:78
_ll_i2s_init_t::txdata_size
uint32_t txdata_size
Definition: gr55xx_ll_i2s.h:83
ll_i2s_is_enabled_clock_div
__STATIC_INLINE uint32_t ll_i2s_is_enabled_clock_div(void)
Check if I2S clock divider is enabled.
Definition: gr55xx_ll_i2s.h:666
ll_i2s_get_tx_fifo_threshold
__STATIC_INLINE uint32_t ll_i2s_get_tx_fifo_threshold(i2s_regs_t *I2Sx)
Get threshold of TXFIFO in a channel that triggers an TXFE event.
Definition: gr55xx_ll_i2s.h:1260
ll_i2s_enable_rxblock
__STATIC_INLINE void ll_i2s_enable_rxblock(i2s_regs_t *I2Sx)
Enable I2S RX block.
Definition: gr55xx_ll_i2s.h:366
ll_i2s_enable_txblock
__STATIC_INLINE void ll_i2s_enable_txblock(i2s_regs_t *I2Sx)
Enable I2S TX block.
Definition: gr55xx_ll_i2s.h:411
ll_i2s_enable_src_clock
__STATIC_INLINE void ll_i2s_enable_src_clock(void)
Enable I2S clock.
Definition: gr55xx_ll_i2s.h:714
_ll_i2s_init_t::audio_freq
uint32_t audio_freq
Definition: gr55xx_ll_i2s.h:107
ll_i2s_get_clock_src
__STATIC_INLINE uint32_t ll_i2s_get_clock_src(void)
Get I2S clock source.
Definition: gr55xx_ll_i2s.h:700
ll_i2s_set_tx_fifo_threshold
__STATIC_INLINE void ll_i2s_set_tx_fifo_threshold(i2s_regs_t *I2Sx, uint32_t threshold)
Set threshold of TXFIFO in a channel that triggers an TXFE event.
Definition: gr55xx_ll_i2s.h:1229
ll_i2s_get_sclkg
__STATIC_INLINE uint32_t ll_i2s_get_sclkg(i2s_regs_t *I2Sx)
Get the gating of sclk.
Definition: gr55xx_ll_i2s.h:565
ll_i2s_init
error_status_t ll_i2s_init(i2s_regs_t *I2Sx, ll_i2s_init_t *p_i2s_init)
Initialize I2S_M registers according to the specified parameters in p_i2s_init.
ll_i2s_disable_tx
__STATIC_INLINE void ll_i2s_disable_tx(i2s_regs_t *I2Sx)
Disable TX in a channel.
Definition: gr55xx_ll_i2s.h:885
ll_i2s_disable_rxblock
__STATIC_INLINE void ll_i2s_disable_rxblock(i2s_regs_t *I2Sx)
Disable I2S RX block.
Definition: gr55xx_ll_i2s.h:381
ll_i2s_is_enabled
__STATIC_INLINE uint32_t ll_i2s_is_enabled(i2s_regs_t *I2Sx)
Check if I2S is enabled.
Definition: gr55xx_ll_i2s.h:351
ll_i2s_rst_txdma
__STATIC_INLINE void ll_i2s_rst_txdma(i2s_regs_t *I2Sx)
Reset TX block DMA.
Definition: gr55xx_ll_i2s.h:1328
ll_i2s_is_enabled_rxblock
__STATIC_INLINE uint32_t ll_i2s_is_enabled_rxblock(i2s_regs_t *I2Sx)
Check if I2S RX block is enabled.
Definition: gr55xx_ll_i2s.h:396
ll_i2s_enable_clock_div
__STATIC_INLINE void ll_i2s_enable_clock_div(void)
Enable I2S clock divider.
Definition: gr55xx_ll_i2s.h:638
ll_i2s_set_sclkg
__STATIC_INLINE void ll_i2s_set_sclkg(i2s_regs_t *I2Sx, uint32_t cycles)
Set the gating of sclk.
Definition: gr55xx_ll_i2s.h:545
ll_i2s_init_t
struct _ll_i2s_init_t ll_i2s_init_t
LL I2S init structures definition.
ll_i2s_is_enabled_rx
__STATIC_INLINE uint32_t ll_i2s_is_enabled_rx(i2s_regs_t *I2Sx)
Check if RX in a channel is enabled.
Definition: gr55xx_ll_i2s.h:855
ll_i2s_is_enabled_txblock
__STATIC_INLINE uint32_t ll_i2s_is_enabled_txblock(i2s_regs_t *I2Sx)
Check if I2S TX block is enabled.
Definition: gr55xx_ll_i2s.h:441
ll_i2s_is_enabled_dma
__STATIC_INLINE uint32_t ll_i2s_is_enabled_dma(i2s_regs_t *I2Sx)
Check if I2S DMA is enabled.
Definition: gr55xx_ll_i2s.h:1383
ll_i2s_clear_it_rxovr
__STATIC_INLINE uint32_t ll_i2s_clear_it_rxovr(i2s_regs_t *I2Sx)
Clear RX FIFO data overrun interrupt flag in a channel.
Definition: gr55xx_ll_i2s.h:1119
ll_i2s_is_enabled_it
__STATIC_INLINE uint32_t ll_i2s_is_enabled_it(i2s_regs_t *I2Sx, uint32_t mask)
Check if interrupt in a channel is enabled.
Definition: gr55xx_ll_i2s.h:1104
ll_i2s_set_rxsize
__STATIC_INLINE void ll_i2s_set_rxsize(i2s_regs_t *I2Sx, uint32_t size)
Set receive data width in a channel.
Definition: gr55xx_ll_i2s.h:923
ll_i2s_get_rxsize
__STATIC_INLINE uint32_t ll_i2s_get_rxsize(i2s_regs_t *I2Sx)
Get receive data width in a channel.
Definition: gr55xx_ll_i2s.h:944
ll_i2s_enable_it
__STATIC_INLINE void ll_i2s_enable_it(i2s_regs_t *I2Sx, uint32_t mask)
Enable interrupt in a channel.
Definition: gr55xx_ll_i2s.h:1058
ll_i2s_receive_rdata
__STATIC_INLINE uint32_t ll_i2s_receive_rdata(i2s_regs_t *I2Sx)
Read one data from right RX FIFO in a channel.
Definition: gr55xx_ll_i2s.h:778
ll_i2s_set_clock_div
__STATIC_INLINE void ll_i2s_set_clock_div(uint32_t div)
Set I2S clock divider.
Definition: gr55xx_ll_i2s.h:610
ll_i2s_get_it_flag
__STATIC_INLINE uint32_t ll_i2s_get_it_flag(i2s_regs_t *I2Sx)
Get interrupt flag in a channel.
Definition: gr55xx_ll_i2s.h:1010
ll_i2s_transmit_ldata
__STATIC_INLINE void ll_i2s_transmit_ldata(i2s_regs_t *I2Sx, uint32_t data)
Write one data to left TX FIFO in a channel.
Definition: gr55xx_ll_i2s.h:794
ll_i2s_disable_clock
__STATIC_INLINE void ll_i2s_disable_clock(i2s_regs_t *I2Sx)
Disable I2S clock.
Definition: gr55xx_ll_i2s.h:471
ll_i2s_is_enabled_dma_mode
__STATIC_INLINE uint32_t ll_i2s_is_enabled_dma_mode(i2s_regs_t *I2Sx)
Check if I2S DMA mode is enabled.
Definition: gr55xx_ll_i2s.h:1441
ll_i2s_get_txsize
__STATIC_INLINE uint32_t ll_i2s_get_txsize(i2s_regs_t *I2Sx)
Get transmit data width in a channel.
Definition: gr55xx_ll_i2s.h:988
ll_i2s_set_rx_fifo_threshold
__STATIC_INLINE void ll_i2s_set_rx_fifo_threshold(i2s_regs_t *I2Sx, uint32_t threshold)
Set threshold of RXFIFO in a channel that triggers an RXDA event.
Definition: gr55xx_ll_i2s.h:1166
ll_i2s_enable_tx
__STATIC_INLINE void ll_i2s_enable_tx(i2s_regs_t *I2Sx)
Enable TX in a channel.
Definition: gr55xx_ll_i2s.h:870
ll_i2s_get_clock_div
__STATIC_INLINE uint32_t ll_i2s_get_clock_div(void)
Get I2S clock divider.
Definition: gr55xx_ll_i2s.h:624
ll_i2s_disable_it
__STATIC_INLINE void ll_i2s_disable_it(i2s_regs_t *I2Sx, uint32_t mask)
Disable interrupt in a channel.
Definition: gr55xx_ll_i2s.h:1081
_ll_i2s_init_t
LL I2S init structures definition.
Definition: gr55xx_ll_i2s.h:77
ll_i2s_clr_txfifo_channel
__STATIC_INLINE void ll_i2s_clr_txfifo_channel(i2s_regs_t *I2Sx)
Clear TX FIFO data in a channel.
Definition: gr55xx_ll_i2s.h:1290
ll_i2s_deinit
error_status_t ll_i2s_deinit(i2s_regs_t *I2Sx)
De-initialize I2S registers (Registers restored to their default values).
ll_i2s_disable_clock_div
__STATIC_INLINE void ll_i2s_disable_clock_div(void)
Disable I2S clock divider.
Definition: gr55xx_ll_i2s.h:652
ll_i2s_disable
__STATIC_INLINE void ll_i2s_disable(i2s_regs_t *I2Sx)
Disable I2S.
Definition: gr55xx_ll_i2s.h:336