1 /*
2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
3 * Copyright 2016-2020 NXP
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8 #ifndef FSL_FLEXIO_I2S_H_
9 #define FSL_FLEXIO_I2S_H_
10
11 #include "fsl_common.h"
12 #include "fsl_flexio.h"
13
14 /*!
15 * @addtogroup flexio_i2s
16 * @{
17 */
18
19 /*******************************************************************************
20 * Definitions
21 ******************************************************************************/
22
23 /*! @name Driver version */
24 /*! @{ */
25 /*! @brief FlexIO I2S driver version 2.2.0. */
26 #define FSL_FLEXIO_I2S_DRIVER_VERSION (MAKE_VERSION(2, 2, 0))
27 /*! @} */
28
29 /*! @brief Retry times for waiting flag. */
30 #ifndef I2S_RETRY_TIMES
31 #define I2S_RETRY_TIMES 0U /* Define to zero means keep waiting until the flag is assert/deassert. */
32 #endif
33
34 /*! @brief FlexIO I2S transfer status */
35 enum
36 {
37 kStatus_FLEXIO_I2S_Idle = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 0), /*!< FlexIO I2S is in idle state */
38 kStatus_FLEXIO_I2S_TxBusy = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 1), /*!< FlexIO I2S Tx is busy */
39 kStatus_FLEXIO_I2S_RxBusy = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 2), /*!< FlexIO I2S Tx is busy */
40 kStatus_FLEXIO_I2S_Error = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 3), /*!< FlexIO I2S error occurred */
41 kStatus_FLEXIO_I2S_QueueFull = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 4), /*!< FlexIO I2S transfer queue is full. */
42 kStatus_FLEXIO_I2S_Timeout =
43 MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 5), /*!< FlexIO I2S timeout polling status flags. */
44 };
45
46 /*! @brief Define FlexIO I2S access structure typedef */
47 typedef struct _flexio_i2s_type
48 {
49 FLEXIO_Type *flexioBase; /*!< FlexIO base pointer */
50 uint8_t txPinIndex; /*!< Tx data pin index in FlexIO pins */
51 uint8_t rxPinIndex; /*!< Rx data pin index */
52 uint8_t bclkPinIndex; /*!< Bit clock pin index */
53 uint8_t fsPinIndex; /*!< Frame sync pin index */
54 uint8_t txShifterIndex; /*!< Tx data shifter index */
55 uint8_t rxShifterIndex; /*!< Rx data shifter index */
56 uint8_t bclkTimerIndex; /*!< Bit clock timer index */
57 uint8_t fsTimerIndex; /*!< Frame sync timer index */
58 } FLEXIO_I2S_Type;
59
60 /*! @brief Master or slave mode */
61 typedef enum _flexio_i2s_master_slave
62 {
63 kFLEXIO_I2S_Master = 0x0U, /*!< Master mode */
64 kFLEXIO_I2S_Slave = 0x1U /*!< Slave mode */
65 } flexio_i2s_master_slave_t;
66
67 /*! @brief _flexio_i2s_interrupt_enable Define FlexIO FlexIO I2S interrupt mask. */
68 enum
69 {
70 kFLEXIO_I2S_TxDataRegEmptyInterruptEnable = 0x1U, /*!< Transmit buffer empty interrupt enable. */
71 kFLEXIO_I2S_RxDataRegFullInterruptEnable = 0x2U, /*!< Receive buffer full interrupt enable. */
72 };
73
74 /*! @brief _flexio_i2s_status_flags Define FlexIO FlexIO I2S status mask. */
75 enum
76 {
77 kFLEXIO_I2S_TxDataRegEmptyFlag = 0x1U, /*!< Transmit buffer empty flag. */
78 kFLEXIO_I2S_RxDataRegFullFlag = 0x2U, /*!< Receive buffer full flag. */
79 };
80
81 /*! @brief FlexIO I2S configure structure */
82 typedef struct _flexio_i2s_config
83 {
84 bool enableI2S; /*!< Enable FlexIO I2S */
85 flexio_i2s_master_slave_t masterSlave; /*!< Master or slave */
86 flexio_pin_polarity_t txPinPolarity; /*!< Tx data pin polarity, active high or low */
87 flexio_pin_polarity_t rxPinPolarity; /*!< Rx data pin polarity */
88 flexio_pin_polarity_t bclkPinPolarity; /*!< Bit clock pin polarity */
89 flexio_pin_polarity_t fsPinPolarity; /*!< Frame sync pin polarity */
90 flexio_shifter_timer_polarity_t txTimerPolarity; /*!< Tx data valid on bclk rising or falling edge */
91 flexio_shifter_timer_polarity_t rxTimerPolarity; /*!< Rx data valid on bclk rising or falling edge */
92 } flexio_i2s_config_t;
93
94 /*! @brief FlexIO I2S audio format, FlexIO I2S only support the same format in Tx and Rx */
95 typedef struct _flexio_i2s_format
96 {
97 uint8_t bitWidth; /*!< Bit width of audio data, always 8/16/24/32 bits */
98 uint32_t sampleRate_Hz; /*!< Sample rate of the audio data */
99 } flexio_i2s_format_t;
100
101 /*!@brief FlexIO I2S transfer queue size, user can refine it according to use case. */
102 #define FLEXIO_I2S_XFER_QUEUE_SIZE (4U)
103
104 /*! @brief Audio sample rate */
105 typedef enum _flexio_i2s_sample_rate
106 {
107 kFLEXIO_I2S_SampleRate8KHz = 8000U, /*!< Sample rate 8000Hz */
108 kFLEXIO_I2S_SampleRate11025Hz = 11025U, /*!< Sample rate 11025Hz */
109 kFLEXIO_I2S_SampleRate12KHz = 12000U, /*!< Sample rate 12000Hz */
110 kFLEXIO_I2S_SampleRate16KHz = 16000U, /*!< Sample rate 16000Hz */
111 kFLEXIO_I2S_SampleRate22050Hz = 22050U, /*!< Sample rate 22050Hz */
112 kFLEXIO_I2S_SampleRate24KHz = 24000U, /*!< Sample rate 24000Hz */
113 kFLEXIO_I2S_SampleRate32KHz = 32000U, /*!< Sample rate 32000Hz */
114 kFLEXIO_I2S_SampleRate44100Hz = 44100U, /*!< Sample rate 44100Hz */
115 kFLEXIO_I2S_SampleRate48KHz = 48000U, /*!< Sample rate 48000Hz */
116 kFLEXIO_I2S_SampleRate96KHz = 96000U /*!< Sample rate 96000Hz */
117 } flexio_i2s_sample_rate_t;
118
119 /*! @brief Audio word width */
120 typedef enum _flexio_i2s_word_width
121 {
122 kFLEXIO_I2S_WordWidth8bits = 8U, /*!< Audio data width 8 bits */
123 kFLEXIO_I2S_WordWidth16bits = 16U, /*!< Audio data width 16 bits */
124 kFLEXIO_I2S_WordWidth24bits = 24U, /*!< Audio data width 24 bits */
125 kFLEXIO_I2S_WordWidth32bits = 32U /*!< Audio data width 32 bits */
126 } flexio_i2s_word_width_t;
127
128 /*! @brief Define FlexIO I2S transfer structure. */
129 typedef struct _flexio_i2s_transfer
130 {
131 uint8_t *data; /*!< Data buffer start pointer */
132 size_t dataSize; /*!< Bytes to be transferred. */
133 } flexio_i2s_transfer_t;
134
135 typedef struct _flexio_i2s_handle flexio_i2s_handle_t;
136
137 /*! @brief FlexIO I2S xfer callback prototype */
138 typedef void (*flexio_i2s_callback_t)(FLEXIO_I2S_Type *base,
139 flexio_i2s_handle_t *handle,
140 status_t status,
141 void *userData);
142
143 /*! @brief Define FlexIO I2S handle structure. */
144 struct _flexio_i2s_handle
145 {
146 uint32_t state; /*!< Internal state */
147 flexio_i2s_callback_t callback; /*!< Callback function called at transfer event*/
148 void *userData; /*!< Callback parameter passed to callback function*/
149 uint8_t bitWidth; /*!< Bit width for transfer, 8/16/24/32bits */
150 flexio_i2s_transfer_t queue[FLEXIO_I2S_XFER_QUEUE_SIZE]; /*!< Transfer queue storing queued transfer */
151 size_t transferSize[FLEXIO_I2S_XFER_QUEUE_SIZE]; /*!< Data bytes need to transfer */
152 volatile uint8_t queueUser; /*!< Index for user to queue transfer */
153 volatile uint8_t queueDriver; /*!< Index for driver to get the transfer data and size */
154 };
155
156 /*******************************************************************************
157 * API
158 ******************************************************************************/
159
160 #if defined(__cplusplus)
161 extern "C" {
162 #endif /*_cplusplus*/
163
164 /*!
165 * @name Initialization and deinitialization
166 * @{
167 */
168
169 /*!
170 * @brief Initializes the FlexIO I2S.
171 *
172 * This API configures FlexIO pins and shifter to I2S and configures the FlexIO I2S with a configuration structure.
173 * The configuration structure can be filled by the user, or be set with default values by
174 * FLEXIO_I2S_GetDefaultConfig().
175 *
176 * @note This API should be called at the beginning of the application to use
177 * the FlexIO I2S driver. Otherwise, any access to the FlexIO I2S module can cause hard fault
178 * because the clock is not enabled.
179 *
180 * @param base FlexIO I2S base pointer
181 * @param config FlexIO I2S configure structure.
182 */
183 void FLEXIO_I2S_Init(FLEXIO_I2S_Type *base, const flexio_i2s_config_t *config);
184
185 /*!
186 * @brief Sets the FlexIO I2S configuration structure to default values.
187 *
188 * The purpose of this API is to get the configuration structure initialized for use in FLEXIO_I2S_Init().
189 * Users may use the initialized structure unchanged in FLEXIO_I2S_Init() or modify
190 * some fields of the structure before calling FLEXIO_I2S_Init().
191 *
192 * @param config pointer to master configuration structure
193 */
194 void FLEXIO_I2S_GetDefaultConfig(flexio_i2s_config_t *config);
195
196 /*!
197 * @brief De-initializes the FlexIO I2S.
198 *
199 * Calling this API resets the FlexIO I2S shifter and timer config. After calling this API,
200 * call the FLEXO_I2S_Init to use the FlexIO I2S module.
201 *
202 * @param base FlexIO I2S base pointer
203 */
204 void FLEXIO_I2S_Deinit(FLEXIO_I2S_Type *base);
205
206 /*!
207 * @brief Enables/disables the FlexIO I2S module operation.
208 *
209 * @param base Pointer to FLEXIO_I2S_Type
210 * @param enable True to enable, false dose not have any effect.
211 */
FLEXIO_I2S_Enable(FLEXIO_I2S_Type * base,bool enable)212 static inline void FLEXIO_I2S_Enable(FLEXIO_I2S_Type *base, bool enable)
213 {
214 if (enable)
215 {
216 base->flexioBase->CTRL |= FLEXIO_CTRL_FLEXEN_MASK;
217 }
218 }
219
220 /*! @} */
221
222 /*!
223 * @name Status
224 * @{
225 */
226
227 /*!
228 * @brief Gets the FlexIO I2S status flags.
229 *
230 * @param base Pointer to FLEXIO_I2S_Type structure
231 * @return Status flag, which are ORed by the enumerators in the _flexio_i2s_status_flags.
232 */
233 uint32_t FLEXIO_I2S_GetStatusFlags(FLEXIO_I2S_Type *base);
234
235 /*! @} */
236
237 /*!
238 * @name Interrupts
239 * @{
240 */
241
242 /*!
243 * @brief Enables the FlexIO I2S interrupt.
244 *
245 * This function enables the FlexIO UART interrupt.
246 *
247 * @param base Pointer to FLEXIO_I2S_Type structure
248 * @param mask interrupt source
249 */
250 void FLEXIO_I2S_EnableInterrupts(FLEXIO_I2S_Type *base, uint32_t mask);
251
252 /*!
253 * @brief Disables the FlexIO I2S interrupt.
254 *
255 * This function enables the FlexIO UART interrupt.
256 *
257 * @param base pointer to FLEXIO_I2S_Type structure
258 * @param mask interrupt source
259 */
260 void FLEXIO_I2S_DisableInterrupts(FLEXIO_I2S_Type *base, uint32_t mask);
261
262 /*! @} */
263
264 /*!
265 * @name DMA Control
266 * @{
267 */
268
269 /*!
270 * @brief Enables/disables the FlexIO I2S Tx DMA requests.
271 *
272 * @param base FlexIO I2S base pointer
273 * @param enable True means enable DMA, false means disable DMA.
274 */
FLEXIO_I2S_TxEnableDMA(FLEXIO_I2S_Type * base,bool enable)275 static inline void FLEXIO_I2S_TxEnableDMA(FLEXIO_I2S_Type *base, bool enable)
276 {
277 FLEXIO_EnableShifterStatusDMA(base->flexioBase, 1UL << base->txShifterIndex, enable);
278 }
279
280 /*!
281 * @brief Enables/disables the FlexIO I2S Rx DMA requests.
282 *
283 * @param base FlexIO I2S base pointer
284 * @param enable True means enable DMA, false means disable DMA.
285 */
FLEXIO_I2S_RxEnableDMA(FLEXIO_I2S_Type * base,bool enable)286 static inline void FLEXIO_I2S_RxEnableDMA(FLEXIO_I2S_Type *base, bool enable)
287 {
288 FLEXIO_EnableShifterStatusDMA(base->flexioBase, 1UL << base->rxShifterIndex, enable);
289 }
290
291 /*!
292 * @brief Gets the FlexIO I2S send data register address.
293 *
294 * This function returns the I2S data register address, mainly used by DMA/eDMA.
295 *
296 * @param base Pointer to FLEXIO_I2S_Type structure
297 * @return FlexIO i2s send data register address.
298 */
FLEXIO_I2S_TxGetDataRegisterAddress(FLEXIO_I2S_Type * base)299 static inline uint32_t FLEXIO_I2S_TxGetDataRegisterAddress(FLEXIO_I2S_Type *base)
300 {
301 return FLEXIO_GetShifterBufferAddress(base->flexioBase, kFLEXIO_ShifterBufferBitSwapped, base->txShifterIndex);
302 }
303
304 /*!
305 * @brief Gets the FlexIO I2S receive data register address.
306 *
307 * This function returns the I2S data register address, mainly used by DMA/eDMA.
308 *
309 * @param base Pointer to FLEXIO_I2S_Type structure
310 * @return FlexIO i2s receive data register address.
311 */
FLEXIO_I2S_RxGetDataRegisterAddress(FLEXIO_I2S_Type * base)312 static inline uint32_t FLEXIO_I2S_RxGetDataRegisterAddress(FLEXIO_I2S_Type *base)
313 {
314 return FLEXIO_GetShifterBufferAddress(base->flexioBase, kFLEXIO_ShifterBufferBitSwapped, base->rxShifterIndex);
315 }
316
317 /*! @} */
318
319 /*!
320 * @name Bus Operations
321 * @{
322 */
323
324 /*!
325 * @brief Configures the FlexIO I2S audio format in master mode.
326 *
327 * Audio format can be changed in run-time of FlexIO I2S. This function configures the sample rate and audio data
328 * format to be transferred.
329 *
330 * @param base Pointer to FLEXIO_I2S_Type structure
331 * @param format Pointer to FlexIO I2S audio data format structure.
332 * @param srcClock_Hz I2S master clock source frequency in Hz.
333 */
334 void FLEXIO_I2S_MasterSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_format_t *format, uint32_t srcClock_Hz);
335
336 /*!
337 * @brief Configures the FlexIO I2S audio format in slave mode.
338 *
339 * Audio format can be changed in run-time of FlexIO I2S. This function configures the sample rate and audio data
340 * format to be transferred.
341 *
342 * @param base Pointer to FLEXIO_I2S_Type structure
343 * @param format Pointer to FlexIO I2S audio data format structure.
344 */
345 void FLEXIO_I2S_SlaveSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_format_t *format);
346
347 /*!
348 * @brief Sends data using a blocking method.
349 *
350 * @note This function blocks via polling until data is ready to be sent.
351 *
352 * @param base FlexIO I2S base pointer.
353 * @param bitWidth How many bits in a audio word, usually 8/16/24/32 bits.
354 * @param txData Pointer to the data to be written.
355 * @param size Bytes to be written.
356 * @retval kStatus_Success Successfully write data.
357 * @retval kStatus_FLEXIO_I2C_Timeout Timeout polling status flags.
358 */
359 status_t FLEXIO_I2S_WriteBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *txData, size_t size);
360
361 /*!
362 * @brief Writes data into a data register.
363 *
364 * @param base FlexIO I2S base pointer.
365 * @param bitWidth How many bits in a audio word, usually 8/16/24/32 bits.
366 * @param data Data to be written.
367 */
FLEXIO_I2S_WriteData(FLEXIO_I2S_Type * base,uint8_t bitWidth,uint32_t data)368 static inline void FLEXIO_I2S_WriteData(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint32_t data)
369 {
370 base->flexioBase->SHIFTBUFBIS[base->txShifterIndex] = (data << (32U - bitWidth));
371 }
372
373 /*!
374 * @brief Receives a piece of data using a blocking method.
375 *
376 * @note This function blocks via polling until data is ready to be sent.
377 *
378 * @param base FlexIO I2S base pointer
379 * @param bitWidth How many bits in a audio word, usually 8/16/24/32 bits.
380 * @param rxData Pointer to the data to be read.
381 * @param size Bytes to be read.
382 * @retval kStatus_Success Successfully read data.
383 * @retval kStatus_FLEXIO_I2C_Timeout Timeout polling status flags.
384 */
385 status_t FLEXIO_I2S_ReadBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *rxData, size_t size);
386
387 /*!
388 * @brief Reads a data from the data register.
389 *
390 * @param base FlexIO I2S base pointer
391 * @return Data read from data register.
392 */
FLEXIO_I2S_ReadData(FLEXIO_I2S_Type * base)393 static inline uint32_t FLEXIO_I2S_ReadData(FLEXIO_I2S_Type *base)
394 {
395 return base->flexioBase->SHIFTBUFBIS[base->rxShifterIndex];
396 }
397
398 /*! @} */
399
400 /*!
401 * @name Transactional
402 * @{
403 */
404
405 /*!
406 * @brief Initializes the FlexIO I2S handle.
407 *
408 * This function initializes the FlexIO I2S handle which can be used for other
409 * FlexIO I2S transactional APIs. Call this API once to get the
410 * initialized handle.
411 *
412 * @param base Pointer to FLEXIO_I2S_Type structure
413 * @param handle Pointer to flexio_i2s_handle_t structure to store the transfer state.
414 * @param callback FlexIO I2S callback function, which is called while finished a block.
415 * @param userData User parameter for the FlexIO I2S callback.
416 */
417 void FLEXIO_I2S_TransferTxCreateHandle(FLEXIO_I2S_Type *base,
418 flexio_i2s_handle_t *handle,
419 flexio_i2s_callback_t callback,
420 void *userData);
421
422 /*!
423 * @brief Configures the FlexIO I2S audio format.
424 *
425 * Audio format can be changed at run-time of FlexIO I2S. This function configures the sample rate and audio data
426 * format to be transferred.
427 *
428 * @param base Pointer to FLEXIO_I2S_Type structure.
429 * @param handle FlexIO I2S handle pointer.
430 * @param format Pointer to audio data format structure.
431 * @param srcClock_Hz FlexIO I2S bit clock source frequency in Hz. This parameter should be 0 while in slave mode.
432 */
433 void FLEXIO_I2S_TransferSetFormat(FLEXIO_I2S_Type *base,
434 flexio_i2s_handle_t *handle,
435 flexio_i2s_format_t *format,
436 uint32_t srcClock_Hz);
437
438 /*!
439 * @brief Initializes the FlexIO I2S receive handle.
440 *
441 * This function initializes the FlexIO I2S handle which can be used for other
442 * FlexIO I2S transactional APIs. Call this API once to get the
443 * initialized handle.
444 *
445 * @param base Pointer to FLEXIO_I2S_Type structure.
446 * @param handle Pointer to flexio_i2s_handle_t structure to store the transfer state.
447 * @param callback FlexIO I2S callback function, which is called while finished a block.
448 * @param userData User parameter for the FlexIO I2S callback.
449 */
450 void FLEXIO_I2S_TransferRxCreateHandle(FLEXIO_I2S_Type *base,
451 flexio_i2s_handle_t *handle,
452 flexio_i2s_callback_t callback,
453 void *userData);
454
455 /*!
456 * @brief Performs an interrupt non-blocking send transfer on FlexIO I2S.
457 *
458 * @note The API returns immediately after transfer initiates.
459 * Call FLEXIO_I2S_GetRemainingBytes to poll the transfer status and check whether
460 * the transfer is finished. If the return status is 0, the transfer is finished.
461 *
462 * @param base Pointer to FLEXIO_I2S_Type structure.
463 * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state
464 * @param xfer Pointer to flexio_i2s_transfer_t structure
465 * @retval kStatus_Success Successfully start the data transmission.
466 * @retval kStatus_FLEXIO_I2S_TxBusy Previous transmission still not finished, data not all written to TX register yet.
467 * @retval kStatus_InvalidArgument The input parameter is invalid.
468 */
469 status_t FLEXIO_I2S_TransferSendNonBlocking(FLEXIO_I2S_Type *base,
470 flexio_i2s_handle_t *handle,
471 flexio_i2s_transfer_t *xfer);
472
473 /*!
474 * @brief Performs an interrupt non-blocking receive transfer on FlexIO I2S.
475 *
476 * @note The API returns immediately after transfer initiates.
477 * Call FLEXIO_I2S_GetRemainingBytes to poll the transfer status to check whether
478 * the transfer is finished. If the return status is 0, the transfer is finished.
479 *
480 * @param base Pointer to FLEXIO_I2S_Type structure.
481 * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state
482 * @param xfer Pointer to flexio_i2s_transfer_t structure
483 * @retval kStatus_Success Successfully start the data receive.
484 * @retval kStatus_FLEXIO_I2S_RxBusy Previous receive still not finished.
485 * @retval kStatus_InvalidArgument The input parameter is invalid.
486 */
487 status_t FLEXIO_I2S_TransferReceiveNonBlocking(FLEXIO_I2S_Type *base,
488 flexio_i2s_handle_t *handle,
489 flexio_i2s_transfer_t *xfer);
490
491 /*!
492 * @brief Aborts the current send.
493 *
494 * @note This API can be called at any time when interrupt non-blocking transfer initiates
495 * to abort the transfer in a early time.
496 *
497 * @param base Pointer to FLEXIO_I2S_Type structure.
498 * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state
499 */
500 void FLEXIO_I2S_TransferAbortSend(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle);
501
502 /*!
503 * @brief Aborts the current receive.
504 *
505 * @note This API can be called at any time when interrupt non-blocking transfer initiates
506 * to abort the transfer in a early time.
507 *
508 * @param base Pointer to FLEXIO_I2S_Type structure.
509 * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state
510 */
511 void FLEXIO_I2S_TransferAbortReceive(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle);
512
513 /*!
514 * @brief Gets the remaining bytes to be sent.
515 *
516 * @param base Pointer to FLEXIO_I2S_Type structure.
517 * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state
518 * @param count Bytes sent.
519 * @retval kStatus_Success Succeed get the transfer count.
520 * @retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress.
521 */
522 status_t FLEXIO_I2S_TransferGetSendCount(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, size_t *count);
523
524 /*!
525 * @brief Gets the remaining bytes to be received.
526 *
527 * @param base Pointer to FLEXIO_I2S_Type structure.
528 * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state
529 * @param count Bytes recieved.
530 * @return count Bytes received.
531 * @retval kStatus_Success Succeed get the transfer count.
532 * @retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress.
533 */
534 status_t FLEXIO_I2S_TransferGetReceiveCount(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, size_t *count);
535
536 /*!
537 * @brief Tx interrupt handler.
538 *
539 * @param i2sBase Pointer to FLEXIO_I2S_Type structure.
540 * @param i2sHandle Pointer to flexio_i2s_handle_t structure
541 */
542 void FLEXIO_I2S_TransferTxHandleIRQ(void *i2sBase, void *i2sHandle);
543
544 /*!
545 * @brief Rx interrupt handler.
546 *
547 * @param i2sBase Pointer to FLEXIO_I2S_Type structure.
548 * @param i2sHandle Pointer to flexio_i2s_handle_t structure.
549 */
550 void FLEXIO_I2S_TransferRxHandleIRQ(void *i2sBase, void *i2sHandle);
551
552 /*! @} */
553
554 #if defined(__cplusplus)
555 }
556 #endif /*_cplusplus*/
557
558 /*! @} */
559
560 #endif /* FSL_FLEXIO_I2S_H_ */
561