discoverpixy
Classes | Macros | Functions
stm32f4xx_sai.h File Reference

This file contains all the functions prototypes for the SAI firmware library. More...

#include "stm32f4xx.h"
Include dependency graph for stm32f4xx_sai.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SAI_InitTypeDef
 SAI Block Init structure definition. More...
 
struct  SAI_FrameInitTypeDef
 SAI Block Frame Init structure definition. More...
 
struct  SAI_SlotInitTypeDef
 SAI Block Slot Init Structure definition. More...
 

Macros

#define IS_SAI_PERIPH(PERIPH)   ((PERIPH) == SAI1)
 
#define IS_SAI_BLOCK_PERIPH(PERIPH)
 
#define SAI_Mode_MasterTx   ((uint32_t)0x00000000)
 
#define SAI_Mode_MasterRx   ((uint32_t)0x00000001)
 
#define SAI_Mode_SlaveTx   ((uint32_t)0x00000002)
 
#define SAI_Mode_SlaveRx   ((uint32_t)0x00000003)
 
#define IS_SAI_BLOCK_MODE(MODE)
 
#define SAI_Free_Protocol   ((uint32_t)0x00000000)
 
#define SAI_SPDIF_Protocol   ((uint32_t)SAI_xCR1_PRTCFG_0)
 
#define SAI_AC97_Protocol   ((uint32_t)SAI_xCR1_PRTCFG_1)
 
#define IS_SAI_BLOCK_PROTOCOL(PROTOCOL)
 
#define SAI_DataSize_8b   ((uint32_t)0x00000040)
 
#define SAI_DataSize_10b   ((uint32_t)0x00000060)
 
#define SAI_DataSize_16b   ((uint32_t)0x00000080)
 
#define SAI_DataSize_20b   ((uint32_t)0x000000A0)
 
#define SAI_DataSize_24b   ((uint32_t)0x000000C0)
 
#define SAI_DataSize_32b   ((uint32_t)0x000000E0)
 
#define IS_SAI_BLOCK_DATASIZE(DATASIZE)
 
#define SAI_FirstBit_MSB   ((uint32_t)0x00000000)
 
#define SAI_FirstBit_LSB   ((uint32_t)SAI_xCR1_LSBFIRST)
 
#define IS_SAI_BLOCK_FIRST_BIT(BIT)
 
#define SAI_ClockStrobing_FallingEdge   ((uint32_t)0x00000000)
 
#define SAI_ClockStrobing_RisingEdge   ((uint32_t)SAI_xCR1_CKSTR)
 
#define IS_SAI_BLOCK_CLOCK_STROBING(CLOCK)
 
#define SAI_Asynchronous   ((uint32_t)0x00000000)
 
#define SAI_Synchronous   ((uint32_t)SAI_xCR1_SYNCEN_0)
 
#define IS_SAI_BLOCK_SYNCHRO(SYNCHRO)
 
#define SAI_OutputDrive_Disabled   ((uint32_t)0x00000000)
 
#define SAI_OutputDrive_Enabled   ((uint32_t)SAI_xCR1_OUTDRIV)
 
#define IS_SAI_BLOCK_OUTPUT_DRIVE(DRIVE)
 
#define SAI_MasterDivider_Enabled   ((uint32_t)0x00000000)
 
#define SAI_MasterDivider_Disabled   ((uint32_t)SAI_xCR1_NODIV)
 
#define IS_SAI_BLOCK_NODIVIDER(NODIVIDER)
 
#define IS_SAI_BLOCK_MASTER_DIVIDER(DIVIDER)   ((DIVIDER) <= 15)
 
#define IS_SAI_BLOCK_FRAME_LENGTH(LENGTH)   ((8 <= (LENGTH)) && ((LENGTH) <= 256))
 
#define IS_SAI_BLOCK_ACTIVE_FRAME(LENGTH)   ((1 <= (LENGTH)) && ((LENGTH) <= 128))
 
#define SAI_FS_StartFrame   ((uint32_t)0x00000000)
 
#define I2S_FS_ChannelIdentification   ((uint32_t)SAI_xFRCR_FSDEF)
 
#define IS_SAI_BLOCK_FS_DEFINITION(DEFINITION)
 
#define SAI_FS_ActiveLow   ((uint32_t)0x00000000)
 
#define SAI_FS_ActiveHigh   ((uint32_t)SAI_xFRCR_FSPO)
 
#define IS_SAI_BLOCK_FS_POLARITY(POLARITY)
 
#define SAI_FS_FirstBit   ((uint32_t)0x00000000)
 
#define SAI_FS_BeforeFirstBit   ((uint32_t)SAI_xFRCR_FSOFF)
 
#define IS_SAI_BLOCK_FS_OFFSET(OFFSET)
 
#define IS_SAI_BLOCK_FIRSTBIT_OFFSET(OFFSET)   ((OFFSET) <= 24)
 
#define SAI_SlotSize_DataSize   ((uint32_t)0x00000000)
 
#define SAI_SlotSize_16b   ((uint32_t)SAI_xSLOTR_SLOTSZ_0)
 
#define SAI_SlotSize_32b   ((uint32_t)SAI_xSLOTR_SLOTSZ_1)
 
#define IS_SAI_BLOCK_SLOT_SIZE(SIZE)
 
#define IS_SAI_BLOCK_SLOT_NUMBER(NUMBER)   ((1 <= (NUMBER)) && ((NUMBER) <= 16))
 
#define SAI_Slot_NotActive   ((uint32_t)0x00000000)
 
#define SAI_SlotActive_0   ((uint32_t)0x00010000)
 
#define SAI_SlotActive_1   ((uint32_t)0x00020000)
 
#define SAI_SlotActive_2   ((uint32_t)0x00040000)
 
#define SAI_SlotActive_3   ((uint32_t)0x00080000)
 
#define SAI_SlotActive_4   ((uint32_t)0x00100000)
 
#define SAI_SlotActive_5   ((uint32_t)0x00200000)
 
#define SAI_SlotActive_6   ((uint32_t)0x00400000)
 
#define SAI_SlotActive_7   ((uint32_t)0x00800000)
 
#define SAI_SlotActive_8   ((uint32_t)0x01000000)
 
#define SAI_SlotActive_9   ((uint32_t)0x02000000)
 
#define SAI_SlotActive_10   ((uint32_t)0x04000000)
 
#define SAI_SlotActive_11   ((uint32_t)0x08000000)
 
#define SAI_SlotActive_12   ((uint32_t)0x10000000)
 
#define SAI_SlotActive_13   ((uint32_t)0x20000000)
 
#define SAI_SlotActive_14   ((uint32_t)0x40000000)
 
#define SAI_SlotActive_15   ((uint32_t)0x80000000)
 
#define SAI_SlotActive_ALL   ((uint32_t)0xFFFF0000)
 
#define IS_SAI_SLOT_ACTIVE(ACTIVE)   ((ACTIVE) != 0)
 
#define SAI_MonoMode   ((uint32_t)SAI_xCR1_MONO)
 
#define SAI_StreoMode   ((uint32_t)0x00000000)
 
#define IS_SAI_BLOCK_MONO_STREO_MODE(MODE)
 
#define SAI_Output_NotReleased   ((uint32_t)0x00000000)
 
#define SAI_Output_Released   ((uint32_t)SAI_xCR2_TRIS)
 
#define IS_SAI_BLOCK_TRISTATE_MANAGEMENT(STATE)
 
#define SAI_Threshold_FIFOEmpty   ((uint32_t)0x00000000)
 
#define SAI_FIFOThreshold_1QuarterFull   ((uint32_t)0x00000001)
 
#define SAI_FIFOThreshold_HalfFull   ((uint32_t)0x00000002)
 
#define SAI_FIFOThreshold_3QuartersFull   ((uint32_t)0x00000003)
 
#define SAI_FIFOThreshold_Full   ((uint32_t)0x00000004)
 
#define IS_SAI_BLOCK_FIFO_THRESHOLD(THRESHOLD)
 
#define SAI_NoCompanding   ((uint32_t)0x00000000)
 
#define SAI_ULaw_1CPL_Companding   ((uint32_t)0x00008000)
 
#define SAI_ALaw_1CPL_Companding   ((uint32_t)0x0000C000)
 
#define SAI_ULaw_2CPL_Companding   ((uint32_t)0x0000A000)
 
#define SAI_ALaw_2CPL_Companding   ((uint32_t)0x0000E000)
 
#define IS_SAI_BLOCK_COMPANDING_MODE(MODE)
 
#define SAI_ZeroValue   ((uint32_t)0x00000000)
 
#define SAI_LastSentValue   ((uint32_t)SAI_xCR2_MUTEVAL)
 
#define IS_SAI_BLOCK_MUTE_VALUE(VALUE)
 
#define IS_SAI_BLOCK_MUTE_COUNTER(COUNTER)   ((COUNTER) <= 63)
 
#define SAI_IT_OVRUDR   ((uint32_t)SAI_xIMR_OVRUDRIE)
 
#define SAI_IT_MUTEDET   ((uint32_t)SAI_xIMR_MUTEDETIE)
 
#define SAI_IT_WCKCFG   ((uint32_t)SAI_xIMR_WCKCFGIE)
 
#define SAI_IT_FREQ   ((uint32_t)SAI_xIMR_FREQIE)
 
#define SAI_IT_CNRDY   ((uint32_t)SAI_xIMR_CNRDYIE)
 
#define SAI_IT_AFSDET   ((uint32_t)SAI_xIMR_AFSDETIE)
 
#define SAI_IT_LFSDET   ((uint32_t)SAI_xIMR_LFSDETIE)
 
#define IS_SAI_BLOCK_CONFIG_IT(IT)
 
#define SAI_FLAG_OVRUDR   ((uint32_t)SAI_xSR_OVRUDR)
 
#define SAI_FLAG_MUTEDET   ((uint32_t)SAI_xSR_MUTEDET)
 
#define SAI_FLAG_WCKCFG   ((uint32_t)SAI_xSR_WCKCFG)
 
#define SAI_FLAG_FREQ   ((uint32_t)SAI_xSR_FREQ)
 
#define SAI_FLAG_CNRDY   ((uint32_t)SAI_xSR_CNRDY)
 
#define SAI_FLAG_AFSDET   ((uint32_t)SAI_xSR_AFSDET)
 
#define SAI_FLAG_LFSDET   ((uint32_t)SAI_xSR_LFSDET)
 
#define IS_SAI_BLOCK_GET_FLAG(FLAG)
 
#define IS_SAI_BLOCK_CLEAR_FLAG(FLAG)
 
#define SAI_FIFOStatus_Empty   ((uint32_t)0x00000000)
 
#define SAI_FIFOStatus_Less1QuarterFull   ((uint32_t)0x00010000)
 
#define SAI_FIFOStatus_1QuarterFull   ((uint32_t)0x00020000)
 
#define SAI_FIFOStatus_HalfFull   ((uint32_t)0x00030000)
 
#define SAI_FIFOStatus_3QuartersFull   ((uint32_t)0x00040000)
 
#define SAI_FIFOStatus_Full   ((uint32_t)0x00050000)
 
#define IS_SAI_BLOCK_FIFO_STATUS(STATUS)
 

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...
 
void SAI_SendData (SAI_Block_TypeDef *SAI_Block_x, uint32_t Data)
 Transmits a Data through the SAI block x peripheral. More...
 
uint32_t SAI_ReceiveData (SAI_Block_TypeDef *SAI_Block_x)
 Returns the most recent received data by the SAI block x peripheral. More...
 
void SAI_DMACmd (SAI_Block_TypeDef *SAI_Block_x, FunctionalState NewState)
 Enables or disables the SAI Block x DMA interface. More...
 
void SAI_ITConfig (SAI_Block_TypeDef *SAI_Block_x, uint32_t SAI_IT, FunctionalState NewState)
 Enables or disables the specified SAI Block interrupts. More...
 
FlagStatus SAI_GetFlagStatus (SAI_Block_TypeDef *SAI_Block_x, uint32_t SAI_FLAG)
 Checks whether the specified SAI block x flag is set or not. More...
 
void SAI_ClearFlag (SAI_Block_TypeDef *SAI_Block_x, uint32_t SAI_FLAG)
 Clears the specified SAI Block x flag. More...
 
ITStatus SAI_GetITStatus (SAI_Block_TypeDef *SAI_Block_x, uint32_t SAI_IT)
 Checks whether the specified SAI Block x interrupt has occurred or not. More...
 
void SAI_ClearITPendingBit (SAI_Block_TypeDef *SAI_Block_x, uint32_t SAI_IT)
 Clears the SAI Block x interrupt pending bit. More...
 
FunctionalState SAI_GetCmdStatus (SAI_Block_TypeDef *SAI_Block_x)
 Returns the status of EN bit for the specified SAI Block x. More...
 
uint32_t SAI_GetFIFOStatus (SAI_Block_TypeDef *SAI_Block_x)
 Returns the current SAI Block x FIFO filled level. More...
 

Detailed Description

This file contains all the functions prototypes for the SAI firmware library.

Author
MCD Application Team
Version
V1.4.0
Date
04-August-2014
Attention

© COPYRIGHT 2014 STMicroelectronics

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at:

   http://www.st.com/software_license_agreement_liberty_v2

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.