Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:22:59

0001 /*
0002  * Copyright (c) 2015, Freescale Semiconductor, Inc.
0003  * Copyright 2016-2020 NXP
0004  * All rights reserved.
0005  *
0006  * SPDX-License-Identifier: BSD-3-Clause
0007  */
0008 #ifndef _FSL_FLEXIO_I2S_H_
0009 #define _FSL_FLEXIO_I2S_H_
0010 
0011 #include "fsl_common.h"
0012 #include "fsl_flexio.h"
0013 
0014 /*!
0015  * @addtogroup flexio_i2s
0016  * @{
0017  */
0018 
0019 /*******************************************************************************
0020  * Definitions
0021  ******************************************************************************/
0022 
0023 /*! @name Driver version */
0024 /*@{*/
0025 /*! @brief FlexIO I2S driver version 2.2.0. */
0026 #define FSL_FLEXIO_I2S_DRIVER_VERSION (MAKE_VERSION(2, 2, 0))
0027 /*@}*/
0028 
0029 /*! @brief Retry times for waiting flag. */
0030 #ifndef I2S_RETRY_TIMES
0031 #define I2S_RETRY_TIMES 0U /* Define to zero means keep waiting until the flag is assert/deassert. */
0032 #endif
0033 
0034 /*! @brief FlexIO I2S transfer status */
0035 enum
0036 {
0037     kStatus_FLEXIO_I2S_Idle      = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 0), /*!< FlexIO I2S is in idle state */
0038     kStatus_FLEXIO_I2S_TxBusy    = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 1), /*!< FlexIO I2S Tx is busy */
0039     kStatus_FLEXIO_I2S_RxBusy    = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 2), /*!< FlexIO I2S Tx is busy */
0040     kStatus_FLEXIO_I2S_Error     = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 3), /*!< FlexIO I2S error occurred */
0041     kStatus_FLEXIO_I2S_QueueFull = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 4), /*!< FlexIO I2S transfer queue is full. */
0042     kStatus_FLEXIO_I2S_Timeout =
0043         MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 5), /*!< FlexIO I2S timeout polling status flags. */
0044 };
0045 
0046 /*! @brief Define FlexIO I2S access structure typedef */
0047 typedef struct _flexio_i2s_type
0048 {
0049     FLEXIO_Type *flexioBase; /*!< FlexIO base pointer */
0050     uint8_t txPinIndex;      /*!< Tx data pin index in FlexIO pins */
0051     uint8_t rxPinIndex;      /*!< Rx data pin index */
0052     uint8_t bclkPinIndex;    /*!< Bit clock pin index */
0053     uint8_t fsPinIndex;      /*!< Frame sync pin index */
0054     uint8_t txShifterIndex;  /*!< Tx data shifter index */
0055     uint8_t rxShifterIndex;  /*!< Rx data shifter index */
0056     uint8_t bclkTimerIndex;  /*!< Bit clock timer index */
0057     uint8_t fsTimerIndex;    /*!< Frame sync timer index */
0058 } FLEXIO_I2S_Type;
0059 
0060 /*! @brief Master or slave mode */
0061 typedef enum _flexio_i2s_master_slave
0062 {
0063     kFLEXIO_I2S_Master = 0x0U, /*!< Master mode */
0064     kFLEXIO_I2S_Slave  = 0x1U  /*!< Slave mode */
0065 } flexio_i2s_master_slave_t;
0066 
0067 /*! @brief _flexio_i2s_interrupt_enable Define FlexIO FlexIO I2S interrupt mask. */
0068 enum
0069 {
0070     kFLEXIO_I2S_TxDataRegEmptyInterruptEnable = 0x1U, /*!< Transmit buffer empty interrupt enable. */
0071     kFLEXIO_I2S_RxDataRegFullInterruptEnable  = 0x2U, /*!< Receive buffer full interrupt enable. */
0072 };
0073 
0074 /*! @brief _flexio_i2s_status_flags Define FlexIO FlexIO I2S status mask. */
0075 enum
0076 {
0077     kFLEXIO_I2S_TxDataRegEmptyFlag = 0x1U, /*!< Transmit buffer empty flag. */
0078     kFLEXIO_I2S_RxDataRegFullFlag  = 0x2U, /*!< Receive buffer full flag. */
0079 };
0080 
0081 /*! @brief FlexIO I2S configure structure */
0082 typedef struct _flexio_i2s_config
0083 {
0084     bool enableI2S;                                  /*!< Enable FlexIO I2S */
0085     flexio_i2s_master_slave_t masterSlave;           /*!< Master or slave */
0086     flexio_pin_polarity_t txPinPolarity;             /*!< Tx data pin polarity, active high or low */
0087     flexio_pin_polarity_t rxPinPolarity;             /*!< Rx data pin polarity */
0088     flexio_pin_polarity_t bclkPinPolarity;           /*!< Bit clock pin polarity */
0089     flexio_pin_polarity_t fsPinPolarity;             /*!< Frame sync pin polarity */
0090     flexio_shifter_timer_polarity_t txTimerPolarity; /*!< Tx data valid on bclk rising or falling edge */
0091     flexio_shifter_timer_polarity_t rxTimerPolarity; /*!< Rx data valid on bclk rising or falling edge */
0092 } flexio_i2s_config_t;
0093 
0094 /*! @brief FlexIO I2S audio format, FlexIO I2S only support the same format in Tx and Rx */
0095 typedef struct _flexio_i2s_format
0096 {
0097     uint8_t bitWidth;       /*!< Bit width of audio data, always 8/16/24/32 bits */
0098     uint32_t sampleRate_Hz; /*!< Sample rate of the audio data */
0099 } flexio_i2s_format_t;
0100 
0101 /*!@brief FlexIO I2S transfer queue size, user can refine it according to use case. */
0102 #define FLEXIO_I2S_XFER_QUEUE_SIZE (4U)
0103 
0104 /*! @brief Audio sample rate */
0105 typedef enum _flexio_i2s_sample_rate
0106 {
0107     kFLEXIO_I2S_SampleRate8KHz    = 8000U,  /*!< Sample rate 8000Hz */
0108     kFLEXIO_I2S_SampleRate11025Hz = 11025U, /*!< Sample rate 11025Hz */
0109     kFLEXIO_I2S_SampleRate12KHz   = 12000U, /*!< Sample rate 12000Hz */
0110     kFLEXIO_I2S_SampleRate16KHz   = 16000U, /*!< Sample rate 16000Hz */
0111     kFLEXIO_I2S_SampleRate22050Hz = 22050U, /*!< Sample rate 22050Hz */
0112     kFLEXIO_I2S_SampleRate24KHz   = 24000U, /*!< Sample rate 24000Hz */
0113     kFLEXIO_I2S_SampleRate32KHz   = 32000U, /*!< Sample rate 32000Hz */
0114     kFLEXIO_I2S_SampleRate44100Hz = 44100U, /*!< Sample rate 44100Hz */
0115     kFLEXIO_I2S_SampleRate48KHz   = 48000U, /*!< Sample rate 48000Hz */
0116     kFLEXIO_I2S_SampleRate96KHz   = 96000U  /*!< Sample rate 96000Hz */
0117 } flexio_i2s_sample_rate_t;
0118 
0119 /*! @brief Audio word width */
0120 typedef enum _flexio_i2s_word_width
0121 {
0122     kFLEXIO_I2S_WordWidth8bits  = 8U,  /*!< Audio data width 8 bits */
0123     kFLEXIO_I2S_WordWidth16bits = 16U, /*!< Audio data width 16 bits */
0124     kFLEXIO_I2S_WordWidth24bits = 24U, /*!< Audio data width 24 bits */
0125     kFLEXIO_I2S_WordWidth32bits = 32U  /*!< Audio data width 32 bits */
0126 } flexio_i2s_word_width_t;
0127 
0128 /*! @brief Define FlexIO I2S transfer structure. */
0129 typedef struct _flexio_i2s_transfer
0130 {
0131     uint8_t *data;   /*!< Data buffer start pointer */
0132     size_t dataSize; /*!< Bytes to be transferred. */
0133 } flexio_i2s_transfer_t;
0134 
0135 typedef struct _flexio_i2s_handle flexio_i2s_handle_t;
0136 
0137 /*! @brief FlexIO I2S xfer callback prototype */
0138 typedef void (*flexio_i2s_callback_t)(FLEXIO_I2S_Type *base,
0139                                       flexio_i2s_handle_t *handle,
0140                                       status_t status,
0141                                       void *userData);
0142 
0143 /*! @brief Define FlexIO I2S handle structure. */
0144 struct _flexio_i2s_handle
0145 {
0146     uint32_t state;                                          /*!< Internal state */
0147     flexio_i2s_callback_t callback;                          /*!< Callback function called at transfer event*/
0148     void *userData;                                          /*!< Callback parameter passed to callback function*/
0149     uint8_t bitWidth;                                        /*!< Bit width for transfer, 8/16/24/32bits */
0150     flexio_i2s_transfer_t queue[FLEXIO_I2S_XFER_QUEUE_SIZE]; /*!< Transfer queue storing queued transfer */
0151     size_t transferSize[FLEXIO_I2S_XFER_QUEUE_SIZE];         /*!< Data bytes need to transfer */
0152     volatile uint8_t queueUser;                              /*!< Index for user to queue transfer */
0153     volatile uint8_t queueDriver;                            /*!< Index for driver to get the transfer data and size */
0154 };
0155 
0156 /*******************************************************************************
0157  * API
0158  ******************************************************************************/
0159 
0160 #if defined(__cplusplus)
0161 extern "C" {
0162 #endif /*_cplusplus*/
0163 
0164 /*!
0165  * @name Initialization and deinitialization
0166  * @{
0167  */
0168 
0169 /*!
0170  * @brief Initializes the FlexIO I2S.
0171  *
0172  * This API configures FlexIO pins and shifter to I2S and configures the FlexIO I2S with a configuration structure.
0173  * The configuration structure can be filled by the user, or be set with default values by
0174  * FLEXIO_I2S_GetDefaultConfig().
0175  *
0176  * @note  This API should be called at the beginning of the application to use
0177  * the FlexIO I2S driver. Otherwise, any access to the FlexIO I2S module can cause hard fault
0178  * because the clock is not enabled.
0179  *
0180  * @param base FlexIO I2S base pointer
0181  * @param config FlexIO I2S configure structure.
0182  */
0183 void FLEXIO_I2S_Init(FLEXIO_I2S_Type *base, const flexio_i2s_config_t *config);
0184 
0185 /*!
0186  * @brief  Sets the FlexIO I2S configuration structure to default values.
0187  *
0188  * The purpose of this API is to get the configuration structure initialized for use in FLEXIO_I2S_Init().
0189  * Users may use the initialized structure unchanged in FLEXIO_I2S_Init() or modify
0190  * some fields of the structure before calling FLEXIO_I2S_Init().
0191  *
0192  * @param config pointer to master configuration structure
0193  */
0194 void FLEXIO_I2S_GetDefaultConfig(flexio_i2s_config_t *config);
0195 
0196 /*!
0197  * @brief De-initializes the FlexIO I2S.
0198  *
0199  * Calling this API resets the FlexIO I2S shifter and timer config. After calling this API,
0200  * call the FLEXO_I2S_Init to use the FlexIO I2S module.
0201  *
0202  * @param base FlexIO I2S base pointer
0203  */
0204 void FLEXIO_I2S_Deinit(FLEXIO_I2S_Type *base);
0205 
0206 /*!
0207  * @brief Enables/disables the FlexIO I2S module operation.
0208  *
0209  * @param base Pointer to FLEXIO_I2S_Type
0210  * @param enable True to enable, false dose not have any effect.
0211  */
0212 static inline void FLEXIO_I2S_Enable(FLEXIO_I2S_Type *base, bool enable)
0213 {
0214     if (enable)
0215     {
0216         base->flexioBase->CTRL |= FLEXIO_CTRL_FLEXEN_MASK;
0217     }
0218 }
0219 
0220 /*! @} */
0221 
0222 /*!
0223  * @name Status
0224  * @{
0225  */
0226 
0227 /*!
0228  * @brief Gets the FlexIO I2S status flags.
0229  *
0230  * @param base Pointer to FLEXIO_I2S_Type structure
0231  * @return Status flag, which are ORed by the enumerators in the _flexio_i2s_status_flags.
0232  */
0233 uint32_t FLEXIO_I2S_GetStatusFlags(FLEXIO_I2S_Type *base);
0234 
0235 /*! @} */
0236 
0237 /*!
0238  * @name Interrupts
0239  * @{
0240  */
0241 
0242 /*!
0243  * @brief Enables the FlexIO I2S interrupt.
0244  *
0245  * This function enables the FlexIO UART interrupt.
0246  *
0247  * @param base Pointer to FLEXIO_I2S_Type structure
0248  * @param mask interrupt source
0249  */
0250 void FLEXIO_I2S_EnableInterrupts(FLEXIO_I2S_Type *base, uint32_t mask);
0251 
0252 /*!
0253  * @brief Disables the FlexIO I2S interrupt.
0254  *
0255  * This function enables the FlexIO UART interrupt.
0256  *
0257  * @param base pointer to FLEXIO_I2S_Type structure
0258  * @param mask interrupt source
0259  */
0260 void FLEXIO_I2S_DisableInterrupts(FLEXIO_I2S_Type *base, uint32_t mask);
0261 
0262 /*! @} */
0263 
0264 /*!
0265  * @name DMA Control
0266  * @{
0267  */
0268 
0269 /*!
0270  * @brief Enables/disables the FlexIO I2S Tx DMA requests.
0271  *
0272  * @param base FlexIO I2S base pointer
0273  * @param enable True means enable DMA, false means disable DMA.
0274  */
0275 static inline void FLEXIO_I2S_TxEnableDMA(FLEXIO_I2S_Type *base, bool enable)
0276 {
0277     FLEXIO_EnableShifterStatusDMA(base->flexioBase, 1UL << base->txShifterIndex, enable);
0278 }
0279 
0280 /*!
0281  * @brief Enables/disables the FlexIO I2S Rx DMA requests.
0282  *
0283  * @param base FlexIO I2S base pointer
0284  * @param enable True means enable DMA, false means disable DMA.
0285  */
0286 static inline void FLEXIO_I2S_RxEnableDMA(FLEXIO_I2S_Type *base, bool enable)
0287 {
0288     FLEXIO_EnableShifterStatusDMA(base->flexioBase, 1UL << base->rxShifterIndex, enable);
0289 }
0290 
0291 /*!
0292  * @brief Gets the FlexIO I2S send data register address.
0293  *
0294  * This function returns the I2S data register address, mainly used by DMA/eDMA.
0295  *
0296  * @param base Pointer to FLEXIO_I2S_Type structure
0297  * @return FlexIO i2s send data register address.
0298  */
0299 static inline uint32_t FLEXIO_I2S_TxGetDataRegisterAddress(FLEXIO_I2S_Type *base)
0300 {
0301     return FLEXIO_GetShifterBufferAddress(base->flexioBase, kFLEXIO_ShifterBufferBitSwapped, base->txShifterIndex);
0302 }
0303 
0304 /*!
0305  * @brief Gets the FlexIO I2S receive data register address.
0306  *
0307  * This function returns the I2S data register address, mainly used by DMA/eDMA.
0308  *
0309  * @param base Pointer to FLEXIO_I2S_Type structure
0310  * @return FlexIO i2s receive data register address.
0311  */
0312 static inline uint32_t FLEXIO_I2S_RxGetDataRegisterAddress(FLEXIO_I2S_Type *base)
0313 {
0314     return FLEXIO_GetShifterBufferAddress(base->flexioBase, kFLEXIO_ShifterBufferBitSwapped, base->rxShifterIndex);
0315 }
0316 
0317 /*! @} */
0318 
0319 /*!
0320  * @name Bus Operations
0321  * @{
0322  */
0323 
0324 /*!
0325  * @brief Configures the FlexIO I2S audio format in master mode.
0326  *
0327  * Audio format can be changed in run-time of FlexIO I2S. This function configures the sample rate and audio data
0328  * format to be transferred.
0329  *
0330  * @param base Pointer to FLEXIO_I2S_Type structure
0331  * @param format Pointer to FlexIO I2S audio data format structure.
0332  * @param srcClock_Hz I2S master clock source frequency in Hz.
0333  */
0334 void FLEXIO_I2S_MasterSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_format_t *format, uint32_t srcClock_Hz);
0335 
0336 /*!
0337  * @brief Configures the FlexIO I2S audio format in slave mode.
0338  *
0339  * Audio format can be changed in run-time of FlexIO I2S. This function configures the sample rate and audio data
0340  * format to be transferred.
0341  *
0342  * @param base Pointer to FLEXIO_I2S_Type structure
0343  * @param format Pointer to FlexIO I2S audio data format structure.
0344  */
0345 void FLEXIO_I2S_SlaveSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_format_t *format);
0346 
0347 /*!
0348  * @brief Sends data using a blocking method.
0349  *
0350  * @note This function blocks via polling until data is ready to be sent.
0351  *
0352  * @param base FlexIO I2S base pointer.
0353  * @param bitWidth How many bits in a audio word, usually 8/16/24/32 bits.
0354  * @param txData Pointer to the data to be written.
0355  * @param size Bytes to be written.
0356  * @retval kStatus_Success Successfully write data.
0357  * @retval kStatus_FLEXIO_I2C_Timeout Timeout polling status flags.
0358  */
0359 status_t FLEXIO_I2S_WriteBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *txData, size_t size);
0360 
0361 /*!
0362  * @brief Writes data into a data register.
0363  *
0364  * @param base FlexIO I2S base pointer.
0365  * @param bitWidth How many bits in a audio word, usually 8/16/24/32 bits.
0366  * @param data Data to be written.
0367  */
0368 static inline void FLEXIO_I2S_WriteData(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint32_t data)
0369 {
0370     base->flexioBase->SHIFTBUFBIS[base->txShifterIndex] = (data << (32U - bitWidth));
0371 }
0372 
0373 /*!
0374  * @brief Receives a piece of data using a blocking method.
0375  *
0376  * @note This function blocks via polling until data is ready to be sent.
0377  *
0378  * @param base FlexIO I2S base pointer
0379  * @param bitWidth How many bits in a audio word, usually 8/16/24/32 bits.
0380  * @param rxData Pointer to the data to be read.
0381  * @param size Bytes to be read.
0382  * @retval kStatus_Success Successfully read data.
0383  * @retval kStatus_FLEXIO_I2C_Timeout Timeout polling status flags.
0384  */
0385 status_t FLEXIO_I2S_ReadBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *rxData, size_t size);
0386 
0387 /*!
0388  * @brief Reads a data from the data register.
0389  *
0390  * @param base FlexIO I2S base pointer
0391  * @return Data read from data register.
0392  */
0393 static inline uint32_t FLEXIO_I2S_ReadData(FLEXIO_I2S_Type *base)
0394 {
0395     return base->flexioBase->SHIFTBUFBIS[base->rxShifterIndex];
0396 }
0397 
0398 /*! @} */
0399 
0400 /*!
0401  * @name Transactional
0402  * @{
0403  */
0404 
0405 /*!
0406  * @brief Initializes the FlexIO I2S handle.
0407  *
0408  * This function initializes the FlexIO I2S handle which can be used for other
0409  * FlexIO I2S transactional APIs. Call this API once to get the
0410  * initialized handle.
0411  *
0412  * @param base Pointer to FLEXIO_I2S_Type structure
0413  * @param handle Pointer to flexio_i2s_handle_t structure to store the transfer state.
0414  * @param callback FlexIO I2S callback function, which is called while finished a block.
0415  * @param userData User parameter for the FlexIO I2S callback.
0416  */
0417 void FLEXIO_I2S_TransferTxCreateHandle(FLEXIO_I2S_Type *base,
0418                                        flexio_i2s_handle_t *handle,
0419                                        flexio_i2s_callback_t callback,
0420                                        void *userData);
0421 
0422 /*!
0423  * @brief Configures the FlexIO I2S audio format.
0424  *
0425  * Audio format can be changed at run-time of FlexIO I2S. This function configures the sample rate and audio data
0426  * format to be transferred.
0427  *
0428  * @param base Pointer to FLEXIO_I2S_Type structure.
0429  * @param handle FlexIO I2S handle pointer.
0430  * @param format Pointer to audio data format structure.
0431  * @param srcClock_Hz FlexIO I2S bit clock source frequency in Hz. This parameter should be 0 while in slave mode.
0432  */
0433 void FLEXIO_I2S_TransferSetFormat(FLEXIO_I2S_Type *base,
0434                                   flexio_i2s_handle_t *handle,
0435                                   flexio_i2s_format_t *format,
0436                                   uint32_t srcClock_Hz);
0437 
0438 /*!
0439  * @brief Initializes the FlexIO I2S receive handle.
0440  *
0441  * This function initializes the FlexIO I2S handle which can be used for other
0442  * FlexIO I2S transactional APIs. Call this API once to get the
0443  * initialized handle.
0444  *
0445  * @param base Pointer to FLEXIO_I2S_Type structure.
0446  * @param handle Pointer to flexio_i2s_handle_t structure to store the transfer state.
0447  * @param callback FlexIO I2S callback function, which is called while finished a block.
0448  * @param userData User parameter for the FlexIO I2S callback.
0449  */
0450 void FLEXIO_I2S_TransferRxCreateHandle(FLEXIO_I2S_Type *base,
0451                                        flexio_i2s_handle_t *handle,
0452                                        flexio_i2s_callback_t callback,
0453                                        void *userData);
0454 
0455 /*!
0456  * @brief Performs an interrupt non-blocking send transfer on FlexIO I2S.
0457  *
0458  * @note The API returns immediately after transfer initiates.
0459  * Call FLEXIO_I2S_GetRemainingBytes to poll the transfer status and check whether
0460  * the transfer is finished. If the return status is 0, the transfer is finished.
0461  *
0462  * @param base Pointer to FLEXIO_I2S_Type structure.
0463  * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state
0464  * @param xfer Pointer to flexio_i2s_transfer_t structure
0465  * @retval kStatus_Success Successfully start the data transmission.
0466  * @retval kStatus_FLEXIO_I2S_TxBusy Previous transmission still not finished, data not all written to TX register yet.
0467  * @retval kStatus_InvalidArgument The input parameter is invalid.
0468  */
0469 status_t FLEXIO_I2S_TransferSendNonBlocking(FLEXIO_I2S_Type *base,
0470                                             flexio_i2s_handle_t *handle,
0471                                             flexio_i2s_transfer_t *xfer);
0472 
0473 /*!
0474  * @brief Performs an interrupt non-blocking receive transfer on FlexIO I2S.
0475  *
0476  * @note The API returns immediately after transfer initiates.
0477  * Call FLEXIO_I2S_GetRemainingBytes to poll the transfer status to check whether
0478  * the transfer is finished. If the return status is 0, the transfer is finished.
0479  *
0480  * @param base Pointer to FLEXIO_I2S_Type structure.
0481  * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state
0482  * @param xfer Pointer to flexio_i2s_transfer_t structure
0483  * @retval kStatus_Success Successfully start the data receive.
0484  * @retval kStatus_FLEXIO_I2S_RxBusy Previous receive still not finished.
0485  * @retval kStatus_InvalidArgument The input parameter is invalid.
0486  */
0487 status_t FLEXIO_I2S_TransferReceiveNonBlocking(FLEXIO_I2S_Type *base,
0488                                                flexio_i2s_handle_t *handle,
0489                                                flexio_i2s_transfer_t *xfer);
0490 
0491 /*!
0492  * @brief Aborts the current send.
0493  *
0494  * @note This API can be called at any time when interrupt non-blocking transfer initiates
0495  * to abort the transfer in a early time.
0496  *
0497  * @param base Pointer to FLEXIO_I2S_Type structure.
0498  * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state
0499  */
0500 void FLEXIO_I2S_TransferAbortSend(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle);
0501 
0502 /*!
0503  * @brief Aborts the current receive.
0504  *
0505  * @note This API can be called at any time when interrupt non-blocking transfer initiates
0506  * to abort the transfer in a early time.
0507  *
0508  * @param base Pointer to FLEXIO_I2S_Type structure.
0509  * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state
0510  */
0511 void FLEXIO_I2S_TransferAbortReceive(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle);
0512 
0513 /*!
0514  * @brief Gets the remaining bytes to be sent.
0515  *
0516  * @param base Pointer to FLEXIO_I2S_Type structure.
0517  * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state
0518  * @param count Bytes sent.
0519  * @retval kStatus_Success Succeed get the transfer count.
0520  * @retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress.
0521  */
0522 status_t FLEXIO_I2S_TransferGetSendCount(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, size_t *count);
0523 
0524 /*!
0525  * @brief Gets the remaining bytes to be received.
0526  *
0527  * @param base Pointer to FLEXIO_I2S_Type structure.
0528  * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state
0529  * @param count Bytes recieved.
0530  * @return count Bytes received.
0531  * @retval kStatus_Success Succeed get the transfer count.
0532  * @retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress.
0533  */
0534 status_t FLEXIO_I2S_TransferGetReceiveCount(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, size_t *count);
0535 
0536 /*!
0537  * @brief Tx interrupt handler.
0538  *
0539  * @param i2sBase Pointer to FLEXIO_I2S_Type structure.
0540  * @param i2sHandle Pointer to flexio_i2s_handle_t structure
0541  */
0542 void FLEXIO_I2S_TransferTxHandleIRQ(void *i2sBase, void *i2sHandle);
0543 
0544 /*!
0545  * @brief Rx interrupt handler.
0546  *
0547  * @param i2sBase Pointer to FLEXIO_I2S_Type structure.
0548  * @param i2sHandle Pointer to flexio_i2s_handle_t structure.
0549  */
0550 void FLEXIO_I2S_TransferRxHandleIRQ(void *i2sBase, void *i2sHandle);
0551 
0552 /*! @} */
0553 
0554 #if defined(__cplusplus)
0555 }
0556 #endif /*_cplusplus*/
0557 
0558 /*! @} */
0559 
0560 #endif /* _FSL_FLEXIO_I2S_H_ */