discoverpixy
Functions
Initialization and Configuration functions

Initialization and Configuration functions. More...

Collaboration diagram for Initialization and Configuration functions:

Functions

void SAI_DeInit (SAI_TypeDef *SAIx)
 Deinitialize the SAIx peripheral registers to their default reset values. More...
 
void SAI_Init (SAI_Block_TypeDef *SAI_Block_x, SAI_InitTypeDef *SAI_InitStruct)
 Initializes the SAI Block x peripheral according to the specified parameters in the SAI_InitStruct. More...
 
void SAI_FrameInit (SAI_Block_TypeDef *SAI_Block_x, SAI_FrameInitTypeDef *SAI_FrameInitStruct)
 Initializes the SAI Block Audio frame according to the specified parameters in the SAI_FrameInitStruct. More...
 
void SAI_SlotInit (SAI_Block_TypeDef *SAI_Block_x, SAI_SlotInitTypeDef *SAI_SlotInitStruct)
 Initializes the SAI Block audio Slot according to the specified parameters in the SAI_SlotInitStruct. More...
 
void SAI_StructInit (SAI_InitTypeDef *SAI_InitStruct)
 Fills each SAI_InitStruct member with its default value. More...
 
void SAI_FrameStructInit (SAI_FrameInitTypeDef *SAI_FrameInitStruct)
 Fills each SAI_FrameInitStruct member with its default value. More...
 
void SAI_SlotStructInit (SAI_SlotInitTypeDef *SAI_SlotInitStruct)
 Fills each SAI_SlotInitStruct member with its default value. More...
 
void SAI_Cmd (SAI_Block_TypeDef *SAI_Block_x, FunctionalState NewState)
 Enables or disables the specified SAI Block peripheral. More...
 
void SAI_MonoModeConfig (SAI_Block_TypeDef *SAI_Block_x, uint32_t SAI_Mono_StreoMode)
 Configures the mono mode for the selected SAI block. More...
 
void SAI_TRIStateConfig (SAI_Block_TypeDef *SAI_Block_x, uint32_t SAI_TRIState)
 Configures the TRIState managment on data line for the selected SAI block. More...
 
void SAI_CompandingModeConfig (SAI_Block_TypeDef *SAI_Block_x, uint32_t SAI_CompandingMode)
 Configures the companding mode for the selected SAI block. More...
 
void SAI_MuteModeCmd (SAI_Block_TypeDef *SAI_Block_x, FunctionalState NewState)
 Enables or disables the Mute mode for the selected SAI block. More...
 
void SAI_MuteValueConfig (SAI_Block_TypeDef *SAI_Block_x, uint32_t SAI_MuteValue)
 Configure the mute value for the selected SAI block. More...
 
void SAI_MuteFrameCounterConfig (SAI_Block_TypeDef *SAI_Block_x, uint32_t SAI_MuteCounter)
 Enables or disables the Mute mode for the selected SAI block. More...
 
void SAI_FlushFIFO (SAI_Block_TypeDef *SAI_Block_x)
 Reinitialize the FIFO pointer. More...
 

Detailed Description

Initialization and Configuration functions.

 ===============================================================================
            ##### Initialization and Configuration functions #####
 ===============================================================================  
  [..]
  This section provides a set of functions allowing to initialize the SAI Audio 
  Block Mode, Audio Protocol, Data size, Synchronization between audio block, 
  Master clock Divider, Fifo threshold, Frame configuration, slot configuration,
  Tristate mode, Companding mode and Mute mode.  
  [..] 
  The SAI_Init(), SAI_FrameInit() and SAI_SlotInit() functions follows the SAI Block
  configuration procedures for Master mode and Slave mode (details for these procedures 
  are available in reference manual(RM0090).

Function Documentation

void SAI_Cmd ( SAI_Block_TypeDef SAI_Block_x,
FunctionalState  NewState 
)

Enables or disables the specified SAI Block peripheral.

Parameters
SAI_Block_xwhere x can be A or B to select the SAI Block peripheral.
NewStatenew state of the SAI_Block_x peripheral. This parameter can be: ENABLE or DISABLE.
Return values
None
void SAI_CompandingModeConfig ( SAI_Block_TypeDef SAI_Block_x,
uint32_t  SAI_CompandingMode 
)

Configures the companding mode for the selected SAI block.

Note
The data expansion or data compression are determined by the state of SAI block selected (transmitter or receiver).
Parameters
SAI_Block_xwhere x can be A or B to select the SAI Block peripheral.
SAI_CompandingModespecifies the SAI block companding mode. This parameter can be one of the following values:
  • SAI_NoCompanding : no companding algorithm set
  • SAI_ULaw_1CPL_Companding : Set U law (algorithm 1's complement representation)
  • SAI_ALaw_1CPL_Companding : Set A law (algorithm 1's complement repesentation)
  • SAI_ULaw_2CPL_Companding : Set U law (algorithm 2's complement representation)
  • SAI_ALaw_2CPL_Companding : Set A law (algorithm 2's complement repesentation)
Return values
None
void SAI_DeInit ( SAI_TypeDef SAIx)

Deinitialize the SAIx peripheral registers to their default reset values.

Parameters
SAIxTo select the SAIx peripheral, where x can be the different instances
Return values
None

Here is the call graph for this function:

void SAI_FlushFIFO ( SAI_Block_TypeDef SAI_Block_x)

Reinitialize the FIFO pointer.

Note
The FIFO pointers can be reinitialized at anytime The data present into the FIFO, if it is not empty, will be lost.
Parameters
SAI_Block_xwhere x can be A or B to select the SAI Block peripheral.
NewStatenew state of the selected SAI TI communication mode. This parameter can be: ENABLE or DISABLE.
Return values
None
void SAI_FrameInit ( SAI_Block_TypeDef SAI_Block_x,
SAI_FrameInitTypeDef SAI_FrameInitStruct 
)

Initializes the SAI Block Audio frame according to the specified parameters in the SAI_FrameInitStruct.

Note
this function has no meaning if the AC'97 or SPDIF audio protocol are selected.
Parameters
SAI_Block_xwhere x can be A or B to select the SAI Block peripheral.
SAI_FrameInitStructpointer to an SAI_FrameInitTypeDef structure that contains the configuration of audio frame for a specified SAI Block
Return values
None
void SAI_FrameStructInit ( SAI_FrameInitTypeDef SAI_FrameInitStruct)

Fills each SAI_FrameInitStruct member with its default value.

Parameters
SAI_FrameInitStructpointer to a SAI_FrameInitTypeDef structure which will be initialized.
Return values
None
void SAI_Init ( SAI_Block_TypeDef SAI_Block_x,
SAI_InitTypeDef SAI_InitStruct 
)

Initializes the SAI Block x peripheral according to the specified parameters in the SAI_InitStruct.

Note
SAI clock is generated from a specific output of the PLLSAI or a specific output of the PLLI2S or from an alternate function bypassing the PLL I2S.
Parameters
SAI_Block_xwhere x can be A or B to select the SAI Block peripheral.
SAI_InitStructpointer to a SAI_InitTypeDef structure that contains the configuration information for the specified SAI Block peripheral.
Return values
None
void SAI_MonoModeConfig ( SAI_Block_TypeDef SAI_Block_x,
uint32_t  SAI_Mono_StreoMode 
)

Configures the mono mode for the selected SAI block.

Note
This function has a meaning only when the number of slot is equal to 2.
Parameters
SAI_Block_xwhere x can be A or B to select the SAI Block peripheral.
SAI_MonoModespecifies the SAI block mono mode. This parameter can be one of the following values:
  • SAI_MonoMode : Set mono audio mode
  • SAI_StreoMode : Set streo audio mode
Return values
None
void SAI_MuteFrameCounterConfig ( SAI_Block_TypeDef SAI_Block_x,
uint32_t  SAI_MuteCounter 
)

Enables or disables the Mute mode for the selected SAI block.

Note
This function has a meaning only when the audio block is Receiver
Parameters
SAI_Block_xwhere x can be A or B to select the SAI Block peripheral.
SAI_MuteCounterspecifies the SAI block mute value. This parameter can be a number between 0 and 63.
Return values
None
void SAI_MuteModeCmd ( SAI_Block_TypeDef SAI_Block_x,
FunctionalState  NewState 
)

Enables or disables the Mute mode for the selected SAI block.

Note
This function has a meaning only when the audio block is transmitter
Mute mode is applied for an entire frame for all the valid slot It becomes active at the end of an audio frame when set somewhere in a frame. Mute mode exit occurs at the end of the frame in which the bit MUTE has been set.
Parameters
SAI_Block_xwhere x can be A or B to select the SAI Block peripheral.
NewStatenew state of the SAIx block. This parameter can be: ENABLE or DISABLE.
Return values
None
void SAI_MuteValueConfig ( SAI_Block_TypeDef SAI_Block_x,
uint32_t  SAI_MuteValue 
)

Configure the mute value for the selected SAI block.

Note
This function has a meaning only when the audio block is transmitter
the configuration last value sent during mute mode has only a meaning when the number of slot is lower or equal to 2 and if the MUTE bit is set.
Parameters
SAI_Block_xwhere x can be A or B to select the SAI Block peripheral.
SAI_MuteValuespecifies the SAI block mute value. This parameter can be one of the following values:
  • SAI_ZeroValue : bit value 0 is sent during Mute Mode
  • SAI_LastSentValue : Last value is sent during Mute Mode
Return values
None
void SAI_SlotInit ( SAI_Block_TypeDef SAI_Block_x,
SAI_SlotInitTypeDef SAI_SlotInitStruct 
)

Initializes the SAI Block audio Slot according to the specified parameters in the SAI_SlotInitStruct.

Note
this function has no meaning if the AC'97 or SPDIF audio protocol are selected.
Parameters
SAI_Block_xwhere x can be A or B to select the SAI Block peripheral.
SAI_SlotInitStructpointer to an SAI_SlotInitTypeDef structure that contains the configuration of audio slot for a specified SAI Block
Return values
None
void SAI_SlotStructInit ( SAI_SlotInitTypeDef SAI_SlotInitStruct)

Fills each SAI_SlotInitStruct member with its default value.

Parameters
SAI_SlotInitStructpointer to a SAI_SlotInitTypeDef structure which will be initialized.
Return values
None
void SAI_StructInit ( SAI_InitTypeDef SAI_InitStruct)

Fills each SAI_InitStruct member with its default value.

Parameters
SAI_InitStructpointer to a SAI_InitTypeDef structure which will be initialized.
Return values
None
void SAI_TRIStateConfig ( SAI_Block_TypeDef SAI_Block_x,
uint32_t  SAI_TRIState 
)

Configures the TRIState managment on data line for the selected SAI block.

Note
This function has a meaning only when the SAI block is configured in transmitter
Parameters
SAI_Block_xwhere x can be A or B to select the SAI Block peripheral.
SAI_TRIStatespecifies the SAI block TRIState management. This parameter can be one of the following values:
  • SAI_Output_NotReleased : SD output line is still drived by the SAI.
  • SAI_Output_Released : SD output line is released (HI-Z)
Return values
None