meh
Fork of mbed by
TARGET_NUCLEO_F401RE/stm32f4xx_hal_sai.h@110:165afa46840b, 2015-11-25 (annotated)
- Committer:
- Kojto
- Date:
- Wed Nov 25 13:21:40 2015 +0000
- Revision:
- 110:165afa46840b
- Parent:
- 106:ba1f97679dad
Release 110 of the mbed library
Changes:
- new platforms - STM32F410R, DISCO_F429ZI, DISCO_F469NI
- Nucleo L476 - gcc and uvision template
- k22,k64f targets - ADC channels A addition
- EFM32 - bugfixes in sleep, serial and spi
- Delta DFCM NNN40 - pinnames update
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 77:869cf507173a | 1 | /** |
emilmont | 77:869cf507173a | 2 | ****************************************************************************** |
emilmont | 77:869cf507173a | 3 | * @file stm32f4xx_hal_sai.h |
emilmont | 77:869cf507173a | 4 | * @author MCD Application Team |
Kojto | 110:165afa46840b | 5 | * @version V1.4.1 |
Kojto | 110:165afa46840b | 6 | * @date 09-October-2015 |
emilmont | 77:869cf507173a | 7 | * @brief Header file of SAI HAL module. |
emilmont | 77:869cf507173a | 8 | ****************************************************************************** |
emilmont | 77:869cf507173a | 9 | * @attention |
emilmont | 77:869cf507173a | 10 | * |
Kojto | 99:dbbf35b96557 | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
emilmont | 77:869cf507173a | 12 | * |
emilmont | 77:869cf507173a | 13 | * Redistribution and use in source and binary forms, with or without modification, |
emilmont | 77:869cf507173a | 14 | * are permitted provided that the following conditions are met: |
emilmont | 77:869cf507173a | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
emilmont | 77:869cf507173a | 16 | * this list of conditions and the following disclaimer. |
emilmont | 77:869cf507173a | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
emilmont | 77:869cf507173a | 18 | * this list of conditions and the following disclaimer in the documentation |
emilmont | 77:869cf507173a | 19 | * and/or other materials provided with the distribution. |
emilmont | 77:869cf507173a | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
emilmont | 77:869cf507173a | 21 | * may be used to endorse or promote products derived from this software |
emilmont | 77:869cf507173a | 22 | * without specific prior written permission. |
emilmont | 77:869cf507173a | 23 | * |
emilmont | 77:869cf507173a | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
emilmont | 77:869cf507173a | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
emilmont | 77:869cf507173a | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
emilmont | 77:869cf507173a | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
emilmont | 77:869cf507173a | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
emilmont | 77:869cf507173a | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
emilmont | 77:869cf507173a | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
emilmont | 77:869cf507173a | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
emilmont | 77:869cf507173a | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
emilmont | 77:869cf507173a | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
emilmont | 77:869cf507173a | 34 | * |
emilmont | 77:869cf507173a | 35 | ****************************************************************************** |
emilmont | 77:869cf507173a | 36 | */ |
emilmont | 77:869cf507173a | 37 | |
emilmont | 77:869cf507173a | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
emilmont | 77:869cf507173a | 39 | #ifndef __STM32F4xx_HAL_SAI_H |
emilmont | 77:869cf507173a | 40 | #define __STM32F4xx_HAL_SAI_H |
emilmont | 77:869cf507173a | 41 | |
emilmont | 77:869cf507173a | 42 | #ifdef __cplusplus |
emilmont | 77:869cf507173a | 43 | extern "C" { |
emilmont | 77:869cf507173a | 44 | #endif |
emilmont | 77:869cf507173a | 45 | |
emilmont | 77:869cf507173a | 46 | /* Includes ------------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 47 | #include "stm32f4xx_hal_def.h" |
emilmont | 77:869cf507173a | 48 | |
emilmont | 77:869cf507173a | 49 | /** @addtogroup STM32F4xx_HAL_Driver |
emilmont | 77:869cf507173a | 50 | * @{ |
emilmont | 77:869cf507173a | 51 | */ |
Kojto | 110:165afa46840b | 52 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ |
Kojto | 110:165afa46840b | 53 | defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) |
emilmont | 77:869cf507173a | 54 | |
emilmont | 77:869cf507173a | 55 | /** @addtogroup SAI |
emilmont | 77:869cf507173a | 56 | * @{ |
emilmont | 77:869cf507173a | 57 | */ |
Kojto | 99:dbbf35b96557 | 58 | |
Kojto | 99:dbbf35b96557 | 59 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 60 | /** @defgroup SAI_Exported_Types SAI Exported Types |
Kojto | 99:dbbf35b96557 | 61 | * @{ |
Kojto | 99:dbbf35b96557 | 62 | */ |
Kojto | 99:dbbf35b96557 | 63 | |
Kojto | 99:dbbf35b96557 | 64 | /** |
Kojto | 99:dbbf35b96557 | 65 | * @brief HAL State structures definition |
Kojto | 99:dbbf35b96557 | 66 | */ |
Kojto | 99:dbbf35b96557 | 67 | typedef enum |
Kojto | 99:dbbf35b96557 | 68 | { |
Kojto | 99:dbbf35b96557 | 69 | HAL_SAI_STATE_RESET = 0x00, /*!< SAI not yet initialized or disabled */ |
Kojto | 99:dbbf35b96557 | 70 | HAL_SAI_STATE_READY = 0x01, /*!< SAI initialized and ready for use */ |
Kojto | 99:dbbf35b96557 | 71 | HAL_SAI_STATE_BUSY = 0x02, /*!< SAI internal process is ongoing */ |
Kojto | 99:dbbf35b96557 | 72 | HAL_SAI_STATE_BUSY_TX = 0x12, /*!< Data transmission process is ongoing */ |
Kojto | 99:dbbf35b96557 | 73 | HAL_SAI_STATE_BUSY_RX = 0x22, /*!< Data reception process is ongoing */ |
Kojto | 99:dbbf35b96557 | 74 | HAL_SAI_STATE_TIMEOUT = 0x03, /*!< SAI timeout state */ |
Kojto | 99:dbbf35b96557 | 75 | HAL_SAI_STATE_ERROR = 0x04 /*!< SAI error state */ |
Kojto | 99:dbbf35b96557 | 76 | }HAL_SAI_StateTypeDef; |
emilmont | 77:869cf507173a | 77 | |
Kojto | 99:dbbf35b96557 | 78 | /** |
Kojto | 99:dbbf35b96557 | 79 | * @brief SAI Callback prototype |
Kojto | 99:dbbf35b96557 | 80 | */ |
Kojto | 99:dbbf35b96557 | 81 | typedef void (*SAIcallback)(void); |
emilmont | 77:869cf507173a | 82 | |
emilmont | 77:869cf507173a | 83 | /** |
emilmont | 77:869cf507173a | 84 | * @brief SAI Init Structure definition |
emilmont | 77:869cf507173a | 85 | */ |
emilmont | 77:869cf507173a | 86 | typedef struct |
emilmont | 77:869cf507173a | 87 | { |
Kojto | 99:dbbf35b96557 | 88 | uint32_t AudioMode; /*!< Specifies the SAI Block audio Mode. |
Kojto | 99:dbbf35b96557 | 89 | This parameter can be a value of @ref SAI_Block_Mode */ |
Kojto | 99:dbbf35b96557 | 90 | |
Kojto | 99:dbbf35b96557 | 91 | uint32_t Synchro; /*!< Specifies SAI Block synchronization |
Kojto | 99:dbbf35b96557 | 92 | This parameter can be a value of @ref SAI_Block_Synchronization */ |
Kojto | 99:dbbf35b96557 | 93 | |
Kojto | 99:dbbf35b96557 | 94 | uint32_t SynchroExt; /*!< Specifies SAI Block synchronization, this setup is common |
Kojto | 99:dbbf35b96557 | 95 | for BLOCKA and BLOCKB |
Kojto | 99:dbbf35b96557 | 96 | This parameter can be a value of @ref SAI_Block_SyncExt */ |
Kojto | 99:dbbf35b96557 | 97 | |
Kojto | 99:dbbf35b96557 | 98 | uint32_t OutputDrive; /*!< Specifies when SAI Block outputs are driven. |
Kojto | 99:dbbf35b96557 | 99 | This parameter can be a value of @ref SAI_Block_Output_Drive |
Kojto | 99:dbbf35b96557 | 100 | @note this value has to be set before enabling the audio block |
Kojto | 99:dbbf35b96557 | 101 | but after the audio block configuration. */ |
Kojto | 99:dbbf35b96557 | 102 | |
Kojto | 99:dbbf35b96557 | 103 | uint32_t NoDivider; /*!< Specifies whether master clock will be divided or not. |
Kojto | 99:dbbf35b96557 | 104 | This parameter can be a value of @ref SAI_Block_NoDivider |
Kojto | 99:dbbf35b96557 | 105 | @note: If bit NODIV in the SAI_xCR1 register is cleared, the frame length |
Kojto | 99:dbbf35b96557 | 106 | should be aligned to a number equal to a power of 2, from 8 to 256. |
Kojto | 99:dbbf35b96557 | 107 | If bit NODIV in the SAI_xCR1 register is set, the frame length can |
Kojto | 99:dbbf35b96557 | 108 | take any of the values without constraint since the input clock of |
Kojto | 99:dbbf35b96557 | 109 | the audio block should be equal to the bit clock. |
Kojto | 99:dbbf35b96557 | 110 | There is no MCLK_x clock which can be output. */ |
Kojto | 99:dbbf35b96557 | 111 | |
Kojto | 99:dbbf35b96557 | 112 | uint32_t FIFOThreshold; /*!< Specifies SAI Block FIFO threshold. |
Kojto | 99:dbbf35b96557 | 113 | This parameter can be a value of @ref SAI_Block_Fifo_Threshold */ |
Kojto | 99:dbbf35b96557 | 114 | |
Kojto | 99:dbbf35b96557 | 115 | uint32_t ClockSource; /*!< Specifies the SAI Block x Clock source. |
Kojto | 99:dbbf35b96557 | 116 | This parameter is not used for STM32F446xx devices. */ |
Kojto | 99:dbbf35b96557 | 117 | |
Kojto | 99:dbbf35b96557 | 118 | uint32_t AudioFrequency; /*!< Specifies the audio frequency sampling. |
Kojto | 99:dbbf35b96557 | 119 | This parameter can be a value of @ref SAI_Audio_Frequency */ |
Kojto | 99:dbbf35b96557 | 120 | |
Kojto | 99:dbbf35b96557 | 121 | uint32_t Mckdiv; /*!< Specifies the master clock divider, the parameter will be used if for |
Kojto | 99:dbbf35b96557 | 122 | AudioFrequency the user choice |
Kojto | 99:dbbf35b96557 | 123 | This parameter must be a number between Min_Data = 0 and Max_Data = 15 */ |
Kojto | 99:dbbf35b96557 | 124 | |
Kojto | 99:dbbf35b96557 | 125 | uint32_t MonoStereoMode; /*!< Specifies if the mono or stereo mode is selected. |
Kojto | 99:dbbf35b96557 | 126 | This parameter can be a value of @ref SAI_Mono_Stereo_Mode */ |
Kojto | 99:dbbf35b96557 | 127 | |
Kojto | 99:dbbf35b96557 | 128 | uint32_t CompandingMode; /*!< Specifies the companding mode type. |
Kojto | 99:dbbf35b96557 | 129 | This parameter can be a value of @ref SAI_Block_Companding_Mode */ |
Kojto | 99:dbbf35b96557 | 130 | |
Kojto | 99:dbbf35b96557 | 131 | uint32_t TriState; /*!< Specifies the companding mode type. |
Kojto | 99:dbbf35b96557 | 132 | This parameter can be a value of @ref SAI_TRIState_Management */ |
Kojto | 99:dbbf35b96557 | 133 | |
Kojto | 99:dbbf35b96557 | 134 | /* This part of the structure is automatically filled if your are using the high level intialisation |
Kojto | 99:dbbf35b96557 | 135 | function HAL_SAI_InitProtocol */ |
Kojto | 99:dbbf35b96557 | 136 | |
emilmont | 77:869cf507173a | 137 | uint32_t Protocol; /*!< Specifies the SAI Block protocol. |
Kojto | 99:dbbf35b96557 | 138 | This parameter can be a value of @ref SAI_Block_Protocol */ |
Kojto | 99:dbbf35b96557 | 139 | |
emilmont | 77:869cf507173a | 140 | uint32_t DataSize; /*!< Specifies the SAI Block data size. |
Kojto | 99:dbbf35b96557 | 141 | This parameter can be a value of @ref SAI_Block_Data_Size */ |
emilmont | 77:869cf507173a | 142 | |
emilmont | 77:869cf507173a | 143 | uint32_t FirstBit; /*!< Specifies whether data transfers start from MSB or LSB bit. |
Kojto | 99:dbbf35b96557 | 144 | This parameter can be a value of @ref SAI_Block_MSB_LSB_transmission */ |
emilmont | 77:869cf507173a | 145 | |
emilmont | 77:869cf507173a | 146 | uint32_t ClockStrobing; /*!< Specifies the SAI Block clock strobing edge sensitivity. |
Kojto | 99:dbbf35b96557 | 147 | This parameter can be a value of @ref SAI_Block_Clock_Strobing */ |
emilmont | 77:869cf507173a | 148 | }SAI_InitTypeDef; |
emilmont | 77:869cf507173a | 149 | |
emilmont | 77:869cf507173a | 150 | /** |
emilmont | 77:869cf507173a | 151 | * @brief SAI Block Frame Init structure definition |
emilmont | 77:869cf507173a | 152 | */ |
emilmont | 77:869cf507173a | 153 | |
emilmont | 77:869cf507173a | 154 | typedef struct |
emilmont | 77:869cf507173a | 155 | { |
emilmont | 77:869cf507173a | 156 | |
emilmont | 77:869cf507173a | 157 | uint32_t FrameLength; /*!< Specifies the Frame length, the number of SCK clocks for each audio frame. |
emilmont | 77:869cf507173a | 158 | This parameter must be a number between Min_Data = 8 and Max_Data = 256. |
emilmont | 77:869cf507173a | 159 | @note: If master clock MCLK_x pin is declared as an output, the frame length |
emilmont | 77:869cf507173a | 160 | should be aligned to a number equal to power of 2 in order to keep |
emilmont | 77:869cf507173a | 161 | in an audio frame, an integer number of MCLK pulses by bit Clock. */ |
emilmont | 77:869cf507173a | 162 | |
emilmont | 77:869cf507173a | 163 | uint32_t ActiveFrameLength; /*!< Specifies the Frame synchronization active level length. |
emilmont | 77:869cf507173a | 164 | This Parameter specifies the length in number of bit clock (SCK + 1) |
emilmont | 77:869cf507173a | 165 | of the active level of FS signal in audio frame. |
emilmont | 77:869cf507173a | 166 | This parameter must be a number between Min_Data = 1 and Max_Data = 128 */ |
emilmont | 77:869cf507173a | 167 | |
emilmont | 77:869cf507173a | 168 | uint32_t FSDefinition; /*!< Specifies the Frame synchronization definition. |
emilmont | 77:869cf507173a | 169 | This parameter can be a value of @ref SAI_Block_FS_Definition */ |
emilmont | 77:869cf507173a | 170 | |
emilmont | 77:869cf507173a | 171 | uint32_t FSPolarity; /*!< Specifies the Frame synchronization Polarity. |
emilmont | 77:869cf507173a | 172 | This parameter can be a value of @ref SAI_Block_FS_Polarity */ |
emilmont | 77:869cf507173a | 173 | |
emilmont | 77:869cf507173a | 174 | uint32_t FSOffset; /*!< Specifies the Frame synchronization Offset. |
emilmont | 77:869cf507173a | 175 | This parameter can be a value of @ref SAI_Block_FS_Offset */ |
emilmont | 77:869cf507173a | 176 | |
emilmont | 77:869cf507173a | 177 | }SAI_FrameInitTypeDef; |
emilmont | 77:869cf507173a | 178 | |
emilmont | 77:869cf507173a | 179 | /** |
emilmont | 77:869cf507173a | 180 | * @brief SAI Block Slot Init Structure definition |
emilmont | 77:869cf507173a | 181 | */ |
emilmont | 77:869cf507173a | 182 | |
emilmont | 77:869cf507173a | 183 | typedef struct |
emilmont | 77:869cf507173a | 184 | { |
emilmont | 77:869cf507173a | 185 | uint32_t FirstBitOffset; /*!< Specifies the position of first data transfer bit in the slot. |
emilmont | 77:869cf507173a | 186 | This parameter must be a number between Min_Data = 0 and Max_Data = 24 */ |
emilmont | 77:869cf507173a | 187 | |
emilmont | 77:869cf507173a | 188 | uint32_t SlotSize; /*!< Specifies the Slot Size. |
emilmont | 77:869cf507173a | 189 | This parameter can be a value of @ref SAI_Block_Slot_Size */ |
emilmont | 77:869cf507173a | 190 | |
emilmont | 77:869cf507173a | 191 | uint32_t SlotNumber; /*!< Specifies the number of slot in the audio frame. |
emilmont | 77:869cf507173a | 192 | This parameter must be a number between Min_Data = 1 and Max_Data = 16 */ |
emilmont | 77:869cf507173a | 193 | |
emilmont | 77:869cf507173a | 194 | uint32_t SlotActive; /*!< Specifies the slots in audio frame that will be activated. |
emilmont | 77:869cf507173a | 195 | This parameter can be a value of @ref SAI_Block_Slot_Active */ |
emilmont | 77:869cf507173a | 196 | }SAI_SlotInitTypeDef; |
emilmont | 77:869cf507173a | 197 | |
emilmont | 77:869cf507173a | 198 | /** |
emilmont | 77:869cf507173a | 199 | * @brief SAI handle Structure definition |
emilmont | 77:869cf507173a | 200 | */ |
Kojto | 99:dbbf35b96557 | 201 | typedef struct __SAI_HandleTypeDef |
emilmont | 77:869cf507173a | 202 | { |
emilmont | 77:869cf507173a | 203 | SAI_Block_TypeDef *Instance; /*!< SAI Blockx registers base address */ |
bogdanm | 85:024bf7f99721 | 204 | |
emilmont | 77:869cf507173a | 205 | SAI_InitTypeDef Init; /*!< SAI communication parameters */ |
bogdanm | 85:024bf7f99721 | 206 | |
emilmont | 77:869cf507173a | 207 | SAI_FrameInitTypeDef FrameInit; /*!< SAI Frame configuration parameters */ |
bogdanm | 85:024bf7f99721 | 208 | |
emilmont | 77:869cf507173a | 209 | SAI_SlotInitTypeDef SlotInit; /*!< SAI Slot configuration parameters */ |
bogdanm | 85:024bf7f99721 | 210 | |
Kojto | 99:dbbf35b96557 | 211 | uint8_t *pBuffPtr; /*!< Pointer to SAI transfer Buffer */ |
bogdanm | 85:024bf7f99721 | 212 | |
Kojto | 99:dbbf35b96557 | 213 | uint16_t XferSize; /*!< SAI transfer size */ |
bogdanm | 85:024bf7f99721 | 214 | |
Kojto | 99:dbbf35b96557 | 215 | uint16_t XferCount; /*!< SAI transfer counter */ |
bogdanm | 85:024bf7f99721 | 216 | |
bogdanm | 85:024bf7f99721 | 217 | DMA_HandleTypeDef *hdmatx; /*!< SAI Tx DMA handle parameters */ |
bogdanm | 85:024bf7f99721 | 218 | |
bogdanm | 85:024bf7f99721 | 219 | DMA_HandleTypeDef *hdmarx; /*!< SAI Rx DMA handle parameters */ |
emilmont | 77:869cf507173a | 220 | |
Kojto | 99:dbbf35b96557 | 221 | SAIcallback mutecallback;/*!< SAI mute callback */ |
Kojto | 99:dbbf35b96557 | 222 | |
Kojto | 99:dbbf35b96557 | 223 | void (*InterruptServiceRoutine)(struct __SAI_HandleTypeDef *hsai); /* function pointer for IRQ handler */ |
Kojto | 99:dbbf35b96557 | 224 | |
bogdanm | 85:024bf7f99721 | 225 | HAL_LockTypeDef Lock; /*!< SAI locking object */ |
bogdanm | 85:024bf7f99721 | 226 | |
bogdanm | 85:024bf7f99721 | 227 | __IO HAL_SAI_StateTypeDef State; /*!< SAI communication state */ |
bogdanm | 85:024bf7f99721 | 228 | |
bogdanm | 85:024bf7f99721 | 229 | __IO uint32_t ErrorCode; /*!< SAI Error code */ |
emilmont | 77:869cf507173a | 230 | }SAI_HandleTypeDef; |
emilmont | 77:869cf507173a | 231 | |
Kojto | 99:dbbf35b96557 | 232 | /** |
Kojto | 99:dbbf35b96557 | 233 | * @} |
Kojto | 99:dbbf35b96557 | 234 | */ |
Kojto | 99:dbbf35b96557 | 235 | |
emilmont | 77:869cf507173a | 236 | /* Exported constants --------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 237 | |
Kojto | 99:dbbf35b96557 | 238 | /** @defgroup SAI_Exported_Constants SAI Exported Constants |
Kojto | 99:dbbf35b96557 | 239 | * @{ |
Kojto | 99:dbbf35b96557 | 240 | */ |
Kojto | 99:dbbf35b96557 | 241 | |
Kojto | 99:dbbf35b96557 | 242 | /** @defgroup SAI_Error_Code SAI Error Code |
emilmont | 77:869cf507173a | 243 | * @{ |
emilmont | 77:869cf507173a | 244 | */ |
Kojto | 99:dbbf35b96557 | 245 | #define HAL_SAI_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */ |
Kojto | 99:dbbf35b96557 | 246 | #define HAL_SAI_ERROR_OVR ((uint32_t)0x00000001) /*!< Overrun Error */ |
Kojto | 99:dbbf35b96557 | 247 | #define HAL_SAI_ERROR_UDR ((uint32_t)0x00000002) /*!< Underrun error */ |
Kojto | 99:dbbf35b96557 | 248 | #define HAL_SAI_ERROR_AFSDET ((uint32_t)0x00000004) /*!< Anticipated Frame synchronisation detection */ |
Kojto | 99:dbbf35b96557 | 249 | #define HAL_SAI_ERROR_LFSDET ((uint32_t)0x00000008) /*!< Late Frame synchronisation detection */ |
Kojto | 99:dbbf35b96557 | 250 | #define HAL_SAI_ERROR_CNREADY ((uint32_t)0x00000010) /*!< codec not ready */ |
Kojto | 99:dbbf35b96557 | 251 | #define HAL_SAI_ERROR_WCKCFG ((uint32_t)0x00000020) /*!< Wrong clock configuration */ |
Kojto | 99:dbbf35b96557 | 252 | #define HAL_SAI_ERROR_TIMEOUT ((uint32_t)0x00000040) /*!< Timeout error */ |
Kojto | 99:dbbf35b96557 | 253 | /** |
Kojto | 99:dbbf35b96557 | 254 | * @} |
Kojto | 99:dbbf35b96557 | 255 | */ |
Kojto | 99:dbbf35b96557 | 256 | |
Kojto | 99:dbbf35b96557 | 257 | /** @defgroup SAI_Block_SyncExt SAI External synchronisation |
emilmont | 77:869cf507173a | 258 | * @{ |
Kojto | 99:dbbf35b96557 | 259 | */ |
Kojto | 99:dbbf35b96557 | 260 | #define SAI_SYNCEXT_DISABLE ((uint32_t)0x00000000) |
Kojto | 99:dbbf35b96557 | 261 | #define SAI_SYNCEXT_IN_ENABLE ((uint32_t)0x00000001) |
Kojto | 99:dbbf35b96557 | 262 | #define SAI_SYNCEXT_OUTBLOCKA_ENABLE ((uint32_t)0x00000002) |
Kojto | 99:dbbf35b96557 | 263 | #define SAI_SYNCEXT_OUTBLOCKB_ENABLE ((uint32_t)0x00000004) |
emilmont | 77:869cf507173a | 264 | /** |
emilmont | 77:869cf507173a | 265 | * @} |
emilmont | 77:869cf507173a | 266 | */ |
emilmont | 77:869cf507173a | 267 | |
Kojto | 99:dbbf35b96557 | 268 | /** @defgroup SAI_Protocol SAI Supported protocol |
emilmont | 77:869cf507173a | 269 | * @{ |
emilmont | 77:869cf507173a | 270 | */ |
Kojto | 99:dbbf35b96557 | 271 | #define SAI_I2S_STANDARD ((uint32_t)0x00000000) |
Kojto | 99:dbbf35b96557 | 272 | #define SAI_I2S_MSBJUSTIFIED ((uint32_t)0x00000001) |
Kojto | 99:dbbf35b96557 | 273 | #define SAI_I2S_LSBJUSTIFIED ((uint32_t)0x00000002) |
Kojto | 99:dbbf35b96557 | 274 | #define SAI_PCM_LONG ((uint32_t)0x00000004) |
Kojto | 99:dbbf35b96557 | 275 | #define SAI_PCM_SHORT ((uint32_t)0x00000008) |
emilmont | 77:869cf507173a | 276 | /** |
emilmont | 77:869cf507173a | 277 | * @} |
bogdanm | 85:024bf7f99721 | 278 | */ |
emilmont | 77:869cf507173a | 279 | |
Kojto | 99:dbbf35b96557 | 280 | /** @defgroup SAI_Protocol_DataSize SAI protocol data size |
Kojto | 99:dbbf35b96557 | 281 | * @{ |
Kojto | 99:dbbf35b96557 | 282 | */ |
Kojto | 99:dbbf35b96557 | 283 | #define SAI_PROTOCOL_DATASIZE_16BIT ((uint32_t)0x00000000) |
Kojto | 99:dbbf35b96557 | 284 | #define SAI_PROTOCOL_DATASIZE_16BITEXTENDED ((uint32_t)0x00000001) |
Kojto | 99:dbbf35b96557 | 285 | #define SAI_PROTOCOL_DATASIZE_24BIT ((uint32_t)0x00000002) |
Kojto | 99:dbbf35b96557 | 286 | #define SAI_PROTOCOL_DATASIZE_32BIT ((uint32_t)0x00000004) |
Kojto | 99:dbbf35b96557 | 287 | /** |
Kojto | 99:dbbf35b96557 | 288 | * @} |
Kojto | 99:dbbf35b96557 | 289 | */ |
Kojto | 99:dbbf35b96557 | 290 | |
Kojto | 99:dbbf35b96557 | 291 | /** @defgroup SAI_Clock_Source SAI Clock Source |
Kojto | 99:dbbf35b96557 | 292 | * @{ |
Kojto | 99:dbbf35b96557 | 293 | */ |
Kojto | 99:dbbf35b96557 | 294 | #define SAI_CLKSOURCE_PLLSAI ((uint32_t)0x00000000) |
Kojto | 99:dbbf35b96557 | 295 | #define SAI_CLKSOURCE_PLLI2S ((uint32_t)0x00100000) |
Kojto | 99:dbbf35b96557 | 296 | #define SAI_CLKSOURCE_EXT ((uint32_t)0x00200000) |
Kojto | 99:dbbf35b96557 | 297 | #define SAI_CLKSOURCE_NA ((uint32_t)0x00400000) /*!< No applicable for STM32F446xx */ |
Kojto | 99:dbbf35b96557 | 298 | /** |
Kojto | 99:dbbf35b96557 | 299 | * @} |
Kojto | 99:dbbf35b96557 | 300 | */ |
Kojto | 99:dbbf35b96557 | 301 | |
Kojto | 99:dbbf35b96557 | 302 | /** @defgroup SAI_Audio_Frequency SAI Audio Frequency |
emilmont | 77:869cf507173a | 303 | * @{ |
emilmont | 77:869cf507173a | 304 | */ |
emilmont | 77:869cf507173a | 305 | #define SAI_AUDIO_FREQUENCY_192K ((uint32_t)192000) |
emilmont | 77:869cf507173a | 306 | #define SAI_AUDIO_FREQUENCY_96K ((uint32_t)96000) |
emilmont | 77:869cf507173a | 307 | #define SAI_AUDIO_FREQUENCY_48K ((uint32_t)48000) |
emilmont | 77:869cf507173a | 308 | #define SAI_AUDIO_FREQUENCY_44K ((uint32_t)44100) |
emilmont | 77:869cf507173a | 309 | #define SAI_AUDIO_FREQUENCY_32K ((uint32_t)32000) |
emilmont | 77:869cf507173a | 310 | #define SAI_AUDIO_FREQUENCY_22K ((uint32_t)22050) |
emilmont | 77:869cf507173a | 311 | #define SAI_AUDIO_FREQUENCY_16K ((uint32_t)16000) |
emilmont | 77:869cf507173a | 312 | #define SAI_AUDIO_FREQUENCY_11K ((uint32_t)11025) |
Kojto | 99:dbbf35b96557 | 313 | #define SAI_AUDIO_FREQUENCY_8K ((uint32_t)8000) |
Kojto | 99:dbbf35b96557 | 314 | #define SAI_AUDIO_FREQUENCY_MCKDIV ((uint32_t)0) |
emilmont | 77:869cf507173a | 315 | |
emilmont | 77:869cf507173a | 316 | /** |
emilmont | 77:869cf507173a | 317 | * @} |
emilmont | 77:869cf507173a | 318 | */ |
emilmont | 77:869cf507173a | 319 | |
Kojto | 99:dbbf35b96557 | 320 | /** @defgroup SAI_Block_Mode SAI Block Mode |
emilmont | 77:869cf507173a | 321 | * @{ |
emilmont | 77:869cf507173a | 322 | */ |
emilmont | 77:869cf507173a | 323 | #define SAI_MODEMASTER_TX ((uint32_t)0x00000000) |
Kojto | 99:dbbf35b96557 | 324 | #define SAI_MODEMASTER_RX ((uint32_t)SAI_xCR1_MODE_0) |
Kojto | 99:dbbf35b96557 | 325 | #define SAI_MODESLAVE_TX ((uint32_t)SAI_xCR1_MODE_1) |
Kojto | 99:dbbf35b96557 | 326 | #define SAI_MODESLAVE_RX ((uint32_t)(SAI_xCR1_MODE_1 | SAI_xCR1_MODE_0)) |
Kojto | 99:dbbf35b96557 | 327 | |
emilmont | 77:869cf507173a | 328 | /** |
emilmont | 77:869cf507173a | 329 | * @} |
emilmont | 77:869cf507173a | 330 | */ |
emilmont | 77:869cf507173a | 331 | |
Kojto | 99:dbbf35b96557 | 332 | /** @defgroup SAI_Block_Protocol SAI Block Protocol |
emilmont | 77:869cf507173a | 333 | * @{ |
emilmont | 77:869cf507173a | 334 | */ |
emilmont | 77:869cf507173a | 335 | #define SAI_FREE_PROTOCOL ((uint32_t)0x00000000) |
Kojto | 99:dbbf35b96557 | 336 | #define SAI_SPDIF_PROTOCOL ((uint32_t)SAI_xCR1_PRTCFG_0) |
emilmont | 77:869cf507173a | 337 | #define SAI_AC97_PROTOCOL ((uint32_t)SAI_xCR1_PRTCFG_1) |
emilmont | 77:869cf507173a | 338 | |
emilmont | 77:869cf507173a | 339 | /** |
emilmont | 77:869cf507173a | 340 | * @} |
emilmont | 77:869cf507173a | 341 | */ |
emilmont | 77:869cf507173a | 342 | |
Kojto | 99:dbbf35b96557 | 343 | /** @defgroup SAI_Block_Data_Size SAI Block Data Size |
emilmont | 77:869cf507173a | 344 | * @{ |
emilmont | 77:869cf507173a | 345 | */ |
Kojto | 99:dbbf35b96557 | 346 | #define SAI_DATASIZE_8 ((uint32_t)SAI_xCR1_DS_1) |
Kojto | 99:dbbf35b96557 | 347 | #define SAI_DATASIZE_10 ((uint32_t)(SAI_xCR1_DS_1 | SAI_xCR1_DS_0)) |
Kojto | 99:dbbf35b96557 | 348 | #define SAI_DATASIZE_16 ((uint32_t)SAI_xCR1_DS_2) |
Kojto | 99:dbbf35b96557 | 349 | #define SAI_DATASIZE_20 ((uint32_t)(SAI_xCR1_DS_2 | SAI_xCR1_DS_0)) |
Kojto | 99:dbbf35b96557 | 350 | #define SAI_DATASIZE_24 ((uint32_t)(SAI_xCR1_DS_2 | SAI_xCR1_DS_1)) |
Kojto | 99:dbbf35b96557 | 351 | #define SAI_DATASIZE_32 ((uint32_t)(SAI_xCR1_DS_2 | SAI_xCR1_DS_1 | SAI_xCR1_DS_0)) |
emilmont | 77:869cf507173a | 352 | |
emilmont | 77:869cf507173a | 353 | /** |
emilmont | 77:869cf507173a | 354 | * @} |
emilmont | 77:869cf507173a | 355 | */ |
emilmont | 77:869cf507173a | 356 | |
Kojto | 99:dbbf35b96557 | 357 | /** @defgroup SAI_Block_MSB_LSB_transmission SAI Block MSB LSB transmission |
emilmont | 77:869cf507173a | 358 | * @{ |
emilmont | 77:869cf507173a | 359 | */ |
emilmont | 77:869cf507173a | 360 | #define SAI_FIRSTBIT_MSB ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 361 | #define SAI_FIRSTBIT_LSB ((uint32_t)SAI_xCR1_LSBFIRST) |
emilmont | 77:869cf507173a | 362 | |
emilmont | 77:869cf507173a | 363 | /** |
emilmont | 77:869cf507173a | 364 | * @} |
emilmont | 77:869cf507173a | 365 | */ |
emilmont | 77:869cf507173a | 366 | |
Kojto | 99:dbbf35b96557 | 367 | /** @defgroup SAI_Block_Clock_Strobing SAI Block Clock Strobing |
emilmont | 77:869cf507173a | 368 | * @{ |
emilmont | 77:869cf507173a | 369 | */ |
emilmont | 77:869cf507173a | 370 | #define SAI_CLOCKSTROBING_FALLINGEDGE ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 371 | #define SAI_CLOCKSTROBING_RISINGEDGE ((uint32_t)SAI_xCR1_CKSTR) |
emilmont | 77:869cf507173a | 372 | |
emilmont | 77:869cf507173a | 373 | /** |
emilmont | 77:869cf507173a | 374 | * @} |
emilmont | 77:869cf507173a | 375 | */ |
emilmont | 77:869cf507173a | 376 | |
Kojto | 99:dbbf35b96557 | 377 | /** @defgroup SAI_Block_Synchronization SAI Block Synchronization |
emilmont | 77:869cf507173a | 378 | * @{ |
emilmont | 77:869cf507173a | 379 | */ |
emilmont | 77:869cf507173a | 380 | #define SAI_ASYNCHRONOUS ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 381 | #define SAI_SYNCHRONOUS ((uint32_t)SAI_xCR1_SYNCEN_0) |
Kojto | 99:dbbf35b96557 | 382 | #define SAI_SYNCHRONOUS_EXT ((uint32_t)SAI_xCR1_SYNCEN_1) |
emilmont | 77:869cf507173a | 383 | |
emilmont | 77:869cf507173a | 384 | /** |
emilmont | 77:869cf507173a | 385 | * @} |
emilmont | 77:869cf507173a | 386 | */ |
emilmont | 77:869cf507173a | 387 | |
Kojto | 99:dbbf35b96557 | 388 | /** @defgroup SAI_Block_Output_Drive SAI Block Output Drive |
emilmont | 77:869cf507173a | 389 | * @{ |
emilmont | 77:869cf507173a | 390 | */ |
Kojto | 99:dbbf35b96557 | 391 | #define SAI_OUTPUTDRIVE_DISABLE ((uint32_t)0x00000000) |
Kojto | 99:dbbf35b96557 | 392 | #define SAI_OUTPUTDRIVE_ENABLE ((uint32_t)SAI_xCR1_OUTDRIV) |
Kojto | 99:dbbf35b96557 | 393 | |
Kojto | 99:dbbf35b96557 | 394 | /** |
Kojto | 99:dbbf35b96557 | 395 | * @} |
Kojto | 99:dbbf35b96557 | 396 | */ |
emilmont | 77:869cf507173a | 397 | |
Kojto | 99:dbbf35b96557 | 398 | /** @defgroup SAI_Block_NoDivider SAI Block NoDivider |
Kojto | 99:dbbf35b96557 | 399 | * @{ |
Kojto | 99:dbbf35b96557 | 400 | */ |
Kojto | 99:dbbf35b96557 | 401 | #define SAI_MASTERDIVIDER_ENABLE ((uint32_t)0x00000000) |
Kojto | 99:dbbf35b96557 | 402 | #define SAI_MASTERDIVIDER_DISABLE ((uint32_t)SAI_xCR1_NODIV) |
Kojto | 99:dbbf35b96557 | 403 | |
emilmont | 77:869cf507173a | 404 | /** |
emilmont | 77:869cf507173a | 405 | * @} |
emilmont | 77:869cf507173a | 406 | */ |
emilmont | 77:869cf507173a | 407 | |
emilmont | 77:869cf507173a | 408 | |
Kojto | 99:dbbf35b96557 | 409 | /** @defgroup SAI_Block_FS_Definition SAI Block FS Definition |
emilmont | 77:869cf507173a | 410 | * @{ |
emilmont | 77:869cf507173a | 411 | */ |
emilmont | 77:869cf507173a | 412 | #define SAI_FS_STARTFRAME ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 413 | #define SAI_FS_CHANNEL_IDENTIFICATION ((uint32_t)SAI_xFRCR_FSDEF) |
emilmont | 77:869cf507173a | 414 | |
emilmont | 77:869cf507173a | 415 | /** |
emilmont | 77:869cf507173a | 416 | * @} |
emilmont | 77:869cf507173a | 417 | */ |
emilmont | 77:869cf507173a | 418 | |
Kojto | 99:dbbf35b96557 | 419 | /** @defgroup SAI_Block_FS_Polarity SAI Block FS Polarity |
emilmont | 77:869cf507173a | 420 | * @{ |
emilmont | 77:869cf507173a | 421 | */ |
emilmont | 77:869cf507173a | 422 | #define SAI_FS_ACTIVE_LOW ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 423 | #define SAI_FS_ACTIVE_HIGH ((uint32_t)SAI_xFRCR_FSPO) |
emilmont | 77:869cf507173a | 424 | |
emilmont | 77:869cf507173a | 425 | /** |
emilmont | 77:869cf507173a | 426 | * @} |
emilmont | 77:869cf507173a | 427 | */ |
emilmont | 77:869cf507173a | 428 | |
Kojto | 99:dbbf35b96557 | 429 | /** @defgroup SAI_Block_FS_Offset SAI Block FS Offset |
emilmont | 77:869cf507173a | 430 | * @{ |
emilmont | 77:869cf507173a | 431 | */ |
emilmont | 77:869cf507173a | 432 | #define SAI_FS_FIRSTBIT ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 433 | #define SAI_FS_BEFOREFIRSTBIT ((uint32_t)SAI_xFRCR_FSOFF) |
emilmont | 77:869cf507173a | 434 | |
emilmont | 77:869cf507173a | 435 | /** |
emilmont | 77:869cf507173a | 436 | * @} |
emilmont | 77:869cf507173a | 437 | */ |
emilmont | 77:869cf507173a | 438 | |
emilmont | 77:869cf507173a | 439 | |
Kojto | 99:dbbf35b96557 | 440 | /** @defgroup SAI_Block_Slot_Size SAI Block Slot Size |
emilmont | 77:869cf507173a | 441 | * @{ |
emilmont | 77:869cf507173a | 442 | */ |
emilmont | 77:869cf507173a | 443 | #define SAI_SLOTSIZE_DATASIZE ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 444 | #define SAI_SLOTSIZE_16B ((uint32_t)SAI_xSLOTR_SLOTSZ_0) |
emilmont | 77:869cf507173a | 445 | #define SAI_SLOTSIZE_32B ((uint32_t)SAI_xSLOTR_SLOTSZ_1) |
emilmont | 77:869cf507173a | 446 | /** |
emilmont | 77:869cf507173a | 447 | * @} |
emilmont | 77:869cf507173a | 448 | */ |
emilmont | 77:869cf507173a | 449 | |
Kojto | 99:dbbf35b96557 | 450 | /** @defgroup SAI_Block_Slot_Active SAI Block Slot Active |
emilmont | 77:869cf507173a | 451 | * @{ |
emilmont | 77:869cf507173a | 452 | */ |
bogdanm | 85:024bf7f99721 | 453 | #define SAI_SLOT_NOTACTIVE ((uint32_t)0x00000000) |
bogdanm | 85:024bf7f99721 | 454 | #define SAI_SLOTACTIVE_0 ((uint32_t)0x00010000) |
emilmont | 77:869cf507173a | 455 | #define SAI_SLOTACTIVE_1 ((uint32_t)0x00020000) |
emilmont | 77:869cf507173a | 456 | #define SAI_SLOTACTIVE_2 ((uint32_t)0x00040000) |
emilmont | 77:869cf507173a | 457 | #define SAI_SLOTACTIVE_3 ((uint32_t)0x00080000) |
emilmont | 77:869cf507173a | 458 | #define SAI_SLOTACTIVE_4 ((uint32_t)0x00100000) |
emilmont | 77:869cf507173a | 459 | #define SAI_SLOTACTIVE_5 ((uint32_t)0x00200000) |
emilmont | 77:869cf507173a | 460 | #define SAI_SLOTACTIVE_6 ((uint32_t)0x00400000) |
emilmont | 77:869cf507173a | 461 | #define SAI_SLOTACTIVE_7 ((uint32_t)0x00800000) |
emilmont | 77:869cf507173a | 462 | #define SAI_SLOTACTIVE_8 ((uint32_t)0x01000000) |
emilmont | 77:869cf507173a | 463 | #define SAI_SLOTACTIVE_9 ((uint32_t)0x02000000) |
emilmont | 77:869cf507173a | 464 | #define SAI_SLOTACTIVE_10 ((uint32_t)0x04000000) |
emilmont | 77:869cf507173a | 465 | #define SAI_SLOTACTIVE_11 ((uint32_t)0x08000000) |
emilmont | 77:869cf507173a | 466 | #define SAI_SLOTACTIVE_12 ((uint32_t)0x10000000) |
emilmont | 77:869cf507173a | 467 | #define SAI_SLOTACTIVE_13 ((uint32_t)0x20000000) |
emilmont | 77:869cf507173a | 468 | #define SAI_SLOTACTIVE_14 ((uint32_t)0x40000000) |
emilmont | 77:869cf507173a | 469 | #define SAI_SLOTACTIVE_15 ((uint32_t)0x80000000) |
emilmont | 77:869cf507173a | 470 | #define SAI_SLOTACTIVE_ALL ((uint32_t)0xFFFF0000) |
emilmont | 77:869cf507173a | 471 | |
Kojto | 99:dbbf35b96557 | 472 | /** |
Kojto | 99:dbbf35b96557 | 473 | * @} |
Kojto | 99:dbbf35b96557 | 474 | */ |
Kojto | 99:dbbf35b96557 | 475 | |
Kojto | 99:dbbf35b96557 | 476 | /** @defgroup SAI_Mono_Stereo_Mode SAI Mono Stereo Mode |
Kojto | 99:dbbf35b96557 | 477 | * @{ |
Kojto | 99:dbbf35b96557 | 478 | */ |
Kojto | 99:dbbf35b96557 | 479 | #define SAI_STEREOMODE ((uint32_t)0x00000000) |
Kojto | 99:dbbf35b96557 | 480 | #define SAI_MONOMODE ((uint32_t)SAI_xCR1_MONO) |
emilmont | 77:869cf507173a | 481 | |
emilmont | 77:869cf507173a | 482 | /** |
emilmont | 77:869cf507173a | 483 | * @} |
emilmont | 77:869cf507173a | 484 | */ |
emilmont | 77:869cf507173a | 485 | |
Kojto | 99:dbbf35b96557 | 486 | /** @defgroup SAI_TRIState_Management SAI TRIState Management |
emilmont | 77:869cf507173a | 487 | * @{ |
emilmont | 77:869cf507173a | 488 | */ |
emilmont | 77:869cf507173a | 489 | #define SAI_OUTPUT_NOTRELEASED ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 490 | #define SAI_OUTPUT_RELEASED ((uint32_t)SAI_xCR2_TRIS) |
emilmont | 77:869cf507173a | 491 | |
emilmont | 77:869cf507173a | 492 | /** |
emilmont | 77:869cf507173a | 493 | * @} |
emilmont | 77:869cf507173a | 494 | */ |
emilmont | 77:869cf507173a | 495 | |
Kojto | 99:dbbf35b96557 | 496 | /** @defgroup SAI_Block_Fifo_Threshold SAI Block Fifo Threshold |
emilmont | 77:869cf507173a | 497 | * @{ |
emilmont | 77:869cf507173a | 498 | */ |
emilmont | 77:869cf507173a | 499 | #define SAI_FIFOTHRESHOLD_EMPTY ((uint32_t)0x00000000) |
Kojto | 99:dbbf35b96557 | 500 | #define SAI_FIFOTHRESHOLD_1QF ((uint32_t)SAI_xCR2_FTH_0) |
Kojto | 99:dbbf35b96557 | 501 | #define SAI_FIFOTHRESHOLD_HF ((uint32_t)SAI_xCR2_FTH_1) |
Kojto | 99:dbbf35b96557 | 502 | #define SAI_FIFOTHRESHOLD_3QF ((uint32_t)(SAI_xCR2_FTH_1 | SAI_xCR2_FTH_0)) |
Kojto | 99:dbbf35b96557 | 503 | #define SAI_FIFOTHRESHOLD_FULL ((uint32_t)SAI_xCR2_FTH_2) |
emilmont | 77:869cf507173a | 504 | |
emilmont | 77:869cf507173a | 505 | /** |
emilmont | 77:869cf507173a | 506 | * @} |
emilmont | 77:869cf507173a | 507 | */ |
emilmont | 77:869cf507173a | 508 | |
Kojto | 99:dbbf35b96557 | 509 | /** @defgroup SAI_Block_Companding_Mode SAI Block Companding Mode |
emilmont | 77:869cf507173a | 510 | * @{ |
emilmont | 77:869cf507173a | 511 | */ |
emilmont | 77:869cf507173a | 512 | #define SAI_NOCOMPANDING ((uint32_t)0x00000000) |
Kojto | 99:dbbf35b96557 | 513 | #define SAI_ULAW_1CPL_COMPANDING ((uint32_t)SAI_xCR2_COMP_1) |
Kojto | 99:dbbf35b96557 | 514 | #define SAI_ALAW_1CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1 | SAI_xCR2_COMP_0)) |
Kojto | 99:dbbf35b96557 | 515 | #define SAI_ULAW_2CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1 | SAI_xCR2_CPL)) |
Kojto | 99:dbbf35b96557 | 516 | #define SAI_ALAW_2CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1 | SAI_xCR2_COMP_0 | SAI_xCR2_CPL)) |
emilmont | 77:869cf507173a | 517 | |
emilmont | 77:869cf507173a | 518 | /** |
emilmont | 77:869cf507173a | 519 | * @} |
emilmont | 77:869cf507173a | 520 | */ |
emilmont | 77:869cf507173a | 521 | |
Kojto | 99:dbbf35b96557 | 522 | /** @defgroup SAI_Block_Mute_Value SAI Block Mute Value |
emilmont | 77:869cf507173a | 523 | * @{ |
emilmont | 77:869cf507173a | 524 | */ |
emilmont | 77:869cf507173a | 525 | #define SAI_ZERO_VALUE ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 526 | #define SAI_LAST_SENT_VALUE ((uint32_t)SAI_xCR2_MUTEVAL) |
emilmont | 77:869cf507173a | 527 | |
emilmont | 77:869cf507173a | 528 | /** |
emilmont | 77:869cf507173a | 529 | * @} |
emilmont | 77:869cf507173a | 530 | */ |
emilmont | 77:869cf507173a | 531 | |
emilmont | 77:869cf507173a | 532 | |
Kojto | 99:dbbf35b96557 | 533 | /** @defgroup SAI_Block_Interrupts_Definition SAI Block Interrupts Definition |
emilmont | 77:869cf507173a | 534 | * @{ |
emilmont | 77:869cf507173a | 535 | */ |
emilmont | 77:869cf507173a | 536 | #define SAI_IT_OVRUDR ((uint32_t)SAI_xIMR_OVRUDRIE) |
emilmont | 77:869cf507173a | 537 | #define SAI_IT_MUTEDET ((uint32_t)SAI_xIMR_MUTEDETIE) |
emilmont | 77:869cf507173a | 538 | #define SAI_IT_WCKCFG ((uint32_t)SAI_xIMR_WCKCFGIE) |
emilmont | 77:869cf507173a | 539 | #define SAI_IT_FREQ ((uint32_t)SAI_xIMR_FREQIE) |
emilmont | 77:869cf507173a | 540 | #define SAI_IT_CNRDY ((uint32_t)SAI_xIMR_CNRDYIE) |
emilmont | 77:869cf507173a | 541 | #define SAI_IT_AFSDET ((uint32_t)SAI_xIMR_AFSDETIE) |
emilmont | 77:869cf507173a | 542 | #define SAI_IT_LFSDET ((uint32_t)SAI_xIMR_LFSDETIE) |
emilmont | 77:869cf507173a | 543 | |
emilmont | 77:869cf507173a | 544 | /** |
emilmont | 77:869cf507173a | 545 | * @} |
emilmont | 77:869cf507173a | 546 | */ |
emilmont | 77:869cf507173a | 547 | |
Kojto | 99:dbbf35b96557 | 548 | /** @defgroup SAI_Block_Flags_Definition SAI Block Flags Definition |
emilmont | 77:869cf507173a | 549 | * @{ |
emilmont | 77:869cf507173a | 550 | */ |
emilmont | 77:869cf507173a | 551 | #define SAI_FLAG_OVRUDR ((uint32_t)SAI_xSR_OVRUDR) |
emilmont | 77:869cf507173a | 552 | #define SAI_FLAG_MUTEDET ((uint32_t)SAI_xSR_MUTEDET) |
emilmont | 77:869cf507173a | 553 | #define SAI_FLAG_WCKCFG ((uint32_t)SAI_xSR_WCKCFG) |
emilmont | 77:869cf507173a | 554 | #define SAI_FLAG_FREQ ((uint32_t)SAI_xSR_FREQ) |
emilmont | 77:869cf507173a | 555 | #define SAI_FLAG_CNRDY ((uint32_t)SAI_xSR_CNRDY) |
emilmont | 77:869cf507173a | 556 | #define SAI_FLAG_AFSDET ((uint32_t)SAI_xSR_AFSDET) |
emilmont | 77:869cf507173a | 557 | #define SAI_FLAG_LFSDET ((uint32_t)SAI_xSR_LFSDET) |
emilmont | 77:869cf507173a | 558 | |
emilmont | 77:869cf507173a | 559 | /** |
emilmont | 77:869cf507173a | 560 | * @} |
emilmont | 77:869cf507173a | 561 | */ |
emilmont | 77:869cf507173a | 562 | |
Kojto | 99:dbbf35b96557 | 563 | /** @defgroup SAI_Block_Fifo_Status_Level SAI Block Fifo Status Level |
emilmont | 77:869cf507173a | 564 | * @{ |
emilmont | 77:869cf507173a | 565 | */ |
Kojto | 99:dbbf35b96557 | 566 | #define SAI_FIFOSTATUS_EMPTY ((uint32_t)0x00000000) |
Kojto | 99:dbbf35b96557 | 567 | #define SAI_FIFOSTATUS_LESS1QUARTERFULL ((uint32_t)0x00010000) |
Kojto | 99:dbbf35b96557 | 568 | #define SAI_FIFOSTATUS_1QUARTERFULL ((uint32_t)0x00020000) |
Kojto | 99:dbbf35b96557 | 569 | #define SAI_FIFOSTATUS_HALFFULL ((uint32_t)0x00030000) |
Kojto | 99:dbbf35b96557 | 570 | #define SAI_FIFOSTATUS_3QUARTERFULL ((uint32_t)0x00040000) |
Kojto | 99:dbbf35b96557 | 571 | #define SAI_FIFOSTATUS_FULL ((uint32_t)0x00050000) |
emilmont | 77:869cf507173a | 572 | |
emilmont | 77:869cf507173a | 573 | /** |
emilmont | 77:869cf507173a | 574 | * @} |
emilmont | 77:869cf507173a | 575 | */ |
emilmont | 77:869cf507173a | 576 | |
emilmont | 77:869cf507173a | 577 | /** |
emilmont | 77:869cf507173a | 578 | * @} |
emilmont | 77:869cf507173a | 579 | */ |
emilmont | 77:869cf507173a | 580 | |
emilmont | 77:869cf507173a | 581 | /* Exported macro ------------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 582 | |
Kojto | 99:dbbf35b96557 | 583 | /** @defgroup SAI_Exported_Macros SAI Exported Macros |
Kojto | 99:dbbf35b96557 | 584 | * @brief macros to handle interrupts and specific configurations |
Kojto | 99:dbbf35b96557 | 585 | * @{ |
Kojto | 99:dbbf35b96557 | 586 | */ |
Kojto | 99:dbbf35b96557 | 587 | |
bogdanm | 85:024bf7f99721 | 588 | /** @brief Reset SAI handle state |
bogdanm | 85:024bf7f99721 | 589 | * @param __HANDLE__: specifies the SAI Handle. |
bogdanm | 85:024bf7f99721 | 590 | * @retval None |
bogdanm | 85:024bf7f99721 | 591 | */ |
bogdanm | 85:024bf7f99721 | 592 | #define __HAL_SAI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SAI_STATE_RESET) |
emilmont | 77:869cf507173a | 593 | |
emilmont | 77:869cf507173a | 594 | /** @brief Enable or disable the specified SAI interrupts. |
emilmont | 77:869cf507173a | 595 | * @param __HANDLE__: specifies the SAI Handle. |
emilmont | 77:869cf507173a | 596 | * @param __INTERRUPT__: specifies the interrupt source to enable or disable. |
emilmont | 77:869cf507173a | 597 | * This parameter can be one of the following values: |
emilmont | 77:869cf507173a | 598 | * @arg SAI_IT_OVRUDR: Overrun underrun interrupt enable |
emilmont | 77:869cf507173a | 599 | * @arg SAI_IT_MUTEDET: Mute detection interrupt enable |
emilmont | 77:869cf507173a | 600 | * @arg SAI_IT_WCKCFG: Wrong Clock Configuration interrupt enable |
emilmont | 77:869cf507173a | 601 | * @arg SAI_IT_FREQ: FIFO request interrupt enable |
emilmont | 77:869cf507173a | 602 | * @arg SAI_IT_CNRDY: Codec not ready interrupt enable |
emilmont | 77:869cf507173a | 603 | * @arg SAI_IT_AFSDET: Anticipated frame synchronization detection interrupt enable |
emilmont | 77:869cf507173a | 604 | * @arg SAI_IT_LFSDET: Late frame synchronization detection interrupt enabl |
emilmont | 77:869cf507173a | 605 | * @retval None |
emilmont | 77:869cf507173a | 606 | */ |
emilmont | 77:869cf507173a | 607 | |
emilmont | 77:869cf507173a | 608 | #define __HAL_SAI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IMR |= (__INTERRUPT__)) |
emilmont | 77:869cf507173a | 609 | #define __HAL_SAI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IMR &= (~(__INTERRUPT__))) |
emilmont | 77:869cf507173a | 610 | |
emilmont | 77:869cf507173a | 611 | /** @brief Check if the specified SAI interrupt source is enabled or disabled. |
emilmont | 77:869cf507173a | 612 | * @param __HANDLE__: specifies the SAI Handle. |
emilmont | 77:869cf507173a | 613 | * This parameter can be SAI where x: 1, 2, or 3 to select the SAI peripheral. |
emilmont | 77:869cf507173a | 614 | * @param __INTERRUPT__: specifies the SAI interrupt source to check. |
emilmont | 77:869cf507173a | 615 | * This parameter can be one of the following values: |
emilmont | 77:869cf507173a | 616 | * @arg SAI_IT_TXE: Tx buffer empty interrupt enable. |
emilmont | 77:869cf507173a | 617 | * @arg SAI_IT_RXNE: Rx buffer not empty interrupt enable. |
emilmont | 77:869cf507173a | 618 | * @arg SAI_IT_ERR: Error interrupt enable. |
emilmont | 77:869cf507173a | 619 | * @retval The new state of __INTERRUPT__ (TRUE or FALSE). |
emilmont | 77:869cf507173a | 620 | */ |
emilmont | 77:869cf507173a | 621 | #define __HAL_SAI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IMR & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) |
emilmont | 77:869cf507173a | 622 | |
emilmont | 77:869cf507173a | 623 | /** @brief Check whether the specified SAI flag is set or not. |
emilmont | 77:869cf507173a | 624 | * @param __HANDLE__: specifies the SAI Handle. |
emilmont | 77:869cf507173a | 625 | * @param __FLAG__: specifies the flag to check. |
emilmont | 77:869cf507173a | 626 | * This parameter can be one of the following values: |
emilmont | 77:869cf507173a | 627 | * @arg SAI_FLAG_OVRUDR: Overrun underrun flag. |
emilmont | 77:869cf507173a | 628 | * @arg SAI_FLAG_MUTEDET: Mute detection flag. |
emilmont | 77:869cf507173a | 629 | * @arg SAI_FLAG_WCKCFG: Wrong Clock Configuration flag. |
emilmont | 77:869cf507173a | 630 | * @arg SAI_FLAG_FREQ: FIFO request flag. |
emilmont | 77:869cf507173a | 631 | * @arg SAI_FLAG_CNRDY: Codec not ready flag. |
emilmont | 77:869cf507173a | 632 | * @arg SAI_FLAG_AFSDET: Anticipated frame synchronization detection flag. |
emilmont | 77:869cf507173a | 633 | * @arg SAI_FLAG_LFSDET: Late frame synchronization detection flag. |
emilmont | 77:869cf507173a | 634 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
emilmont | 77:869cf507173a | 635 | */ |
emilmont | 77:869cf507173a | 636 | #define __HAL_SAI_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__)) |
emilmont | 77:869cf507173a | 637 | |
emilmont | 77:869cf507173a | 638 | /** @brief Clears the specified SAI pending flag. |
emilmont | 77:869cf507173a | 639 | * @param __HANDLE__: specifies the SAI Handle. |
emilmont | 77:869cf507173a | 640 | * @param __FLAG__: specifies the flag to check. |
emilmont | 77:869cf507173a | 641 | * This parameter can be any combination of the following values: |
emilmont | 77:869cf507173a | 642 | * @arg SAI_FLAG_OVRUDR: Clear Overrun underrun |
emilmont | 77:869cf507173a | 643 | * @arg SAI_FLAG_MUTEDET: Clear Mute detection |
emilmont | 77:869cf507173a | 644 | * @arg SAI_FLAG_WCKCFG: Clear Wrong Clock Configuration |
emilmont | 77:869cf507173a | 645 | * @arg SAI_FLAG_FREQ: Clear FIFO request |
emilmont | 77:869cf507173a | 646 | * @arg SAI_FLAG_CNRDY: Clear Codec not ready |
emilmont | 77:869cf507173a | 647 | * @arg SAI_FLAG_AFSDET: Clear Anticipated frame synchronization detection |
emilmont | 77:869cf507173a | 648 | * @arg SAI_FLAG_LFSDET: Clear Late frame synchronization detection |
emilmont | 77:869cf507173a | 649 | * |
emilmont | 77:869cf507173a | 650 | * @retval None |
emilmont | 77:869cf507173a | 651 | */ |
Kojto | 90:cb3d968589d8 | 652 | #define __HAL_SAI_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CLRFR = (__FLAG__)) |
emilmont | 77:869cf507173a | 653 | |
emilmont | 77:869cf507173a | 654 | #define __HAL_SAI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= SAI_xCR1_SAIEN) |
emilmont | 77:869cf507173a | 655 | #define __HAL_SAI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~SAI_xCR1_SAIEN) |
Kojto | 99:dbbf35b96557 | 656 | |
Kojto | 99:dbbf35b96557 | 657 | /** |
Kojto | 99:dbbf35b96557 | 658 | * @} |
Kojto | 99:dbbf35b96557 | 659 | */ |
Kojto | 99:dbbf35b96557 | 660 | |
Kojto | 99:dbbf35b96557 | 661 | /* Include RCC SAI Extension module */ |
Kojto | 99:dbbf35b96557 | 662 | #include "stm32f4xx_hal_sai_ex.h" |
Kojto | 99:dbbf35b96557 | 663 | |
emilmont | 77:869cf507173a | 664 | /* Exported functions --------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 665 | |
Kojto | 99:dbbf35b96557 | 666 | /** @addtogroup SAI_Exported_Functions |
Kojto | 99:dbbf35b96557 | 667 | * @{ |
Kojto | 99:dbbf35b96557 | 668 | */ |
Kojto | 99:dbbf35b96557 | 669 | |
emilmont | 77:869cf507173a | 670 | /* Initialization/de-initialization functions **********************************/ |
Kojto | 99:dbbf35b96557 | 671 | /** @addtogroup SAI_Exported_Functions_Group1 |
Kojto | 99:dbbf35b96557 | 672 | * @{ |
Kojto | 99:dbbf35b96557 | 673 | */ |
Kojto | 110:165afa46840b | 674 | HAL_StatusTypeDef HAL_SAI_InitProtocol(SAI_HandleTypeDef *hsai, uint32_t protocol, uint32_t datasize, uint32_t nbslot); |
emilmont | 77:869cf507173a | 675 | HAL_StatusTypeDef HAL_SAI_Init(SAI_HandleTypeDef *hsai); |
emilmont | 77:869cf507173a | 676 | HAL_StatusTypeDef HAL_SAI_DeInit (SAI_HandleTypeDef *hsai); |
emilmont | 77:869cf507173a | 677 | void HAL_SAI_MspInit(SAI_HandleTypeDef *hsai); |
emilmont | 77:869cf507173a | 678 | void HAL_SAI_MspDeInit(SAI_HandleTypeDef *hsai); |
emilmont | 77:869cf507173a | 679 | |
Kojto | 99:dbbf35b96557 | 680 | /** |
Kojto | 99:dbbf35b96557 | 681 | * @} |
Kojto | 99:dbbf35b96557 | 682 | */ |
Kojto | 99:dbbf35b96557 | 683 | |
emilmont | 77:869cf507173a | 684 | /* I/O operation functions *****************************************************/ |
Kojto | 99:dbbf35b96557 | 685 | /** @addtogroup SAI_Exported_Functions_Group2 |
Kojto | 99:dbbf35b96557 | 686 | * @{ |
Kojto | 99:dbbf35b96557 | 687 | */ |
emilmont | 77:869cf507173a | 688 | /* Blocking mode: Polling */ |
Kojto | 99:dbbf35b96557 | 689 | HAL_StatusTypeDef HAL_SAI_Transmit(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 99:dbbf35b96557 | 690 | HAL_StatusTypeDef HAL_SAI_Receive(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
emilmont | 77:869cf507173a | 691 | |
emilmont | 77:869cf507173a | 692 | /* Non-Blocking mode: Interrupt */ |
Kojto | 99:dbbf35b96557 | 693 | HAL_StatusTypeDef HAL_SAI_Transmit_IT(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size); |
Kojto | 99:dbbf35b96557 | 694 | HAL_StatusTypeDef HAL_SAI_Receive_IT(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size); |
emilmont | 77:869cf507173a | 695 | |
emilmont | 77:869cf507173a | 696 | /* Non-Blocking mode: DMA */ |
Kojto | 99:dbbf35b96557 | 697 | HAL_StatusTypeDef HAL_SAI_Transmit_DMA(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size); |
Kojto | 99:dbbf35b96557 | 698 | HAL_StatusTypeDef HAL_SAI_Receive_DMA(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size); |
emilmont | 77:869cf507173a | 699 | HAL_StatusTypeDef HAL_SAI_DMAPause(SAI_HandleTypeDef *hsai); |
emilmont | 77:869cf507173a | 700 | HAL_StatusTypeDef HAL_SAI_DMAResume(SAI_HandleTypeDef *hsai); |
emilmont | 77:869cf507173a | 701 | HAL_StatusTypeDef HAL_SAI_DMAStop(SAI_HandleTypeDef *hsai); |
emilmont | 77:869cf507173a | 702 | |
Kojto | 99:dbbf35b96557 | 703 | /* Abort function */ |
Kojto | 99:dbbf35b96557 | 704 | HAL_StatusTypeDef HAL_SAI_Abort(SAI_HandleTypeDef *hsai); |
Kojto | 99:dbbf35b96557 | 705 | |
Kojto | 99:dbbf35b96557 | 706 | /* Mute management */ |
Kojto | 99:dbbf35b96557 | 707 | HAL_StatusTypeDef HAL_SAI_EnableTxMuteMode(SAI_HandleTypeDef *hsai, uint16_t val); |
Kojto | 99:dbbf35b96557 | 708 | HAL_StatusTypeDef HAL_SAI_DisableTxMuteMode(SAI_HandleTypeDef *hsai); |
Kojto | 99:dbbf35b96557 | 709 | HAL_StatusTypeDef HAL_SAI_EnableRxMuteMode(SAI_HandleTypeDef *hsai, SAIcallback callback, uint16_t counter); |
Kojto | 99:dbbf35b96557 | 710 | HAL_StatusTypeDef HAL_SAI_DisableRxMuteMode(SAI_HandleTypeDef *hsai); |
Kojto | 99:dbbf35b96557 | 711 | |
emilmont | 77:869cf507173a | 712 | /* SAI IRQHandler and Callbacks used in non blocking modes (Interrupt and DMA) */ |
emilmont | 77:869cf507173a | 713 | void HAL_SAI_IRQHandler(SAI_HandleTypeDef *hsai); |
bogdanm | 81:7d30d6019079 | 714 | void HAL_SAI_TxHalfCpltCallback(SAI_HandleTypeDef *hsai); |
bogdanm | 81:7d30d6019079 | 715 | void HAL_SAI_TxCpltCallback(SAI_HandleTypeDef *hsai); |
bogdanm | 81:7d30d6019079 | 716 | void HAL_SAI_RxHalfCpltCallback(SAI_HandleTypeDef *hsai); |
bogdanm | 81:7d30d6019079 | 717 | void HAL_SAI_RxCpltCallback(SAI_HandleTypeDef *hsai); |
bogdanm | 81:7d30d6019079 | 718 | void HAL_SAI_ErrorCallback(SAI_HandleTypeDef *hsai); |
Kojto | 99:dbbf35b96557 | 719 | /** |
Kojto | 99:dbbf35b96557 | 720 | * @} |
Kojto | 99:dbbf35b96557 | 721 | */ |
emilmont | 77:869cf507173a | 722 | |
Kojto | 99:dbbf35b96557 | 723 | /** @addtogroup SAI_Exported_Functions_Group3 |
Kojto | 99:dbbf35b96557 | 724 | * @{ |
Kojto | 99:dbbf35b96557 | 725 | */ |
emilmont | 77:869cf507173a | 726 | /* Peripheral State functions **************************************************/ |
emilmont | 77:869cf507173a | 727 | HAL_SAI_StateTypeDef HAL_SAI_GetState(SAI_HandleTypeDef *hsai); |
emilmont | 77:869cf507173a | 728 | uint32_t HAL_SAI_GetError(SAI_HandleTypeDef *hsai); |
Kojto | 99:dbbf35b96557 | 729 | /** |
Kojto | 99:dbbf35b96557 | 730 | * @} |
Kojto | 99:dbbf35b96557 | 731 | */ |
Kojto | 99:dbbf35b96557 | 732 | |
Kojto | 99:dbbf35b96557 | 733 | /** |
Kojto | 99:dbbf35b96557 | 734 | * @} |
Kojto | 99:dbbf35b96557 | 735 | */ |
emilmont | 77:869cf507173a | 736 | |
Kojto | 99:dbbf35b96557 | 737 | /* Private types -------------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 738 | /** @defgroup SAI_Private_Types SAI Private Types |
Kojto | 99:dbbf35b96557 | 739 | * @{ |
Kojto | 99:dbbf35b96557 | 740 | */ |
Kojto | 99:dbbf35b96557 | 741 | |
Kojto | 99:dbbf35b96557 | 742 | /** |
Kojto | 99:dbbf35b96557 | 743 | * @} |
Kojto | 99:dbbf35b96557 | 744 | */ |
Kojto | 99:dbbf35b96557 | 745 | |
Kojto | 99:dbbf35b96557 | 746 | /* Private variables ---------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 747 | /** @defgroup SAI_Private_Variables SAI Private Variables |
Kojto | 99:dbbf35b96557 | 748 | * @{ |
Kojto | 99:dbbf35b96557 | 749 | */ |
Kojto | 99:dbbf35b96557 | 750 | |
Kojto | 99:dbbf35b96557 | 751 | /** |
Kojto | 99:dbbf35b96557 | 752 | * @} |
Kojto | 99:dbbf35b96557 | 753 | */ |
Kojto | 99:dbbf35b96557 | 754 | |
Kojto | 99:dbbf35b96557 | 755 | /* Private constants ---------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 756 | /** @defgroup SAI_Private_Constants SAI Private Constants |
Kojto | 99:dbbf35b96557 | 757 | * @{ |
Kojto | 99:dbbf35b96557 | 758 | */ |
Kojto | 99:dbbf35b96557 | 759 | |
Kojto | 99:dbbf35b96557 | 760 | /** |
Kojto | 99:dbbf35b96557 | 761 | * @} |
Kojto | 99:dbbf35b96557 | 762 | */ |
Kojto | 99:dbbf35b96557 | 763 | |
Kojto | 99:dbbf35b96557 | 764 | /* Private macros ------------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 765 | /** @addtogroup SAI_Private_Macros |
Kojto | 99:dbbf35b96557 | 766 | * @{ |
Kojto | 99:dbbf35b96557 | 767 | */ |
Kojto | 99:dbbf35b96557 | 768 | #define IS_SAI_BLOCK_SYNCEXT(STATE) (((STATE) == SAI_SYNCEXT_DISABLE) ||\ |
Kojto | 99:dbbf35b96557 | 769 | ((STATE) == SAI_SYNCEXT_IN_ENABLE) ||\ |
Kojto | 99:dbbf35b96557 | 770 | ((STATE) == SAI_SYNCEXT_OUTBLOCKA_ENABLE) ||\ |
Kojto | 99:dbbf35b96557 | 771 | ((STATE) == SAI_SYNCEXT_OUTBLOCKB_ENABLE)) |
Kojto | 99:dbbf35b96557 | 772 | |
Kojto | 99:dbbf35b96557 | 773 | #define IS_SAI_SUPPORTED_PROTOCOL(PROTOCOL) (((PROTOCOL) == SAI_I2S_STANDARD) ||\ |
Kojto | 99:dbbf35b96557 | 774 | ((PROTOCOL) == SAI_I2S_MSBJUSTIFIED) ||\ |
Kojto | 99:dbbf35b96557 | 775 | ((PROTOCOL) == SAI_I2S_LSBJUSTIFIED) ||\ |
Kojto | 99:dbbf35b96557 | 776 | ((PROTOCOL) == SAI_PCM_LONG) ||\ |
Kojto | 99:dbbf35b96557 | 777 | ((PROTOCOL) == SAI_PCM_SHORT)) |
Kojto | 99:dbbf35b96557 | 778 | |
Kojto | 99:dbbf35b96557 | 779 | #define IS_SAI_PROTOCOL_DATASIZE(DATASIZE) (((DATASIZE) == SAI_PROTOCOL_DATASIZE_16BIT) ||\ |
Kojto | 99:dbbf35b96557 | 780 | ((DATASIZE) == SAI_PROTOCOL_DATASIZE_16BITEXTENDED) ||\ |
Kojto | 99:dbbf35b96557 | 781 | ((DATASIZE) == SAI_PROTOCOL_DATASIZE_24BIT) ||\ |
Kojto | 99:dbbf35b96557 | 782 | ((DATASIZE) == SAI_PROTOCOL_DATASIZE_32BIT)) |
Kojto | 99:dbbf35b96557 | 783 | |
Kojto | 99:dbbf35b96557 | 784 | #define IS_SAI_CLK_SOURCE(SOURCE) (((SOURCE) == SAI_CLKSOURCE_PLLSAI) ||\ |
Kojto | 99:dbbf35b96557 | 785 | ((SOURCE) == SAI_CLKSOURCE_PLLI2S) ||\ |
Kojto | 99:dbbf35b96557 | 786 | ((SOURCE) == SAI_CLKSOURCE_EXT)) |
Kojto | 99:dbbf35b96557 | 787 | |
Kojto | 99:dbbf35b96557 | 788 | #define IS_SAI_AUDIO_FREQUENCY(AUDIO) (((AUDIO) == SAI_AUDIO_FREQUENCY_192K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_96K) || \ |
Kojto | 99:dbbf35b96557 | 789 | ((AUDIO) == SAI_AUDIO_FREQUENCY_48K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_44K) || \ |
Kojto | 99:dbbf35b96557 | 790 | ((AUDIO) == SAI_AUDIO_FREQUENCY_32K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_22K) || \ |
Kojto | 99:dbbf35b96557 | 791 | ((AUDIO) == SAI_AUDIO_FREQUENCY_16K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_11K) || \ |
Kojto | 99:dbbf35b96557 | 792 | ((AUDIO) == SAI_AUDIO_FREQUENCY_8K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_MCKDIV)) |
Kojto | 99:dbbf35b96557 | 793 | |
Kojto | 99:dbbf35b96557 | 794 | #define IS_SAI_BLOCK_MODE(MODE) (((MODE) == SAI_MODEMASTER_TX) || \ |
Kojto | 99:dbbf35b96557 | 795 | ((MODE) == SAI_MODEMASTER_RX) || \ |
Kojto | 99:dbbf35b96557 | 796 | ((MODE) == SAI_MODESLAVE_TX) || \ |
Kojto | 99:dbbf35b96557 | 797 | ((MODE) == SAI_MODESLAVE_RX)) |
Kojto | 99:dbbf35b96557 | 798 | |
Kojto | 99:dbbf35b96557 | 799 | #define IS_SAI_BLOCK_PROTOCOL(PROTOCOL) (((PROTOCOL) == SAI_FREE_PROTOCOL) || \ |
Kojto | 99:dbbf35b96557 | 800 | ((PROTOCOL) == SAI_AC97_PROTOCOL) || \ |
Kojto | 99:dbbf35b96557 | 801 | ((PROTOCOL) == SAI_SPDIF_PROTOCOL)) |
Kojto | 99:dbbf35b96557 | 802 | |
Kojto | 99:dbbf35b96557 | 803 | #define IS_SAI_BLOCK_DATASIZE(DATASIZE) (((DATASIZE) == SAI_DATASIZE_8) || \ |
Kojto | 99:dbbf35b96557 | 804 | ((DATASIZE) == SAI_DATASIZE_10) || \ |
Kojto | 99:dbbf35b96557 | 805 | ((DATASIZE) == SAI_DATASIZE_16) || \ |
Kojto | 99:dbbf35b96557 | 806 | ((DATASIZE) == SAI_DATASIZE_20) || \ |
Kojto | 99:dbbf35b96557 | 807 | ((DATASIZE) == SAI_DATASIZE_24) || \ |
Kojto | 99:dbbf35b96557 | 808 | ((DATASIZE) == SAI_DATASIZE_32)) |
Kojto | 99:dbbf35b96557 | 809 | |
Kojto | 99:dbbf35b96557 | 810 | #define IS_SAI_BLOCK_FIRST_BIT(BIT) (((BIT) == SAI_FIRSTBIT_MSB) || \ |
Kojto | 99:dbbf35b96557 | 811 | ((BIT) == SAI_FIRSTBIT_LSB)) |
Kojto | 99:dbbf35b96557 | 812 | |
Kojto | 99:dbbf35b96557 | 813 | #define IS_SAI_BLOCK_CLOCK_STROBING(CLOCK) (((CLOCK) == SAI_CLOCKSTROBING_FALLINGEDGE) || \ |
Kojto | 99:dbbf35b96557 | 814 | ((CLOCK) == SAI_CLOCKSTROBING_RISINGEDGE)) |
Kojto | 99:dbbf35b96557 | 815 | |
Kojto | 99:dbbf35b96557 | 816 | #define IS_SAI_BLOCK_SYNCHRO(SYNCHRO) (((SYNCHRO) == SAI_ASYNCHRONOUS) || \ |
Kojto | 99:dbbf35b96557 | 817 | ((SYNCHRO) == SAI_SYNCHRONOUS) || \ |
Kojto | 99:dbbf35b96557 | 818 | ((SYNCHRO) == SAI_SYNCHRONOUS_EXT)) |
Kojto | 99:dbbf35b96557 | 819 | |
Kojto | 99:dbbf35b96557 | 820 | #define IS_SAI_BLOCK_OUTPUT_DRIVE(DRIVE) (((DRIVE) == SAI_OUTPUTDRIVE_DISABLE) || \ |
Kojto | 99:dbbf35b96557 | 821 | ((DRIVE) == SAI_OUTPUTDRIVE_ENABLE)) |
Kojto | 99:dbbf35b96557 | 822 | |
Kojto | 99:dbbf35b96557 | 823 | #define IS_SAI_BLOCK_NODIVIDER(NODIVIDER) (((NODIVIDER) == SAI_MASTERDIVIDER_ENABLE) || \ |
Kojto | 99:dbbf35b96557 | 824 | ((NODIVIDER) == SAI_MASTERDIVIDER_DISABLE)) |
Kojto | 99:dbbf35b96557 | 825 | |
Kojto | 99:dbbf35b96557 | 826 | #define IS_SAI_BLOCK_FIFO_STATUS(STATUS) (((STATUS) == SAI_FIFOSTATUS_LESS1QUARTERFULL ) || \ |
Kojto | 99:dbbf35b96557 | 827 | ((STATUS) == SAI_FIFOSTATUS_HALFFULL) || \ |
Kojto | 99:dbbf35b96557 | 828 | ((STATUS) == SAI_FIFOSTATUS_1QUARTERFULL) || \ |
Kojto | 99:dbbf35b96557 | 829 | ((STATUS) == SAI_FIFOSTATUS_3QUARTERFULL) || \ |
Kojto | 99:dbbf35b96557 | 830 | ((STATUS) == SAI_FIFOSTATUS_FULL) || \ |
Kojto | 99:dbbf35b96557 | 831 | ((STATUS) == SAI_FIFOSTATUS_EMPTY)) |
Kojto | 99:dbbf35b96557 | 832 | |
Kojto | 99:dbbf35b96557 | 833 | #define IS_SAI_BLOCK_MUTE_COUNTER(COUNTER) ((COUNTER) <= 63) |
Kojto | 99:dbbf35b96557 | 834 | |
Kojto | 99:dbbf35b96557 | 835 | #define IS_SAI_BLOCK_MUTE_VALUE(VALUE) (((VALUE) == SAI_ZERO_VALUE) || \ |
Kojto | 99:dbbf35b96557 | 836 | ((VALUE) == SAI_LAST_SENT_VALUE)) |
Kojto | 99:dbbf35b96557 | 837 | |
Kojto | 99:dbbf35b96557 | 838 | #define IS_SAI_BLOCK_COMPANDING_MODE(MODE) (((MODE) == SAI_NOCOMPANDING) || \ |
Kojto | 99:dbbf35b96557 | 839 | ((MODE) == SAI_ULAW_1CPL_COMPANDING) || \ |
Kojto | 99:dbbf35b96557 | 840 | ((MODE) == SAI_ALAW_1CPL_COMPANDING) || \ |
Kojto | 99:dbbf35b96557 | 841 | ((MODE) == SAI_ULAW_2CPL_COMPANDING) || \ |
Kojto | 99:dbbf35b96557 | 842 | ((MODE) == SAI_ALAW_2CPL_COMPANDING)) |
Kojto | 99:dbbf35b96557 | 843 | |
Kojto | 99:dbbf35b96557 | 844 | #define IS_SAI_BLOCK_FIFO_THRESHOLD(THRESHOLD) (((THRESHOLD) == SAI_FIFOTHRESHOLD_EMPTY) || \ |
Kojto | 99:dbbf35b96557 | 845 | ((THRESHOLD) == SAI_FIFOTHRESHOLD_1QF) || \ |
Kojto | 99:dbbf35b96557 | 846 | ((THRESHOLD) == SAI_FIFOTHRESHOLD_HF) || \ |
Kojto | 99:dbbf35b96557 | 847 | ((THRESHOLD) == SAI_FIFOTHRESHOLD_3QF) || \ |
Kojto | 99:dbbf35b96557 | 848 | ((THRESHOLD) == SAI_FIFOTHRESHOLD_FULL)) |
Kojto | 99:dbbf35b96557 | 849 | |
Kojto | 99:dbbf35b96557 | 850 | #define IS_SAI_BLOCK_TRISTATE_MANAGEMENT(STATE) (((STATE) == SAI_OUTPUT_NOTRELEASED) ||\ |
Kojto | 99:dbbf35b96557 | 851 | ((STATE) == SAI_OUTPUT_RELEASED)) |
Kojto | 99:dbbf35b96557 | 852 | |
Kojto | 99:dbbf35b96557 | 853 | #define IS_SAI_MONO_STEREO_MODE(MODE) (((MODE) == SAI_MONOMODE) ||\ |
Kojto | 99:dbbf35b96557 | 854 | ((MODE) == SAI_STEREOMODE)) |
Kojto | 99:dbbf35b96557 | 855 | |
Kojto | 99:dbbf35b96557 | 856 | #define IS_SAI_SLOT_ACTIVE(ACTIVE) ((((ACTIVE) >> 16 ) > 0) && (((ACTIVE) >> 16 ) <= (SAI_SLOTACTIVE_ALL >> 16))) |
Kojto | 99:dbbf35b96557 | 857 | |
Kojto | 99:dbbf35b96557 | 858 | #define IS_SAI_BLOCK_SLOT_NUMBER(NUMBER) ((1 <= (NUMBER)) && ((NUMBER) <= 16)) |
Kojto | 99:dbbf35b96557 | 859 | |
Kojto | 99:dbbf35b96557 | 860 | #define IS_SAI_BLOCK_SLOT_SIZE(SIZE) (((SIZE) == SAI_SLOTSIZE_DATASIZE) || \ |
Kojto | 99:dbbf35b96557 | 861 | ((SIZE) == SAI_SLOTSIZE_16B) || \ |
Kojto | 99:dbbf35b96557 | 862 | ((SIZE) == SAI_SLOTSIZE_32B)) |
Kojto | 99:dbbf35b96557 | 863 | |
Kojto | 99:dbbf35b96557 | 864 | #define IS_SAI_BLOCK_FIRSTBIT_OFFSET(OFFSET) ((OFFSET) <= 24) |
Kojto | 99:dbbf35b96557 | 865 | |
Kojto | 99:dbbf35b96557 | 866 | #define IS_SAI_BLOCK_FS_OFFSET(OFFSET) (((OFFSET) == SAI_FS_FIRSTBIT) || \ |
Kojto | 99:dbbf35b96557 | 867 | ((OFFSET) == SAI_FS_BEFOREFIRSTBIT)) |
Kojto | 99:dbbf35b96557 | 868 | |
Kojto | 99:dbbf35b96557 | 869 | #define IS_SAI_BLOCK_FS_POLARITY(POLARITY) (((POLARITY) == SAI_FS_ACTIVE_LOW) || \ |
Kojto | 99:dbbf35b96557 | 870 | ((POLARITY) == SAI_FS_ACTIVE_HIGH)) |
Kojto | 99:dbbf35b96557 | 871 | |
Kojto | 99:dbbf35b96557 | 872 | #define IS_SAI_BLOCK_FS_DEFINITION(DEFINITION) (((DEFINITION) == SAI_FS_STARTFRAME) || \ |
Kojto | 99:dbbf35b96557 | 873 | ((DEFINITION) == SAI_FS_CHANNEL_IDENTIFICATION)) |
Kojto | 99:dbbf35b96557 | 874 | |
Kojto | 99:dbbf35b96557 | 875 | #define IS_SAI_BLOCK_MASTER_DIVIDER(DIVIDER) ((DIVIDER) <= 15) |
Kojto | 99:dbbf35b96557 | 876 | |
Kojto | 99:dbbf35b96557 | 877 | #define IS_SAI_BLOCK_FRAME_LENGTH(LENGTH) ((8 <= (LENGTH)) && ((LENGTH) <= 256)) |
Kojto | 99:dbbf35b96557 | 878 | |
Kojto | 99:dbbf35b96557 | 879 | #define IS_SAI_BLOCK_ACTIVE_FRAME(LENGTH) ((1 <= (LENGTH)) && ((LENGTH) <= 128)) |
Kojto | 99:dbbf35b96557 | 880 | |
Kojto | 99:dbbf35b96557 | 881 | /** |
Kojto | 99:dbbf35b96557 | 882 | * @} |
Kojto | 99:dbbf35b96557 | 883 | */ |
Kojto | 99:dbbf35b96557 | 884 | |
Kojto | 99:dbbf35b96557 | 885 | /* Private functions ---------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 886 | /** @defgroup SAI_Private_Functions SAI Private Functions |
Kojto | 99:dbbf35b96557 | 887 | * @{ |
Kojto | 99:dbbf35b96557 | 888 | */ |
Kojto | 99:dbbf35b96557 | 889 | |
Kojto | 99:dbbf35b96557 | 890 | /** |
Kojto | 99:dbbf35b96557 | 891 | * @} |
Kojto | 99:dbbf35b96557 | 892 | */ |
Kojto | 110:165afa46840b | 893 | |
Kojto | 110:165afa46840b | 894 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ |
emilmont | 77:869cf507173a | 895 | /** |
emilmont | 77:869cf507173a | 896 | * @} |
emilmont | 77:869cf507173a | 897 | */ |
emilmont | 77:869cf507173a | 898 | |
emilmont | 77:869cf507173a | 899 | /** |
emilmont | 77:869cf507173a | 900 | * @} |
emilmont | 77:869cf507173a | 901 | */ |
emilmont | 77:869cf507173a | 902 | |
emilmont | 77:869cf507173a | 903 | #ifdef __cplusplus |
emilmont | 77:869cf507173a | 904 | } |
emilmont | 77:869cf507173a | 905 | #endif |
emilmont | 77:869cf507173a | 906 | |
emilmont | 77:869cf507173a | 907 | #endif /* __STM32F4xx_HAL_SAI_H */ |
emilmont | 77:869cf507173a | 908 | |
emilmont | 77:869cf507173a | 909 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |