8#ifndef _FSL_FLEXIO_I2S_H_
9#define _FSL_FLEXIO_I2S_H_
11#include "fsl_common.h"
12#include "fsl_flexio.h"
26#define FSL_FLEXIO_I2S_DRIVER_VERSION (MAKE_VERSION(2, 2, 0))
30#ifndef I2S_RETRY_TIMES
31#define I2S_RETRY_TIMES 0U
102#define FLEXIO_I2S_XFER_QUEUE_SIZE (4U)
160#if defined(__cplusplus)
212static inline void FLEXIO_I2S_Enable(
FLEXIO_I2S_Type *base,
bool enable)
216 base->flexioBase->CTRL |= FLEXIO_CTRL_FLEXEN_MASK;
275static inline void FLEXIO_I2S_TxEnableDMA(
FLEXIO_I2S_Type *base,
bool enable)
277 FLEXIO_EnableShifterStatusDMA(base->flexioBase, 1UL << base->txShifterIndex, enable);
286static inline void FLEXIO_I2S_RxEnableDMA(
FLEXIO_I2S_Type *base,
bool enable)
288 FLEXIO_EnableShifterStatusDMA(base->flexioBase, 1UL << base->rxShifterIndex, enable);
299static inline uint32_t FLEXIO_I2S_TxGetDataRegisterAddress(
FLEXIO_I2S_Type *base)
312static inline uint32_t FLEXIO_I2S_RxGetDataRegisterAddress(
FLEXIO_I2S_Type *base)
368static inline void FLEXIO_I2S_WriteData(
FLEXIO_I2S_Type *base, uint8_t bitWidth, uint32_t data)
370 base->flexioBase->SHIFTBUFBIS[base->txShifterIndex] = (data << (32U - bitWidth));
395 return base->flexioBase->SHIFTBUFBIS[base->rxShifterIndex];
436 uint32_t srcClock_Hz);
554#if defined(__cplusplus)
enum _flexio_pin_polarity flexio_pin_polarity_t
Definition of pin polarity.
enum _flexio_shifter_timer_polarity flexio_shifter_timer_polarity_t
Define type of timer polarity for shifter control.
uint32_t FLEXIO_GetShifterBufferAddress(FLEXIO_Type *base, flexio_shifter_buffer_type_t type, uint8_t index)
Gets the shifter buffer address for the DMA transfer usage.
Definition: fsl_flexio.c:173
@ kFLEXIO_ShifterBufferBitSwapped
Definition: fsl_flexio.h:224
struct _flexio_i2s_config flexio_i2s_config_t
FlexIO I2S configure structure.
struct _flexio_i2s_transfer flexio_i2s_transfer_t
Define FlexIO I2S transfer structure.
void FLEXIO_I2S_EnableInterrupts(FLEXIO_I2S_Type *base, uint32_t mask)
Enables the FlexIO I2S interrupt.
Definition: fsl_flexio_i2s.c:302
void FLEXIO_I2S_MasterSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_format_t *format, uint32_t srcClock_Hz)
Configures the FlexIO I2S audio format in master mode.
Definition: fsl_flexio_i2s.c:360
#define FLEXIO_I2S_XFER_QUEUE_SIZE
FlexIO I2S transfer queue size, user can refine it according to use case.
Definition: fsl_flexio_i2s.h:102
status_t FLEXIO_I2S_TransferSendNonBlocking(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_transfer_t *xfer)
Performs an interrupt non-blocking send transfer on FlexIO I2S.
Definition: fsl_flexio_i2s.c:626
void FLEXIO_I2S_Init(FLEXIO_I2S_Type *base, const flexio_i2s_config_t *config)
Initializes the FlexIO I2S.
Definition: fsl_flexio_i2s.c:115
_flexio_i2s_master_slave
Master or slave mode.
Definition: fsl_flexio_i2s.h:62
void FLEXIO_I2S_TransferTxCreateHandle(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_callback_t callback, void *userData)
Initializes the FlexIO I2S handle.
Definition: fsl_flexio_i2s.c:515
void FLEXIO_I2S_SlaveSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_format_t *format)
Configures the FlexIO I2S audio format in slave mode.
Definition: fsl_flexio_i2s.c:387
void FLEXIO_I2S_TransferRxCreateHandle(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_callback_t callback, void *userData)
Initializes the FlexIO I2S receive handle.
Definition: fsl_flexio_i2s.c:553
void FLEXIO_I2S_Deinit(FLEXIO_I2S_Type *base)
De-initializes the FlexIO I2S.
Definition: fsl_flexio_i2s.c:280
void FLEXIO_I2S_TransferAbortSend(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle)
Aborts the current send.
Definition: fsl_flexio_i2s.c:717
status_t FLEXIO_I2S_TransferReceiveNonBlocking(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_transfer_t *xfer)
Performs an interrupt non-blocking receive transfer on FlexIO I2S.
Definition: fsl_flexio_i2s.c:673
enum _flexio_i2s_word_width flexio_i2s_word_width_t
Audio word width.
enum _flexio_i2s_sample_rate flexio_i2s_sample_rate_t
Audio sample rate.
status_t FLEXIO_I2S_TransferGetSendCount(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, size_t *count)
Gets the remaining bytes to be sent.
Definition: fsl_flexio_i2s.c:763
_flexio_i2s_sample_rate
Audio sample rate.
Definition: fsl_flexio_i2s.h:106
void(* flexio_i2s_callback_t)(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, status_t status, void *userData)
FlexIO I2S xfer callback prototype.
Definition: fsl_flexio_i2s.h:138
struct _flexio_i2s_type FLEXIO_I2S_Type
Define FlexIO I2S access structure typedef.
void FLEXIO_I2S_GetDefaultConfig(flexio_i2s_config_t *config)
Sets the FlexIO I2S configuration structure to default values.
Definition: fsl_flexio_i2s.c:257
uint32_t FLEXIO_I2S_GetStatusFlags(FLEXIO_I2S_Type *base)
Gets the FlexIO I2S status flags.
Definition: fsl_flexio_i2s.c:320
void FLEXIO_I2S_TransferSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_format_t *format, uint32_t srcClock_Hz)
Configures the FlexIO I2S audio format.
Definition: fsl_flexio_i2s.c:590
struct _flexio_i2s_format flexio_i2s_format_t
FlexIO I2S audio format, FlexIO I2S only support the same format in Tx and Rx.
void FLEXIO_I2S_TransferAbortReceive(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle)
Aborts the current receive.
Definition: fsl_flexio_i2s.c:740
status_t FLEXIO_I2S_TransferGetReceiveCount(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, size_t *count)
Gets the remaining bytes to be received.
Definition: fsl_flexio_i2s.c:791
void FLEXIO_I2S_TransferTxHandleIRQ(void *i2sBase, void *i2sHandle)
Tx interrupt handler.
Definition: fsl_flexio_i2s.c:816
status_t FLEXIO_I2S_ReadBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *rxData, size_t size)
Receives a piece of data using a blocking method.
Definition: fsl_flexio_i2s.c:470
void FLEXIO_I2S_DisableInterrupts(FLEXIO_I2S_Type *base, uint32_t mask)
Disables the FlexIO I2S interrupt.
Definition: fsl_flexio_i2s.c:338
void FLEXIO_I2S_TransferRxHandleIRQ(void *i2sBase, void *i2sHandle)
Rx interrupt handler.
Definition: fsl_flexio_i2s.c:866
_flexio_i2s_word_width
Audio word width.
Definition: fsl_flexio_i2s.h:121
status_t FLEXIO_I2S_WriteBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *txData, size_t size)
Sends data using a blocking method.
Definition: fsl_flexio_i2s.c:408
enum _flexio_i2s_master_slave flexio_i2s_master_slave_t
Master or slave mode.
@ kFLEXIO_I2S_TxDataRegEmptyInterruptEnable
Definition: fsl_flexio_i2s.h:70
@ kFLEXIO_I2S_RxDataRegFullInterruptEnable
Definition: fsl_flexio_i2s.h:71
@ kFLEXIO_I2S_Master
Definition: fsl_flexio_i2s.h:63
@ kFLEXIO_I2S_Slave
Definition: fsl_flexio_i2s.h:64
@ kFLEXIO_I2S_SampleRate32KHz
Definition: fsl_flexio_i2s.h:113
@ kFLEXIO_I2S_SampleRate22050Hz
Definition: fsl_flexio_i2s.h:111
@ kFLEXIO_I2S_SampleRate12KHz
Definition: fsl_flexio_i2s.h:109
@ kFLEXIO_I2S_SampleRate24KHz
Definition: fsl_flexio_i2s.h:112
@ kFLEXIO_I2S_SampleRate16KHz
Definition: fsl_flexio_i2s.h:110
@ kFLEXIO_I2S_SampleRate96KHz
Definition: fsl_flexio_i2s.h:116
@ kFLEXIO_I2S_SampleRate11025Hz
Definition: fsl_flexio_i2s.h:108
@ kFLEXIO_I2S_SampleRate48KHz
Definition: fsl_flexio_i2s.h:115
@ kFLEXIO_I2S_SampleRate44100Hz
Definition: fsl_flexio_i2s.h:114
@ kFLEXIO_I2S_SampleRate8KHz
Definition: fsl_flexio_i2s.h:107
@ kStatus_FLEXIO_I2S_Timeout
Definition: fsl_flexio_i2s.h:42
@ kStatus_FLEXIO_I2S_TxBusy
Definition: fsl_flexio_i2s.h:38
@ kStatus_FLEXIO_I2S_Error
Definition: fsl_flexio_i2s.h:40
@ kStatus_FLEXIO_I2S_Idle
Definition: fsl_flexio_i2s.h:37
@ kStatus_FLEXIO_I2S_QueueFull
Definition: fsl_flexio_i2s.h:41
@ kStatus_FLEXIO_I2S_RxBusy
Definition: fsl_flexio_i2s.h:39
@ kFLEXIO_I2S_WordWidth16bits
Definition: fsl_flexio_i2s.h:123
@ kFLEXIO_I2S_WordWidth8bits
Definition: fsl_flexio_i2s.h:122
@ kFLEXIO_I2S_WordWidth32bits
Definition: fsl_flexio_i2s.h:125
@ kFLEXIO_I2S_WordWidth24bits
Definition: fsl_flexio_i2s.h:124
@ kFLEXIO_I2S_TxDataRegEmptyFlag
Definition: fsl_flexio_i2s.h:77
@ kFLEXIO_I2S_RxDataRegFullFlag
Definition: fsl_flexio_i2s.h:78
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:225
#define MAKE_STATUS(group, code)
Construct a status code value from a group and code number.
Definition: fsl_common.h:47
@ kStatusGroup_FLEXIO_I2S
Definition: fsl_common.h:106
Definition: MIMXRT1052.h:20511
FlexIO I2S configure structure.
Definition: fsl_flexio_i2s.h:83
flexio_shifter_timer_polarity_t txTimerPolarity
Definition: fsl_flexio_i2s.h:90
flexio_shifter_timer_polarity_t rxTimerPolarity
Definition: fsl_flexio_i2s.h:91
flexio_pin_polarity_t rxPinPolarity
Definition: fsl_flexio_i2s.h:87
flexio_pin_polarity_t txPinPolarity
Definition: fsl_flexio_i2s.h:86
flexio_pin_polarity_t bclkPinPolarity
Definition: fsl_flexio_i2s.h:88
bool enableI2S
Definition: fsl_flexio_i2s.h:84
flexio_i2s_master_slave_t masterSlave
Definition: fsl_flexio_i2s.h:85
flexio_pin_polarity_t fsPinPolarity
Definition: fsl_flexio_i2s.h:89
Define FlexIO I2S handle structure.
Definition: fsl_flexio_i2s.h:145
flexio_i2s_callback_t callback
Definition: fsl_flexio_i2s.h:147
volatile uint8_t queueUser
Definition: fsl_flexio_i2s.h:152
void * userData
Definition: fsl_flexio_i2s.h:148
flexio_i2s_transfer_t queue[FLEXIO_I2S_XFER_QUEUE_SIZE]
Definition: fsl_flexio_i2s.h:150
volatile uint8_t queueDriver
Definition: fsl_flexio_i2s.h:153
size_t transferSize[FLEXIO_I2S_XFER_QUEUE_SIZE]
Definition: fsl_flexio_i2s.h:151
uint8_t bitWidth
Definition: fsl_flexio_i2s.h:149
uint32_t state
Definition: fsl_flexio_i2s.h:146
Define FlexIO I2S transfer structure.
Definition: fsl_flexio_i2s.h:130
uint8_t * data
Definition: fsl_flexio_i2s.h:131
size_t dataSize
Definition: fsl_flexio_i2s.h:132
Define FlexIO I2S access structure typedef.
Definition: fsl_flexio_i2s.h:48
uint8_t fsPinIndex
Definition: fsl_flexio_i2s.h:53
uint8_t rxShifterIndex
Definition: fsl_flexio_i2s.h:55
uint8_t rxPinIndex
Definition: fsl_flexio_i2s.h:51
uint8_t txShifterIndex
Definition: fsl_flexio_i2s.h:54
uint8_t txPinIndex
Definition: fsl_flexio_i2s.h:50
uint8_t bclkPinIndex
Definition: fsl_flexio_i2s.h:52
FLEXIO_Type * flexioBase
Definition: fsl_flexio_i2s.h:49
uint8_t fsTimerIndex
Definition: fsl_flexio_i2s.h:57
uint8_t bclkTimerIndex
Definition: fsl_flexio_i2s.h:56
Definition: deflate.c:114