Classes
fsl_sai.h File Reference
#include "fsl_common.h"
Include dependency graph for fsl_sai.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _sai_bit_clock
 sai bit clock configurations More...
 
struct  _sai_config
 SAI user configuration structure. More...
 
struct  _sai_frame_sync
 sai frame sync configurations More...
 
struct  _sai_handle
 SAI handle structure. More...
 
struct  _sai_serial_data
 sai serial data configurations More...
 
struct  _sai_transceiver
 sai transceiver configurations More...
 
struct  _sai_transfer
 SAI transfer structure. More...
 
struct  _sai_transfer_format
 sai transfer format More...
 

Functions

Initialization and deinitialization
void SAI_Deinit (I2S_Type *base)
 De-initializes the SAI peripheral. More...
 
void SAI_GetClassicI2SConfig (sai_transceiver_t *config, sai_word_width_t bitWidth, sai_mono_stereo_t mode, uint32_t saiChannelMask)
 Get classic I2S mode configurations. More...
 
void SAI_GetDSPConfig (sai_transceiver_t *config, sai_frame_sync_len_t frameSyncWidth, sai_word_width_t bitWidth, sai_mono_stereo_t mode, uint32_t saiChannelMask)
 Get DSP mode configurations. More...
 
void SAI_GetLeftJustifiedConfig (sai_transceiver_t *config, sai_word_width_t bitWidth, sai_mono_stereo_t mode, uint32_t saiChannelMask)
 Get left justified mode configurations. More...
 
void SAI_GetRightJustifiedConfig (sai_transceiver_t *config, sai_word_width_t bitWidth, sai_mono_stereo_t mode, uint32_t saiChannelMask)
 Get right justified mode configurations. More...
 
void SAI_GetTDMConfig (sai_transceiver_t *config, sai_frame_sync_len_t frameSyncWidth, sai_word_width_t bitWidth, uint32_t dataWordNum, uint32_t saiChannelMask)
 Get TDM mode configurations. More...
 
void SAI_Init (I2S_Type *base)
 Initializes the SAI peripheral. More...
 
void SAI_RxEnable (I2S_Type *base, bool enable)
 Enables/disables the SAI Rx. More...
 
void SAI_RxGetDefaultConfig (sai_config_t *config)
 Sets the SAI Rx configuration structure to default values. More...
 
void SAI_RxInit (I2S_Type *base, const sai_config_t *config)
 Initializes the SAI Rx peripheral. More...
 
void SAI_RxReset (I2S_Type *base)
 Resets the SAI Rx. More...
 
void SAI_RxSetBitclockConfig (I2S_Type *base, sai_master_slave_t masterSlave, sai_bit_clock_t *config)
 Receiver Bit clock configurations. More...
 
static void SAI_RxSetBitClockDirection (I2S_Type *base, sai_master_slave_t masterSlave)
 Set Rx bit clock direction. More...
 
void SAI_RxSetBitClockRate (I2S_Type *base, uint32_t sourceClockHz, uint32_t sampleRate, uint32_t bitWidth, uint32_t channelNumbers)
 Receiver bit clock rate configurations. More...
 
void SAI_RxSetConfig (I2S_Type *base, sai_transceiver_t *config)
 SAI receiver configurations. More...
 
void SAI_RxSetFrameSyncConfig (I2S_Type *base, sai_master_slave_t masterSlave, sai_frame_sync_t *config)
 SAI receiver Frame sync configurations. More...
 
static void SAI_RxSetFrameSyncDirection (I2S_Type *base, sai_master_slave_t masterSlave)
 Set Rx frame sync direction. More...
 
void SAI_RxSetSerialDataConfig (I2S_Type *base, sai_serial_data_t *config)
 SAI receiver Serial data configurations. More...
 
void SAI_TxEnable (I2S_Type *base, bool enable)
 Enables/disables the SAI Tx. More...
 
void SAI_TxGetDefaultConfig (sai_config_t *config)
 Sets the SAI Tx configuration structure to default values. More...
 
void SAI_TxInit (I2S_Type *base, const sai_config_t *config)
 Initializes the SAI Tx peripheral. More...
 
void SAI_TxReset (I2S_Type *base)
 Resets the SAI Tx. More...
 
void SAI_TxSetBitclockConfig (I2S_Type *base, sai_master_slave_t masterSlave, sai_bit_clock_t *config)
 Transmitter Bit clock configurations. More...
 
static void SAI_TxSetBitClockDirection (I2S_Type *base, sai_master_slave_t masterSlave)
 Set Rx bit clock direction. More...
 
void SAI_TxSetBitClockRate (I2S_Type *base, uint32_t sourceClockHz, uint32_t sampleRate, uint32_t bitWidth, uint32_t channelNumbers)
 Transmitter bit clock rate configurations. More...
 
void SAI_TxSetConfig (I2S_Type *base, sai_transceiver_t *config)
 SAI transmitter configurations. More...
 
void SAI_TxSetFrameSyncConfig (I2S_Type *base, sai_master_slave_t masterSlave, sai_frame_sync_t *config)
 SAI transmitter Frame sync configurations. More...
 
static void SAI_TxSetFrameSyncDirection (I2S_Type *base, sai_master_slave_t masterSlave)
 Set Tx frame sync direction. More...
 
void SAI_TxSetSerialDataConfig (I2S_Type *base, sai_serial_data_t *config)
 SAI transmitter Serial data configurations. More...
 
Status
static void SAI_RxClearStatusFlags (I2S_Type *base, uint32_t mask)
 Clears the SAI Rx status flag state. More...
 
static uint32_t SAI_RxGetStatusFlag (I2S_Type *base)
 Gets the SAI Tx status flag state. More...
 
void SAI_RxSetBitClockPolarity (I2S_Type *base, sai_clock_polarity_t polarity)
 Set the Rx data order. More...
 
void SAI_RxSetChannelFIFOMask (I2S_Type *base, uint8_t mask)
 Set the Rx channel FIFO enable mask. More...
 
void SAI_RxSetDataOrder (I2S_Type *base, sai_data_order_t order)
 Set the Rx data order. More...
 
void SAI_RxSetFrameSyncPolarity (I2S_Type *base, sai_clock_polarity_t polarity)
 Set the Rx data order. More...
 
void SAI_RxSoftwareReset (I2S_Type *base, sai_reset_type_t type)
 Do software reset or FIFO reset . More...
 
static void SAI_TxClearStatusFlags (I2S_Type *base, uint32_t mask)
 Clears the SAI Tx status flag state. More...
 
static uint32_t SAI_TxGetStatusFlag (I2S_Type *base)
 Gets the SAI Tx status flag state. More...
 
void SAI_TxSetBitClockPolarity (I2S_Type *base, sai_clock_polarity_t polarity)
 Set the Tx data order. More...
 
void SAI_TxSetChannelFIFOMask (I2S_Type *base, uint8_t mask)
 Set the Tx channel FIFO enable mask. More...
 
void SAI_TxSetDataOrder (I2S_Type *base, sai_data_order_t order)
 Set the Tx data order. More...
 
void SAI_TxSetFrameSyncPolarity (I2S_Type *base, sai_clock_polarity_t polarity)
 Set the Tx data order. More...
 
void SAI_TxSoftwareReset (I2S_Type *base, sai_reset_type_t type)
 Do software reset or FIFO reset . More...
 
Interrupts
static void SAI_RxDisableInterrupts (I2S_Type *base, uint32_t mask)
 Disables the SAI Rx interrupt requests. More...
 
static void SAI_RxEnableInterrupts (I2S_Type *base, uint32_t mask)
 Enables the SAI Rx interrupt requests. More...
 
static void SAI_TxDisableInterrupts (I2S_Type *base, uint32_t mask)
 Disables the SAI Tx interrupt requests. More...
 
static void SAI_TxEnableInterrupts (I2S_Type *base, uint32_t mask)
 Enables the SAI Tx interrupt requests. More...
 
DMA Control
static void SAI_RxEnableDMA (I2S_Type *base, uint32_t mask, bool enable)
 Enables/disables the SAI Rx DMA requests. More...
 
static uint32_t SAI_RxGetDataRegisterAddress (I2S_Type *base, uint32_t channel)
 Gets the SAI Rx data register address. More...
 
static void SAI_TxEnableDMA (I2S_Type *base, uint32_t mask, bool enable)
 Enables/disables the SAI Tx DMA requests. More...
 
static uint32_t SAI_TxGetDataRegisterAddress (I2S_Type *base, uint32_t channel)
 Gets the SAI Tx data register address. More...
 
Bus Operations
void SAI_ReadBlocking (I2S_Type *base, uint32_t channel, uint32_t bitWidth, uint8_t *buffer, uint32_t size)
 Receives data using a blocking method. More...
 
static uint32_t SAI_ReadData (I2S_Type *base, uint32_t channel)
 Reads data from the SAI FIFO. More...
 
void SAI_ReadMultiChannelBlocking (I2S_Type *base, uint32_t channel, uint32_t channelMask, uint32_t bitWidth, uint8_t *buffer, uint32_t size)
 Receives multi channel data using a blocking method. More...
 
void SAI_RxSetFormat (I2S_Type *base, sai_transfer_format_t *format, uint32_t mclkSourceClockHz, uint32_t bclkSourceClockHz)
 Configures the SAI Rx audio format. More...
 
void SAI_TxSetFormat (I2S_Type *base, sai_transfer_format_t *format, uint32_t mclkSourceClockHz, uint32_t bclkSourceClockHz)
 Configures the SAI Tx audio format. More...
 
void SAI_WriteBlocking (I2S_Type *base, uint32_t channel, uint32_t bitWidth, uint8_t *buffer, uint32_t size)
 Sends data using a blocking method. More...
 
static void SAI_WriteData (I2S_Type *base, uint32_t channel, uint32_t data)
 Writes data into SAI FIFO. More...
 
void SAI_WriteMultiChannelBlocking (I2S_Type *base, uint32_t channel, uint32_t channelMask, uint32_t bitWidth, uint8_t *buffer, uint32_t size)
 Sends data to multi channel using a blocking method. More...
 
Transactional
void SAI_TransferAbortReceive (I2S_Type *base, sai_handle_t *handle)
 Aborts the current IRQ receive. More...
 
void SAI_TransferAbortSend (I2S_Type *base, sai_handle_t *handle)
 Aborts the current send. More...
 
status_t SAI_TransferGetReceiveCount (I2S_Type *base, sai_handle_t *handle, size_t *count)
 Gets a received byte count. More...
 
status_t SAI_TransferGetSendCount (I2S_Type *base, sai_handle_t *handle, size_t *count)
 Gets a set byte count. More...
 
status_t SAI_TransferReceiveNonBlocking (I2S_Type *base, sai_handle_t *handle, sai_transfer_t *xfer)
 Performs an interrupt non-blocking receive transfer on SAI. More...
 
void SAI_TransferRxCreateHandle (I2S_Type *base, sai_handle_t *handle, sai_transfer_callback_t callback, void *userData)
 Initializes the SAI Rx handle. More...
 
void SAI_TransferRxHandleIRQ (I2S_Type *base, sai_handle_t *handle)
 Tx interrupt handler. More...
 
void SAI_TransferRxSetConfig (I2S_Type *base, sai_handle_t *handle, sai_transceiver_t *config)
 SAI receiver transfer configurations. More...
 
status_t SAI_TransferRxSetFormat (I2S_Type *base, sai_handle_t *handle, sai_transfer_format_t *format, uint32_t mclkSourceClockHz, uint32_t bclkSourceClockHz)
 Configures the SAI Rx audio format. More...
 
status_t SAI_TransferSendNonBlocking (I2S_Type *base, sai_handle_t *handle, sai_transfer_t *xfer)
 Performs an interrupt non-blocking send transfer on SAI. More...
 
void SAI_TransferTerminateReceive (I2S_Type *base, sai_handle_t *handle)
 Terminate all SAI receive. More...
 
void SAI_TransferTerminateSend (I2S_Type *base, sai_handle_t *handle)
 Terminate all SAI send. More...
 
void SAI_TransferTxCreateHandle (I2S_Type *base, sai_handle_t *handle, sai_transfer_callback_t callback, void *userData)
 Initializes the SAI Tx handle. More...
 
void SAI_TransferTxHandleIRQ (I2S_Type *base, sai_handle_t *handle)
 Tx interrupt handler. More...
 
void SAI_TransferTxSetConfig (I2S_Type *base, sai_handle_t *handle, sai_transceiver_t *config)
 SAI transmitter transfer configurations. More...
 
status_t SAI_TransferTxSetFormat (I2S_Type *base, sai_handle_t *handle, sai_transfer_format_t *format, uint32_t mclkSourceClockHz, uint32_t bclkSourceClockHz)
 Configures the SAI Tx audio format. More...
 

Driver version

enum  {
  kStatus_SAI_TxBusy = MAKE_STATUS(kStatusGroup_SAI, 0), kStatus_SAI_RxBusy = MAKE_STATUS(kStatusGroup_SAI, 1), kStatus_SAI_TxError = MAKE_STATUS(kStatusGroup_SAI, 2), kStatus_SAI_RxError = MAKE_STATUS(kStatusGroup_SAI, 3),
  kStatus_SAI_QueueFull = MAKE_STATUS(kStatusGroup_SAI, 4), kStatus_SAI_TxIdle = MAKE_STATUS(kStatusGroup_SAI, 5), kStatus_SAI_RxIdle = MAKE_STATUS(kStatusGroup_SAI, 6)
}
 _sai_status_t, SAI return status. More...
 
enum  {
  kSAI_Channel0Mask = 1 << 0U, kSAI_Channel1Mask = 1 << 1U, kSAI_Channel2Mask = 1 << 2U, kSAI_Channel3Mask = 1 << 3U,
  kSAI_Channel4Mask = 1 << 4U, kSAI_Channel5Mask = 1 << 5U, kSAI_Channel6Mask = 1 << 6U, kSAI_Channel7Mask = 1 << 7U
}
 _sai_channel_mask,.sai channel mask value, actual channel numbers is depend soc specific More...
 
enum  { kSAI_WordStartInterruptEnable, kSAI_SyncErrorInterruptEnable = I2S_TCSR_SEIE_MASK, kSAI_FIFOWarningInterruptEnable = I2S_TCSR_FWIE_MASK, kSAI_FIFOErrorInterruptEnable = I2S_TCSR_FEIE_MASK }
 _sai_interrupt_enable_t, The SAI interrupt enable flag More...
 
enum  { kSAI_FIFOWarningDMAEnable = I2S_TCSR_FWDE_MASK }
 _sai_dma_enable_t, The DMA request sources More...
 
enum  { kSAI_WordStartFlag = I2S_TCSR_WSF_MASK, kSAI_SyncErrorFlag = I2S_TCSR_SEF_MASK, kSAI_FIFOErrorFlag = I2S_TCSR_FEF_MASK, kSAI_FIFOWarningFlag = I2S_TCSR_FWF_MASK }
 _sai_flags, The SAI status flag More...
 
enum  _sai_bclk_source {
  kSAI_BclkSourceBusclk = 0x0U, kSAI_BclkSourceMclkOption1 = 0x1U, kSAI_BclkSourceMclkOption2 = 0x2U, kSAI_BclkSourceMclkOption3 = 0x3U,
  kSAI_BclkSourceMclkDiv = 0x1U, kSAI_BclkSourceOtherSai0 = 0x2U, kSAI_BclkSourceOtherSai1 = 0x3U
}
 Bit clock source. More...
 
enum  _sai_clock_polarity { kSAI_PolarityActiveHigh = 0x0U, kSAI_PolarityActiveLow = 0x1U, kSAI_SampleOnFallingEdge = 0x0U, kSAI_SampleOnRisingEdge = 0x1U }
 SAI clock polarity, active high or low. More...
 
enum  _sai_data_order { kSAI_DataLSB = 0x0U, kSAI_DataMSB }
 SAI data order, MSB or LSB. More...
 
enum  _sai_frame_sync_len { kSAI_FrameSyncLenOneBitClk = 0U, kSAI_FrameSyncLenPerWordWidth = 1U }
 sai frame sync len More...
 
enum  _sai_master_slave { kSAI_Master = 0x0U, kSAI_Slave = 0x1U, kSAI_Bclk_Master_FrameSync_Slave = 0x2U, kSAI_Bclk_Slave_FrameSync_Master = 0x3U }
 Master or slave mode. More...
 
enum  _sai_mclk_source { kSAI_MclkSourceSysclk = 0x0U, kSAI_MclkSourceSelect1, kSAI_MclkSourceSelect2, kSAI_MclkSourceSelect3 }
 Mater clock source. More...
 
enum  _sai_mono_stereo { kSAI_Stereo = 0x0U, kSAI_MonoRight, kSAI_MonoLeft }
 Mono or stereo audio format. More...
 
enum  _sai_protocol {
  kSAI_BusLeftJustified = 0x0U, kSAI_BusRightJustified, kSAI_BusI2S, kSAI_BusPCMA,
  kSAI_BusPCMB
}
 Define the SAI bus type. More...
 
enum  _sai_reset_type { kSAI_ResetTypeSoftware = I2S_TCSR_SR_MASK, kSAI_ResetTypeFIFO = I2S_TCSR_FR_MASK, kSAI_ResetAll = I2S_TCSR_SR_MASK | I2S_TCSR_FR_MASK }
 The reset type. More...
 
enum  _sai_sample_rate {
  kSAI_SampleRate8KHz = 8000U, kSAI_SampleRate11025Hz = 11025U, kSAI_SampleRate12KHz = 12000U, kSAI_SampleRate16KHz = 16000U,
  kSAI_SampleRate22050Hz = 22050U, kSAI_SampleRate24KHz = 24000U, kSAI_SampleRate32KHz = 32000U, kSAI_SampleRate44100Hz = 44100U,
  kSAI_SampleRate48KHz = 48000U, kSAI_SampleRate96KHz = 96000U, kSAI_SampleRate192KHz = 192000U, kSAI_SampleRate384KHz = 384000U
}
 Audio sample rate. More...
 
enum  _sai_sync_mode { kSAI_ModeAsync = 0x0U, kSAI_ModeSync }
 Synchronous or asynchronous mode. More...
 
enum  _sai_transceiver_type { kSAI_Transmitter = 0U, kSAI_Receiver = 1U }
 sai transceiver type More...
 
enum  _sai_word_width { kSAI_WordWidth8bits = 8U, kSAI_WordWidth16bits = 16U, kSAI_WordWidth24bits = 24U, kSAI_WordWidth32bits = 32U }
 Audio word width. More...
 
#define FSL_SAI_DRIVER_VERSION   (MAKE_VERSION(2, 3, 1))
 
#define FSL_SAI_HAS_FIFO_EXTEND_FEATURE   0
 sai fifo feature More...
 
typedef enum _sai_bclk_source sai_bclk_source_t
 Bit clock source. More...
 
typedef struct _sai_bit_clock sai_bit_clock_t
 sai bit clock configurations More...
 
typedef enum _sai_clock_polarity sai_clock_polarity_t
 SAI clock polarity, active high or low. More...
 
typedef struct _sai_config sai_config_t
 SAI user configuration structure. More...
 
typedef enum _sai_data_order sai_data_order_t
 SAI data order, MSB or LSB. More...
 
typedef enum _sai_frame_sync_len sai_frame_sync_len_t
 sai frame sync len More...
 
typedef struct _sai_frame_sync sai_frame_sync_t
 sai frame sync configurations More...
 
typedef struct _sai_handle sai_handle_t
 
typedef enum _sai_master_slave sai_master_slave_t
 Master or slave mode. More...
 
typedef enum _sai_mclk_source sai_mclk_source_t
 Mater clock source. More...
 
typedef enum _sai_mono_stereo sai_mono_stereo_t
 Mono or stereo audio format. More...
 
typedef enum _sai_protocol sai_protocol_t
 Define the SAI bus type. More...
 
typedef enum _sai_reset_type sai_reset_type_t
 The reset type. More...
 
typedef enum _sai_sample_rate sai_sample_rate_t
 Audio sample rate. More...
 
typedef struct _sai_serial_data sai_serial_data_t
 sai serial data configurations More...
 
typedef enum _sai_sync_mode sai_sync_mode_t
 Synchronous or asynchronous mode. More...
 
typedef struct _sai_transceiver sai_transceiver_t
 sai transceiver configurations More...
 
typedef enum _sai_transceiver_type sai_transceiver_type_t
 sai transceiver type More...
 
typedef void(* sai_transfer_callback_t) (I2S_Type *base, sai_handle_t *handle, status_t status, void *userData)
 SAI transfer callback prototype. More...
 
typedef struct _sai_transfer_format sai_transfer_format_t
 sai transfer format More...
 
typedef struct _sai_transfer sai_transfer_t
 SAI transfer structure. More...
 
typedef enum _sai_word_width sai_word_width_t
 Audio word width. More...
 
#define SAI_XFER_QUEUE_SIZE   (4U)
 SAI transfer queue size, user can refine it according to use case. More...
 


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:57