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