Initial commit
mbed-dev-master/targets/TARGET_STM/TARGET_STM32F4/device/stm32f4xx_hal_spdifrx.c@0:bb348c97df44, 2020-09-16 (annotated)
- Committer:
- lypinator
- Date:
- Wed Sep 16 01:11:49 2020 +0000
- Revision:
- 0:bb348c97df44
Added PWM
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lypinator | 0:bb348c97df44 | 1 | /** |
lypinator | 0:bb348c97df44 | 2 | ****************************************************************************** |
lypinator | 0:bb348c97df44 | 3 | * @file stm32f4xx_hal_spdifrx.c |
lypinator | 0:bb348c97df44 | 4 | * @author MCD Application Team |
lypinator | 0:bb348c97df44 | 5 | * @brief This file provides firmware functions to manage the following |
lypinator | 0:bb348c97df44 | 6 | * functionalities of the SPDIFRX audio interface: |
lypinator | 0:bb348c97df44 | 7 | * + Initialization and Configuration |
lypinator | 0:bb348c97df44 | 8 | * + Data transfers functions |
lypinator | 0:bb348c97df44 | 9 | * + DMA transfers management |
lypinator | 0:bb348c97df44 | 10 | * + Interrupts and flags management |
lypinator | 0:bb348c97df44 | 11 | @verbatim |
lypinator | 0:bb348c97df44 | 12 | =============================================================================== |
lypinator | 0:bb348c97df44 | 13 | ##### How to use this driver ##### |
lypinator | 0:bb348c97df44 | 14 | =============================================================================== |
lypinator | 0:bb348c97df44 | 15 | [..] |
lypinator | 0:bb348c97df44 | 16 | The SPDIFRX HAL driver can be used as follow: |
lypinator | 0:bb348c97df44 | 17 | |
lypinator | 0:bb348c97df44 | 18 | (#) Declare SPDIFRX_HandleTypeDef handle structure. |
lypinator | 0:bb348c97df44 | 19 | (#) Initialize the SPDIFRX low level resources by implement the HAL_SPDIFRX_MspInit() API: |
lypinator | 0:bb348c97df44 | 20 | (##) Enable the SPDIFRX interface clock. |
lypinator | 0:bb348c97df44 | 21 | (##) SPDIFRX pins configuration: |
lypinator | 0:bb348c97df44 | 22 | (+++) Enable the clock for the SPDIFRX GPIOs. |
lypinator | 0:bb348c97df44 | 23 | (+++) Configure these SPDIFRX pins as alternate function pull-up. |
lypinator | 0:bb348c97df44 | 24 | (##) NVIC configuration if you need to use interrupt process (HAL_SPDIFRX_ReceiveControlFlow_IT() and HAL_SPDIFRX_ReceiveDataFlow_IT() API's). |
lypinator | 0:bb348c97df44 | 25 | (+++) Configure the SPDIFRX interrupt priority. |
lypinator | 0:bb348c97df44 | 26 | (+++) Enable the NVIC SPDIFRX IRQ handle. |
lypinator | 0:bb348c97df44 | 27 | (##) DMA Configuration if you need to use DMA process (HAL_SPDIFRX_ReceiveDataFlow_DMA() and HAL_SPDIFRX_ReceiveControlFlow_DMA() API's). |
lypinator | 0:bb348c97df44 | 28 | (+++) Declare a DMA handle structure for the reception of the Data Flow channel. |
lypinator | 0:bb348c97df44 | 29 | (+++) Declare a DMA handle structure for the reception of the Control Flow channel. |
lypinator | 0:bb348c97df44 | 30 | (+++) Enable the DMAx interface clock. |
lypinator | 0:bb348c97df44 | 31 | (+++) Configure the declared DMA handle structure CtrlRx/DataRx with the required parameters. |
lypinator | 0:bb348c97df44 | 32 | (+++) Configure the DMA Channel. |
lypinator | 0:bb348c97df44 | 33 | (+++) Associate the initialized DMA handle to the SPDIFRX DMA CtrlRx/DataRx handle. |
lypinator | 0:bb348c97df44 | 34 | (+++) Configure the priority and enable the NVIC for the transfer complete interrupt on the |
lypinator | 0:bb348c97df44 | 35 | DMA CtrlRx/DataRx channel. |
lypinator | 0:bb348c97df44 | 36 | |
lypinator | 0:bb348c97df44 | 37 | (#) Program the input selection, re-tries number, wait for activity, channel status selection, data format, stereo mode and masking of user bits |
lypinator | 0:bb348c97df44 | 38 | using HAL_SPDIFRX_Init() function. |
lypinator | 0:bb348c97df44 | 39 | |
lypinator | 0:bb348c97df44 | 40 | -@- The specific SPDIFRX interrupts (RXNE/CSRNE and Error Interrupts) will be managed using the macros |
lypinator | 0:bb348c97df44 | 41 | __SPDIFRX_ENABLE_IT() and __SPDIFRX_DISABLE_IT() inside the receive process. |
lypinator | 0:bb348c97df44 | 42 | -@- Make sure that ck_spdif clock is configured. |
lypinator | 0:bb348c97df44 | 43 | |
lypinator | 0:bb348c97df44 | 44 | (#) Three operation modes are available within this driver : |
lypinator | 0:bb348c97df44 | 45 | |
lypinator | 0:bb348c97df44 | 46 | *** Polling mode for reception operation (for debug purpose) *** |
lypinator | 0:bb348c97df44 | 47 | ================================================================ |
lypinator | 0:bb348c97df44 | 48 | [..] |
lypinator | 0:bb348c97df44 | 49 | (+) Receive data flow in blocking mode using HAL_SPDIFRX_ReceiveDataFlow() |
lypinator | 0:bb348c97df44 | 50 | (+) Receive control flow of data in blocking mode using HAL_SPDIFRX_ReceiveControlFlow() |
lypinator | 0:bb348c97df44 | 51 | |
lypinator | 0:bb348c97df44 | 52 | *** Interrupt mode for reception operation *** |
lypinator | 0:bb348c97df44 | 53 | ========================================= |
lypinator | 0:bb348c97df44 | 54 | [..] |
lypinator | 0:bb348c97df44 | 55 | (+) Receive an amount of data (Data Flow) in non blocking mode using HAL_SPDIFRX_ReceiveDataFlow_IT() |
lypinator | 0:bb348c97df44 | 56 | (+) Receive an amount of data (Control Flow) in non blocking mode using HAL_SPDIFRX_ReceiveControlFlow_IT() |
lypinator | 0:bb348c97df44 | 57 | (+) At reception end of half transfer HAL_SPDIFRX_RxHalfCpltCallback is executed and user can |
lypinator | 0:bb348c97df44 | 58 | add his own code by customization of function pointer HAL_SPDIFRX_RxHalfCpltCallback |
lypinator | 0:bb348c97df44 | 59 | (+) At reception end of transfer HAL_SPDIFRX_RxCpltCallback is executed and user can |
lypinator | 0:bb348c97df44 | 60 | add his own code by customization of function pointer HAL_SPDIFRX_RxCpltCallback |
lypinator | 0:bb348c97df44 | 61 | (+) In case of transfer Error, HAL_SPDIFRX_ErrorCallback() function is executed and user can |
lypinator | 0:bb348c97df44 | 62 | add his own code by customization of function pointer HAL_SPDIFRX_ErrorCallback |
lypinator | 0:bb348c97df44 | 63 | |
lypinator | 0:bb348c97df44 | 64 | *** DMA mode for reception operation *** |
lypinator | 0:bb348c97df44 | 65 | ======================================== |
lypinator | 0:bb348c97df44 | 66 | [..] |
lypinator | 0:bb348c97df44 | 67 | (+) Receive an amount of data (Data Flow) in non blocking mode (DMA) using HAL_SPDIFRX_ReceiveDataFlow_DMA() |
lypinator | 0:bb348c97df44 | 68 | (+) Receive an amount of data (Control Flow) in non blocking mode (DMA) using HAL_SPDIFRX_ReceiveControlFlow_DMA() |
lypinator | 0:bb348c97df44 | 69 | (+) At reception end of half transfer HAL_SPDIFRX_RxHalfCpltCallback is executed and user can |
lypinator | 0:bb348c97df44 | 70 | add his own code by customization of function pointer HAL_SPDIFRX_RxHalfCpltCallback |
lypinator | 0:bb348c97df44 | 71 | (+) At reception end of transfer HAL_SPDIFRX_RxCpltCallback is executed and user can |
lypinator | 0:bb348c97df44 | 72 | add his own code by customization of function pointer HAL_SPDIFRX_RxCpltCallback |
lypinator | 0:bb348c97df44 | 73 | (+) In case of transfer Error, HAL_SPDIFRX_ErrorCallback() function is executed and user can |
lypinator | 0:bb348c97df44 | 74 | add his own code by customization of function pointer HAL_SPDIFRX_ErrorCallback |
lypinator | 0:bb348c97df44 | 75 | (+) Stop the DMA Transfer using HAL_SPDIFRX_DMAStop() |
lypinator | 0:bb348c97df44 | 76 | |
lypinator | 0:bb348c97df44 | 77 | *** SPDIFRX HAL driver macros list *** |
lypinator | 0:bb348c97df44 | 78 | ============================================= |
lypinator | 0:bb348c97df44 | 79 | [..] |
lypinator | 0:bb348c97df44 | 80 | Below the list of most used macros in SPDIFRX HAL driver. |
lypinator | 0:bb348c97df44 | 81 | (+) __HAL_SPDIFRX_IDLE: Disable the specified SPDIFRX peripheral (IDEL State) |
lypinator | 0:bb348c97df44 | 82 | (+) __HAL_SPDIFRX_SYNC: Enable the synchronization state of the specified SPDIFRX peripheral (SYNC State) |
lypinator | 0:bb348c97df44 | 83 | (+) __HAL_SPDIFRX_RCV: Enable the receive state of the specified SPDIFRX peripheral (RCV State) |
lypinator | 0:bb348c97df44 | 84 | (+) __HAL_SPDIFRX_ENABLE_IT : Enable the specified SPDIFRX interrupts |
lypinator | 0:bb348c97df44 | 85 | (+) __HAL_SPDIFRX_DISABLE_IT : Disable the specified SPDIFRX interrupts |
lypinator | 0:bb348c97df44 | 86 | (+) __HAL_SPDIFRX_GET_FLAG: Check whether the specified SPDIFRX flag is set or not. |
lypinator | 0:bb348c97df44 | 87 | |
lypinator | 0:bb348c97df44 | 88 | [..] |
lypinator | 0:bb348c97df44 | 89 | (@) You can refer to the SPDIFRX HAL driver header file for more useful macros |
lypinator | 0:bb348c97df44 | 90 | |
lypinator | 0:bb348c97df44 | 91 | @endverbatim |
lypinator | 0:bb348c97df44 | 92 | ****************************************************************************** |
lypinator | 0:bb348c97df44 | 93 | * @attention |
lypinator | 0:bb348c97df44 | 94 | * |
lypinator | 0:bb348c97df44 | 95 | * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> |
lypinator | 0:bb348c97df44 | 96 | * |
lypinator | 0:bb348c97df44 | 97 | * Redistribution and use in source and binary forms, with or without modification, |
lypinator | 0:bb348c97df44 | 98 | * are permitted provided that the following conditions are met: |
lypinator | 0:bb348c97df44 | 99 | * 1. Redistributions of source code must retain the above copyright notice, |
lypinator | 0:bb348c97df44 | 100 | * this list of conditions and the following disclaimer. |
lypinator | 0:bb348c97df44 | 101 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
lypinator | 0:bb348c97df44 | 102 | * this list of conditions and the following disclaimer in the documentation |
lypinator | 0:bb348c97df44 | 103 | * and/or other materials provided with the distribution. |
lypinator | 0:bb348c97df44 | 104 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
lypinator | 0:bb348c97df44 | 105 | * may be used to endorse or promote products derived from this software |
lypinator | 0:bb348c97df44 | 106 | * without specific prior written permission. |
lypinator | 0:bb348c97df44 | 107 | * |
lypinator | 0:bb348c97df44 | 108 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
lypinator | 0:bb348c97df44 | 109 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
lypinator | 0:bb348c97df44 | 110 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
lypinator | 0:bb348c97df44 | 111 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
lypinator | 0:bb348c97df44 | 112 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
lypinator | 0:bb348c97df44 | 113 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
lypinator | 0:bb348c97df44 | 114 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
lypinator | 0:bb348c97df44 | 115 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
lypinator | 0:bb348c97df44 | 116 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
lypinator | 0:bb348c97df44 | 117 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
lypinator | 0:bb348c97df44 | 118 | * |
lypinator | 0:bb348c97df44 | 119 | ****************************************************************************** |
lypinator | 0:bb348c97df44 | 120 | */ |
lypinator | 0:bb348c97df44 | 121 | |
lypinator | 0:bb348c97df44 | 122 | /* Includes ------------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 123 | #include "stm32f4xx_hal.h" |
lypinator | 0:bb348c97df44 | 124 | |
lypinator | 0:bb348c97df44 | 125 | /** @addtogroup STM32F4xx_HAL_Driver |
lypinator | 0:bb348c97df44 | 126 | * @{ |
lypinator | 0:bb348c97df44 | 127 | */ |
lypinator | 0:bb348c97df44 | 128 | /** @defgroup SPDIFRX SPDIFRX |
lypinator | 0:bb348c97df44 | 129 | * @brief SPDIFRX HAL module driver |
lypinator | 0:bb348c97df44 | 130 | * @{ |
lypinator | 0:bb348c97df44 | 131 | */ |
lypinator | 0:bb348c97df44 | 132 | |
lypinator | 0:bb348c97df44 | 133 | #ifdef HAL_SPDIFRX_MODULE_ENABLED |
lypinator | 0:bb348c97df44 | 134 | |
lypinator | 0:bb348c97df44 | 135 | #if defined(STM32F446xx) |
lypinator | 0:bb348c97df44 | 136 | |
lypinator | 0:bb348c97df44 | 137 | /* Private typedef -----------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 138 | /* Private define ------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 139 | #define SPDIFRX_TIMEOUT_VALUE 0xFFFF |
lypinator | 0:bb348c97df44 | 140 | |
lypinator | 0:bb348c97df44 | 141 | /* Private macro -------------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 142 | /* Private variables ---------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 143 | /* Private function prototypes -----------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 144 | |
lypinator | 0:bb348c97df44 | 145 | /** @addtogroup SPDIFRX_Private_Functions |
lypinator | 0:bb348c97df44 | 146 | * @{ |
lypinator | 0:bb348c97df44 | 147 | */ |
lypinator | 0:bb348c97df44 | 148 | static void SPDIFRX_DMARxCplt(DMA_HandleTypeDef *hdma); |
lypinator | 0:bb348c97df44 | 149 | static void SPDIFRX_DMARxHalfCplt(DMA_HandleTypeDef *hdma); |
lypinator | 0:bb348c97df44 | 150 | static void SPDIFRX_DMACxCplt(DMA_HandleTypeDef *hdma); |
lypinator | 0:bb348c97df44 | 151 | static void SPDIFRX_DMACxHalfCplt(DMA_HandleTypeDef *hdma); |
lypinator | 0:bb348c97df44 | 152 | static void SPDIFRX_DMAError(DMA_HandleTypeDef *hdma); |
lypinator | 0:bb348c97df44 | 153 | static void SPDIFRX_ReceiveControlFlow_IT(SPDIFRX_HandleTypeDef *hspdif); |
lypinator | 0:bb348c97df44 | 154 | static void SPDIFRX_ReceiveDataFlow_IT(SPDIFRX_HandleTypeDef *hspdif); |
lypinator | 0:bb348c97df44 | 155 | static HAL_StatusTypeDef SPDIFRX_WaitOnFlagUntilTimeout(SPDIFRX_HandleTypeDef *hspdif, uint32_t Flag, FlagStatus Status, uint32_t Timeout); |
lypinator | 0:bb348c97df44 | 156 | |
lypinator | 0:bb348c97df44 | 157 | /** |
lypinator | 0:bb348c97df44 | 158 | * @} |
lypinator | 0:bb348c97df44 | 159 | */ |
lypinator | 0:bb348c97df44 | 160 | /* Exported functions ---------------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 161 | |
lypinator | 0:bb348c97df44 | 162 | /** @defgroup SPDIFRX_Exported_Functions SPDIFRX Exported Functions |
lypinator | 0:bb348c97df44 | 163 | * @{ |
lypinator | 0:bb348c97df44 | 164 | */ |
lypinator | 0:bb348c97df44 | 165 | |
lypinator | 0:bb348c97df44 | 166 | /** @defgroup SPDIFRX_Exported_Functions_Group1 Initialization and de-initialization functions |
lypinator | 0:bb348c97df44 | 167 | * @brief Initialization and Configuration functions |
lypinator | 0:bb348c97df44 | 168 | * |
lypinator | 0:bb348c97df44 | 169 | @verbatim |
lypinator | 0:bb348c97df44 | 170 | =============================================================================== |
lypinator | 0:bb348c97df44 | 171 | ##### Initialization and de-initialization functions ##### |
lypinator | 0:bb348c97df44 | 172 | =============================================================================== |
lypinator | 0:bb348c97df44 | 173 | [..] This subsection provides a set of functions allowing to initialize and |
lypinator | 0:bb348c97df44 | 174 | de-initialize the SPDIFRX peripheral: |
lypinator | 0:bb348c97df44 | 175 | |
lypinator | 0:bb348c97df44 | 176 | (+) User must Implement HAL_SPDIFRX_MspInit() function in which he configures |
lypinator | 0:bb348c97df44 | 177 | all related peripherals resources (CLOCK, GPIO, DMA, IT and NVIC ). |
lypinator | 0:bb348c97df44 | 178 | |
lypinator | 0:bb348c97df44 | 179 | (+) Call the function HAL_SPDIFRX_Init() to configure the SPDIFRX peripheral with |
lypinator | 0:bb348c97df44 | 180 | the selected configuration: |
lypinator | 0:bb348c97df44 | 181 | (++) Input Selection (IN0, IN1,...) |
lypinator | 0:bb348c97df44 | 182 | (++) Maximum allowed re-tries during synchronization phase |
lypinator | 0:bb348c97df44 | 183 | (++) Wait for activity on SPDIF selected input |
lypinator | 0:bb348c97df44 | 184 | (++) Channel status selection (from channel A or B) |
lypinator | 0:bb348c97df44 | 185 | (++) Data format (LSB, MSB, ...) |
lypinator | 0:bb348c97df44 | 186 | (++) Stereo mode |
lypinator | 0:bb348c97df44 | 187 | (++) User bits masking (PT,C,U,V,...) |
lypinator | 0:bb348c97df44 | 188 | |
lypinator | 0:bb348c97df44 | 189 | (+) Call the function HAL_SPDIFRX_DeInit() to restore the default configuration |
lypinator | 0:bb348c97df44 | 190 | of the selected SPDIFRXx peripheral. |
lypinator | 0:bb348c97df44 | 191 | @endverbatim |
lypinator | 0:bb348c97df44 | 192 | * @{ |
lypinator | 0:bb348c97df44 | 193 | */ |
lypinator | 0:bb348c97df44 | 194 | |
lypinator | 0:bb348c97df44 | 195 | /** |
lypinator | 0:bb348c97df44 | 196 | * @brief Initializes the SPDIFRX according to the specified parameters |
lypinator | 0:bb348c97df44 | 197 | * in the SPDIFRX_InitTypeDef and create the associated handle. |
lypinator | 0:bb348c97df44 | 198 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 199 | * @retval HAL status |
lypinator | 0:bb348c97df44 | 200 | */ |
lypinator | 0:bb348c97df44 | 201 | HAL_StatusTypeDef HAL_SPDIFRX_Init(SPDIFRX_HandleTypeDef *hspdif) |
lypinator | 0:bb348c97df44 | 202 | { |
lypinator | 0:bb348c97df44 | 203 | uint32_t tmpreg = 0U; |
lypinator | 0:bb348c97df44 | 204 | |
lypinator | 0:bb348c97df44 | 205 | /* Check the SPDIFRX handle allocation */ |
lypinator | 0:bb348c97df44 | 206 | if(hspdif == NULL) |
lypinator | 0:bb348c97df44 | 207 | { |
lypinator | 0:bb348c97df44 | 208 | return HAL_ERROR; |
lypinator | 0:bb348c97df44 | 209 | } |
lypinator | 0:bb348c97df44 | 210 | |
lypinator | 0:bb348c97df44 | 211 | /* Check the SPDIFRX parameters */ |
lypinator | 0:bb348c97df44 | 212 | assert_param(IS_STEREO_MODE(hspdif->Init.StereoMode)); |
lypinator | 0:bb348c97df44 | 213 | assert_param(IS_SPDIFRX_INPUT_SELECT(hspdif->Init.InputSelection)); |
lypinator | 0:bb348c97df44 | 214 | assert_param(IS_SPDIFRX_MAX_RETRIES(hspdif->Init.Retries)); |
lypinator | 0:bb348c97df44 | 215 | assert_param(IS_SPDIFRX_WAIT_FOR_ACTIVITY(hspdif->Init.WaitForActivity)); |
lypinator | 0:bb348c97df44 | 216 | assert_param(IS_SPDIFRX_CHANNEL(hspdif->Init.ChannelSelection)); |
lypinator | 0:bb348c97df44 | 217 | assert_param(IS_SPDIFRX_DATA_FORMAT(hspdif->Init.DataFormat)); |
lypinator | 0:bb348c97df44 | 218 | assert_param(IS_PREAMBLE_TYPE_MASK(hspdif->Init.PreambleTypeMask)); |
lypinator | 0:bb348c97df44 | 219 | assert_param(IS_CHANNEL_STATUS_MASK(hspdif->Init.ChannelStatusMask)); |
lypinator | 0:bb348c97df44 | 220 | assert_param(IS_VALIDITY_MASK(hspdif->Init.ValidityBitMask)); |
lypinator | 0:bb348c97df44 | 221 | assert_param(IS_PARITY_ERROR_MASK(hspdif->Init.ParityErrorMask)); |
lypinator | 0:bb348c97df44 | 222 | |
lypinator | 0:bb348c97df44 | 223 | if(hspdif->State == HAL_SPDIFRX_STATE_RESET) |
lypinator | 0:bb348c97df44 | 224 | { |
lypinator | 0:bb348c97df44 | 225 | /* Allocate lock resource and initialize it */ |
lypinator | 0:bb348c97df44 | 226 | hspdif->Lock = HAL_UNLOCKED; |
lypinator | 0:bb348c97df44 | 227 | /* Init the low level hardware : GPIO, CLOCK, CORTEX...etc */ |
lypinator | 0:bb348c97df44 | 228 | HAL_SPDIFRX_MspInit(hspdif); |
lypinator | 0:bb348c97df44 | 229 | } |
lypinator | 0:bb348c97df44 | 230 | |
lypinator | 0:bb348c97df44 | 231 | /* SPDIFRX peripheral state is BUSY*/ |
lypinator | 0:bb348c97df44 | 232 | hspdif->State = HAL_SPDIFRX_STATE_BUSY; |
lypinator | 0:bb348c97df44 | 233 | |
lypinator | 0:bb348c97df44 | 234 | /* Disable SPDIFRX interface (IDLE State) */ |
lypinator | 0:bb348c97df44 | 235 | __HAL_SPDIFRX_IDLE(hspdif); |
lypinator | 0:bb348c97df44 | 236 | |
lypinator | 0:bb348c97df44 | 237 | /* Reset the old SPDIFRX CR configuration */ |
lypinator | 0:bb348c97df44 | 238 | tmpreg = hspdif->Instance->CR; |
lypinator | 0:bb348c97df44 | 239 | |
lypinator | 0:bb348c97df44 | 240 | tmpreg &= ~((uint16_t) SPDIFRX_CR_RXSTEO | SPDIFRX_CR_DRFMT | SPDIFRX_CR_PMSK | |
lypinator | 0:bb348c97df44 | 241 | SPDIFRX_CR_VMSK | SPDIFRX_CR_CUMSK | SPDIFRX_CR_PTMSK | |
lypinator | 0:bb348c97df44 | 242 | SPDIFRX_CR_CHSEL | SPDIFRX_CR_NBTR | SPDIFRX_CR_WFA | |
lypinator | 0:bb348c97df44 | 243 | SPDIFRX_CR_INSEL); |
lypinator | 0:bb348c97df44 | 244 | |
lypinator | 0:bb348c97df44 | 245 | /* Sets the new configuration of the SPDIFRX peripheral */ |
lypinator | 0:bb348c97df44 | 246 | tmpreg |= ((uint16_t) hspdif->Init.StereoMode | |
lypinator | 0:bb348c97df44 | 247 | hspdif->Init.InputSelection | |
lypinator | 0:bb348c97df44 | 248 | hspdif->Init.Retries | |
lypinator | 0:bb348c97df44 | 249 | hspdif->Init.WaitForActivity | |
lypinator | 0:bb348c97df44 | 250 | hspdif->Init.ChannelSelection | |
lypinator | 0:bb348c97df44 | 251 | hspdif->Init.DataFormat | |
lypinator | 0:bb348c97df44 | 252 | hspdif->Init.PreambleTypeMask | |
lypinator | 0:bb348c97df44 | 253 | hspdif->Init.ChannelStatusMask | |
lypinator | 0:bb348c97df44 | 254 | hspdif->Init.ValidityBitMask | |
lypinator | 0:bb348c97df44 | 255 | hspdif->Init.ParityErrorMask); |
lypinator | 0:bb348c97df44 | 256 | |
lypinator | 0:bb348c97df44 | 257 | hspdif->Instance->CR = tmpreg; |
lypinator | 0:bb348c97df44 | 258 | |
lypinator | 0:bb348c97df44 | 259 | hspdif->ErrorCode = HAL_SPDIFRX_ERROR_NONE; |
lypinator | 0:bb348c97df44 | 260 | |
lypinator | 0:bb348c97df44 | 261 | /* SPDIFRX peripheral state is READY*/ |
lypinator | 0:bb348c97df44 | 262 | hspdif->State = HAL_SPDIFRX_STATE_READY; |
lypinator | 0:bb348c97df44 | 263 | |
lypinator | 0:bb348c97df44 | 264 | return HAL_OK; |
lypinator | 0:bb348c97df44 | 265 | } |
lypinator | 0:bb348c97df44 | 266 | |
lypinator | 0:bb348c97df44 | 267 | /** |
lypinator | 0:bb348c97df44 | 268 | * @brief DeInitializes the SPDIFRX peripheral |
lypinator | 0:bb348c97df44 | 269 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 270 | * @retval HAL status |
lypinator | 0:bb348c97df44 | 271 | */ |
lypinator | 0:bb348c97df44 | 272 | HAL_StatusTypeDef HAL_SPDIFRX_DeInit(SPDIFRX_HandleTypeDef *hspdif) |
lypinator | 0:bb348c97df44 | 273 | { |
lypinator | 0:bb348c97df44 | 274 | /* Check the SPDIFRX handle allocation */ |
lypinator | 0:bb348c97df44 | 275 | if(hspdif == NULL) |
lypinator | 0:bb348c97df44 | 276 | { |
lypinator | 0:bb348c97df44 | 277 | return HAL_ERROR; |
lypinator | 0:bb348c97df44 | 278 | } |
lypinator | 0:bb348c97df44 | 279 | |
lypinator | 0:bb348c97df44 | 280 | /* Check the parameters */ |
lypinator | 0:bb348c97df44 | 281 | assert_param(IS_SPDIFRX_ALL_INSTANCE(hspdif->Instance)); |
lypinator | 0:bb348c97df44 | 282 | |
lypinator | 0:bb348c97df44 | 283 | hspdif->State = HAL_SPDIFRX_STATE_BUSY; |
lypinator | 0:bb348c97df44 | 284 | |
lypinator | 0:bb348c97df44 | 285 | /* Disable SPDIFRX interface (IDLE state) */ |
lypinator | 0:bb348c97df44 | 286 | __HAL_SPDIFRX_IDLE(hspdif); |
lypinator | 0:bb348c97df44 | 287 | |
lypinator | 0:bb348c97df44 | 288 | /* DeInit the low level hardware: GPIO, CLOCK, NVIC... */ |
lypinator | 0:bb348c97df44 | 289 | HAL_SPDIFRX_MspDeInit(hspdif); |
lypinator | 0:bb348c97df44 | 290 | |
lypinator | 0:bb348c97df44 | 291 | hspdif->ErrorCode = HAL_SPDIFRX_ERROR_NONE; |
lypinator | 0:bb348c97df44 | 292 | |
lypinator | 0:bb348c97df44 | 293 | /* SPDIFRX peripheral state is RESET*/ |
lypinator | 0:bb348c97df44 | 294 | hspdif->State = HAL_SPDIFRX_STATE_RESET; |
lypinator | 0:bb348c97df44 | 295 | |
lypinator | 0:bb348c97df44 | 296 | /* Release Lock */ |
lypinator | 0:bb348c97df44 | 297 | __HAL_UNLOCK(hspdif); |
lypinator | 0:bb348c97df44 | 298 | |
lypinator | 0:bb348c97df44 | 299 | return HAL_OK; |
lypinator | 0:bb348c97df44 | 300 | } |
lypinator | 0:bb348c97df44 | 301 | |
lypinator | 0:bb348c97df44 | 302 | /** |
lypinator | 0:bb348c97df44 | 303 | * @brief SPDIFRX MSP Init |
lypinator | 0:bb348c97df44 | 304 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 305 | * @retval None |
lypinator | 0:bb348c97df44 | 306 | */ |
lypinator | 0:bb348c97df44 | 307 | __weak void HAL_SPDIFRX_MspInit(SPDIFRX_HandleTypeDef *hspdif) |
lypinator | 0:bb348c97df44 | 308 | { |
lypinator | 0:bb348c97df44 | 309 | /* Prevent unused argument(s) compilation warning */ |
lypinator | 0:bb348c97df44 | 310 | UNUSED(hspdif); |
lypinator | 0:bb348c97df44 | 311 | /* NOTE : This function Should not be modified, when the callback is needed, |
lypinator | 0:bb348c97df44 | 312 | the HAL_SPDIFRX_MspInit could be implemented in the user file |
lypinator | 0:bb348c97df44 | 313 | */ |
lypinator | 0:bb348c97df44 | 314 | } |
lypinator | 0:bb348c97df44 | 315 | |
lypinator | 0:bb348c97df44 | 316 | /** |
lypinator | 0:bb348c97df44 | 317 | * @brief SPDIFRX MSP DeInit |
lypinator | 0:bb348c97df44 | 318 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 319 | * @retval None |
lypinator | 0:bb348c97df44 | 320 | */ |
lypinator | 0:bb348c97df44 | 321 | __weak void HAL_SPDIFRX_MspDeInit(SPDIFRX_HandleTypeDef *hspdif) |
lypinator | 0:bb348c97df44 | 322 | { |
lypinator | 0:bb348c97df44 | 323 | /* Prevent unused argument(s) compilation warning */ |
lypinator | 0:bb348c97df44 | 324 | UNUSED(hspdif); |
lypinator | 0:bb348c97df44 | 325 | /* NOTE : This function Should not be modified, when the callback is needed, |
lypinator | 0:bb348c97df44 | 326 | the HAL_SPDIFRX_MspDeInit could be implemented in the user file |
lypinator | 0:bb348c97df44 | 327 | */ |
lypinator | 0:bb348c97df44 | 328 | } |
lypinator | 0:bb348c97df44 | 329 | |
lypinator | 0:bb348c97df44 | 330 | /** |
lypinator | 0:bb348c97df44 | 331 | * @brief Sets the SPDIFRX dtat format according to the specified parameters |
lypinator | 0:bb348c97df44 | 332 | * in the SPDIFRX_InitTypeDef. |
lypinator | 0:bb348c97df44 | 333 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 334 | * @param sDataFormat SPDIFRX data format |
lypinator | 0:bb348c97df44 | 335 | * @retval HAL status |
lypinator | 0:bb348c97df44 | 336 | */ |
lypinator | 0:bb348c97df44 | 337 | HAL_StatusTypeDef HAL_SPDIFRX_SetDataFormat(SPDIFRX_HandleTypeDef *hspdif, SPDIFRX_SetDataFormatTypeDef sDataFormat) |
lypinator | 0:bb348c97df44 | 338 | { |
lypinator | 0:bb348c97df44 | 339 | uint32_t tmpreg = 0U; |
lypinator | 0:bb348c97df44 | 340 | |
lypinator | 0:bb348c97df44 | 341 | /* Check the SPDIFRX handle allocation */ |
lypinator | 0:bb348c97df44 | 342 | if(hspdif == NULL) |
lypinator | 0:bb348c97df44 | 343 | { |
lypinator | 0:bb348c97df44 | 344 | return HAL_ERROR; |
lypinator | 0:bb348c97df44 | 345 | } |
lypinator | 0:bb348c97df44 | 346 | |
lypinator | 0:bb348c97df44 | 347 | /* Check the SPDIFRX parameters */ |
lypinator | 0:bb348c97df44 | 348 | assert_param(IS_STEREO_MODE(sDataFormat.StereoMode)); |
lypinator | 0:bb348c97df44 | 349 | assert_param(IS_SPDIFRX_DATA_FORMAT(sDataFormat.DataFormat)); |
lypinator | 0:bb348c97df44 | 350 | assert_param(IS_PREAMBLE_TYPE_MASK(sDataFormat.PreambleTypeMask)); |
lypinator | 0:bb348c97df44 | 351 | assert_param(IS_CHANNEL_STATUS_MASK(sDataFormat.ChannelStatusMask)); |
lypinator | 0:bb348c97df44 | 352 | assert_param(IS_VALIDITY_MASK(sDataFormat.ValidityBitMask)); |
lypinator | 0:bb348c97df44 | 353 | assert_param(IS_PARITY_ERROR_MASK(sDataFormat.ParityErrorMask)); |
lypinator | 0:bb348c97df44 | 354 | |
lypinator | 0:bb348c97df44 | 355 | /* Reset the old SPDIFRX CR configuration */ |
lypinator | 0:bb348c97df44 | 356 | tmpreg = hspdif->Instance->CR; |
lypinator | 0:bb348c97df44 | 357 | |
lypinator | 0:bb348c97df44 | 358 | if(((tmpreg & SPDIFRX_STATE_RCV) == SPDIFRX_STATE_RCV) && |
lypinator | 0:bb348c97df44 | 359 | (((tmpreg & SPDIFRX_CR_DRFMT) != sDataFormat.DataFormat) || |
lypinator | 0:bb348c97df44 | 360 | ((tmpreg & SPDIFRX_CR_RXSTEO) != sDataFormat.StereoMode))) |
lypinator | 0:bb348c97df44 | 361 | { |
lypinator | 0:bb348c97df44 | 362 | return HAL_ERROR; |
lypinator | 0:bb348c97df44 | 363 | } |
lypinator | 0:bb348c97df44 | 364 | |
lypinator | 0:bb348c97df44 | 365 | tmpreg &= ~((uint16_t) SPDIFRX_CR_RXSTEO | SPDIFRX_CR_DRFMT | SPDIFRX_CR_PMSK | |
lypinator | 0:bb348c97df44 | 366 | SPDIFRX_CR_VMSK | SPDIFRX_CR_CUMSK | SPDIFRX_CR_PTMSK); |
lypinator | 0:bb348c97df44 | 367 | |
lypinator | 0:bb348c97df44 | 368 | /* Sets the new configuration of the SPDIFRX peripheral */ |
lypinator | 0:bb348c97df44 | 369 | tmpreg |= ((uint16_t) sDataFormat.StereoMode | |
lypinator | 0:bb348c97df44 | 370 | sDataFormat.DataFormat | |
lypinator | 0:bb348c97df44 | 371 | sDataFormat.PreambleTypeMask | |
lypinator | 0:bb348c97df44 | 372 | sDataFormat.ChannelStatusMask | |
lypinator | 0:bb348c97df44 | 373 | sDataFormat.ValidityBitMask | |
lypinator | 0:bb348c97df44 | 374 | sDataFormat.ParityErrorMask); |
lypinator | 0:bb348c97df44 | 375 | |
lypinator | 0:bb348c97df44 | 376 | hspdif->Instance->CR = tmpreg; |
lypinator | 0:bb348c97df44 | 377 | |
lypinator | 0:bb348c97df44 | 378 | return HAL_OK; |
lypinator | 0:bb348c97df44 | 379 | } |
lypinator | 0:bb348c97df44 | 380 | |
lypinator | 0:bb348c97df44 | 381 | /** |
lypinator | 0:bb348c97df44 | 382 | * @} |
lypinator | 0:bb348c97df44 | 383 | */ |
lypinator | 0:bb348c97df44 | 384 | |
lypinator | 0:bb348c97df44 | 385 | /** @defgroup SPDIFRX_Exported_Functions_Group2 IO operation functions |
lypinator | 0:bb348c97df44 | 386 | * @brief Data transfers functions |
lypinator | 0:bb348c97df44 | 387 | * |
lypinator | 0:bb348c97df44 | 388 | @verbatim |
lypinator | 0:bb348c97df44 | 389 | =============================================================================== |
lypinator | 0:bb348c97df44 | 390 | ##### IO operation functions ##### |
lypinator | 0:bb348c97df44 | 391 | =============================================================================== |
lypinator | 0:bb348c97df44 | 392 | [..] |
lypinator | 0:bb348c97df44 | 393 | This subsection provides a set of functions allowing to manage the SPDIFRX data |
lypinator | 0:bb348c97df44 | 394 | transfers. |
lypinator | 0:bb348c97df44 | 395 | |
lypinator | 0:bb348c97df44 | 396 | (#) There is two mode of transfer: |
lypinator | 0:bb348c97df44 | 397 | (++) Blocking mode : The communication is performed in the polling mode. |
lypinator | 0:bb348c97df44 | 398 | The status of all data processing is returned by the same function |
lypinator | 0:bb348c97df44 | 399 | after finishing transfer. |
lypinator | 0:bb348c97df44 | 400 | (++) No-Blocking mode : The communication is performed using Interrupts |
lypinator | 0:bb348c97df44 | 401 | or DMA. These functions return the status of the transfer start-up. |
lypinator | 0:bb348c97df44 | 402 | The end of the data processing will be indicated through the |
lypinator | 0:bb348c97df44 | 403 | dedicated SPDIFRX IRQ when using Interrupt mode or the DMA IRQ when |
lypinator | 0:bb348c97df44 | 404 | using DMA mode. |
lypinator | 0:bb348c97df44 | 405 | |
lypinator | 0:bb348c97df44 | 406 | (#) Blocking mode functions are : |
lypinator | 0:bb348c97df44 | 407 | (++) HAL_SPDIFRX_ReceiveDataFlow() |
lypinator | 0:bb348c97df44 | 408 | (++) HAL_SPDIFRX_ReceiveControlFlow() |
lypinator | 0:bb348c97df44 | 409 | (+@) Do not use blocking mode to receive both control and data flow at the same time. |
lypinator | 0:bb348c97df44 | 410 | |
lypinator | 0:bb348c97df44 | 411 | (#) No-Blocking mode functions with Interrupt are : |
lypinator | 0:bb348c97df44 | 412 | (++) HAL_SPDIFRX_ReceiveControlFlow_IT() |
lypinator | 0:bb348c97df44 | 413 | (++) HAL_SPDIFRX_ReceiveDataFlow_IT() |
lypinator | 0:bb348c97df44 | 414 | |
lypinator | 0:bb348c97df44 | 415 | (#) No-Blocking mode functions with DMA are : |
lypinator | 0:bb348c97df44 | 416 | (++) HAL_SPDIFRX_ReceiveControlFlow_DMA() |
lypinator | 0:bb348c97df44 | 417 | (++) HAL_SPDIFRX_ReceiveDataFlow_DMA() |
lypinator | 0:bb348c97df44 | 418 | |
lypinator | 0:bb348c97df44 | 419 | (#) A set of Transfer Complete Callbacks are provided in No_Blocking mode: |
lypinator | 0:bb348c97df44 | 420 | (++) HAL_SPDIFRX_RxCpltCallback() |
lypinator | 0:bb348c97df44 | 421 | (++) HAL_SPDIFRX_ErrorCallback() |
lypinator | 0:bb348c97df44 | 422 | |
lypinator | 0:bb348c97df44 | 423 | @endverbatim |
lypinator | 0:bb348c97df44 | 424 | * @{ |
lypinator | 0:bb348c97df44 | 425 | */ |
lypinator | 0:bb348c97df44 | 426 | |
lypinator | 0:bb348c97df44 | 427 | /** |
lypinator | 0:bb348c97df44 | 428 | * @brief Receives an amount of data (Data Flow) in blocking mode. |
lypinator | 0:bb348c97df44 | 429 | * @param hspdif pointer to SPDIFRX_HandleTypeDef structure that contains |
lypinator | 0:bb348c97df44 | 430 | * the configuration information for SPDIFRX module. |
lypinator | 0:bb348c97df44 | 431 | * @param pData Pointer to data buffer |
lypinator | 0:bb348c97df44 | 432 | * @param Size Amount of data to be received |
lypinator | 0:bb348c97df44 | 433 | * @param Timeout Timeout duration |
lypinator | 0:bb348c97df44 | 434 | * @retval HAL status |
lypinator | 0:bb348c97df44 | 435 | */ |
lypinator | 0:bb348c97df44 | 436 | HAL_StatusTypeDef HAL_SPDIFRX_ReceiveDataFlow(SPDIFRX_HandleTypeDef *hspdif, uint32_t *pData, uint16_t Size, uint32_t Timeout) |
lypinator | 0:bb348c97df44 | 437 | { |
lypinator | 0:bb348c97df44 | 438 | if((pData == NULL ) || (Size == 0)) |
lypinator | 0:bb348c97df44 | 439 | { |
lypinator | 0:bb348c97df44 | 440 | return HAL_ERROR; |
lypinator | 0:bb348c97df44 | 441 | } |
lypinator | 0:bb348c97df44 | 442 | |
lypinator | 0:bb348c97df44 | 443 | if(hspdif->State == HAL_SPDIFRX_STATE_READY) |
lypinator | 0:bb348c97df44 | 444 | { |
lypinator | 0:bb348c97df44 | 445 | /* Process Locked */ |
lypinator | 0:bb348c97df44 | 446 | __HAL_LOCK(hspdif); |
lypinator | 0:bb348c97df44 | 447 | |
lypinator | 0:bb348c97df44 | 448 | hspdif->State = HAL_SPDIFRX_STATE_BUSY; |
lypinator | 0:bb348c97df44 | 449 | |
lypinator | 0:bb348c97df44 | 450 | /* Start synchronisation */ |
lypinator | 0:bb348c97df44 | 451 | __HAL_SPDIFRX_SYNC(hspdif); |
lypinator | 0:bb348c97df44 | 452 | |
lypinator | 0:bb348c97df44 | 453 | /* Wait until SYNCD flag is set */ |
lypinator | 0:bb348c97df44 | 454 | if(SPDIFRX_WaitOnFlagUntilTimeout(hspdif, SPDIFRX_FLAG_SYNCD, RESET, Timeout) != HAL_OK) |
lypinator | 0:bb348c97df44 | 455 | { |
lypinator | 0:bb348c97df44 | 456 | return HAL_TIMEOUT; |
lypinator | 0:bb348c97df44 | 457 | } |
lypinator | 0:bb348c97df44 | 458 | |
lypinator | 0:bb348c97df44 | 459 | /* Start reception */ |
lypinator | 0:bb348c97df44 | 460 | __HAL_SPDIFRX_RCV(hspdif); |
lypinator | 0:bb348c97df44 | 461 | |
lypinator | 0:bb348c97df44 | 462 | /* Receive data flow */ |
lypinator | 0:bb348c97df44 | 463 | while(Size > 0) |
lypinator | 0:bb348c97df44 | 464 | { |
lypinator | 0:bb348c97df44 | 465 | /* Wait until RXNE flag is set */ |
lypinator | 0:bb348c97df44 | 466 | if(SPDIFRX_WaitOnFlagUntilTimeout(hspdif, SPDIFRX_FLAG_RXNE, RESET, Timeout) != HAL_OK) |
lypinator | 0:bb348c97df44 | 467 | { |
lypinator | 0:bb348c97df44 | 468 | return HAL_TIMEOUT; |
lypinator | 0:bb348c97df44 | 469 | } |
lypinator | 0:bb348c97df44 | 470 | |
lypinator | 0:bb348c97df44 | 471 | (*pData++) = hspdif->Instance->DR; |
lypinator | 0:bb348c97df44 | 472 | Size--; |
lypinator | 0:bb348c97df44 | 473 | } |
lypinator | 0:bb348c97df44 | 474 | |
lypinator | 0:bb348c97df44 | 475 | /* SPDIFRX ready */ |
lypinator | 0:bb348c97df44 | 476 | hspdif->State = HAL_SPDIFRX_STATE_READY; |
lypinator | 0:bb348c97df44 | 477 | |
lypinator | 0:bb348c97df44 | 478 | /* Process Unlocked */ |
lypinator | 0:bb348c97df44 | 479 | __HAL_UNLOCK(hspdif); |
lypinator | 0:bb348c97df44 | 480 | |
lypinator | 0:bb348c97df44 | 481 | return HAL_OK; |
lypinator | 0:bb348c97df44 | 482 | } |
lypinator | 0:bb348c97df44 | 483 | else |
lypinator | 0:bb348c97df44 | 484 | { |
lypinator | 0:bb348c97df44 | 485 | return HAL_BUSY; |
lypinator | 0:bb348c97df44 | 486 | } |
lypinator | 0:bb348c97df44 | 487 | } |
lypinator | 0:bb348c97df44 | 488 | |
lypinator | 0:bb348c97df44 | 489 | /** |
lypinator | 0:bb348c97df44 | 490 | * @brief Receives an amount of data (Control Flow) in blocking mode. |
lypinator | 0:bb348c97df44 | 491 | * @param hspdif pointer to a SPDIFRX_HandleTypeDef structure that contains |
lypinator | 0:bb348c97df44 | 492 | * the configuration information for SPDIFRX module. |
lypinator | 0:bb348c97df44 | 493 | * @param pData Pointer to data buffer |
lypinator | 0:bb348c97df44 | 494 | * @param Size Amount of data to be received |
lypinator | 0:bb348c97df44 | 495 | * @param Timeout Timeout duration |
lypinator | 0:bb348c97df44 | 496 | * @retval HAL status |
lypinator | 0:bb348c97df44 | 497 | */ |
lypinator | 0:bb348c97df44 | 498 | HAL_StatusTypeDef HAL_SPDIFRX_ReceiveControlFlow(SPDIFRX_HandleTypeDef *hspdif, uint32_t *pData, uint16_t Size, uint32_t Timeout) |
lypinator | 0:bb348c97df44 | 499 | { |
lypinator | 0:bb348c97df44 | 500 | if((pData == NULL ) || (Size == 0)) |
lypinator | 0:bb348c97df44 | 501 | { |
lypinator | 0:bb348c97df44 | 502 | return HAL_ERROR; |
lypinator | 0:bb348c97df44 | 503 | } |
lypinator | 0:bb348c97df44 | 504 | |
lypinator | 0:bb348c97df44 | 505 | if(hspdif->State == HAL_SPDIFRX_STATE_READY) |
lypinator | 0:bb348c97df44 | 506 | { |
lypinator | 0:bb348c97df44 | 507 | /* Process Locked */ |
lypinator | 0:bb348c97df44 | 508 | __HAL_LOCK(hspdif); |
lypinator | 0:bb348c97df44 | 509 | |
lypinator | 0:bb348c97df44 | 510 | hspdif->State = HAL_SPDIFRX_STATE_BUSY; |
lypinator | 0:bb348c97df44 | 511 | |
lypinator | 0:bb348c97df44 | 512 | /* Start synchronization */ |
lypinator | 0:bb348c97df44 | 513 | __HAL_SPDIFRX_SYNC(hspdif); |
lypinator | 0:bb348c97df44 | 514 | |
lypinator | 0:bb348c97df44 | 515 | /* Wait until SYNCD flag is set */ |
lypinator | 0:bb348c97df44 | 516 | if(SPDIFRX_WaitOnFlagUntilTimeout(hspdif, SPDIFRX_FLAG_SYNCD, RESET, Timeout) != HAL_OK) |
lypinator | 0:bb348c97df44 | 517 | { |
lypinator | 0:bb348c97df44 | 518 | return HAL_TIMEOUT; |
lypinator | 0:bb348c97df44 | 519 | } |
lypinator | 0:bb348c97df44 | 520 | |
lypinator | 0:bb348c97df44 | 521 | /* Start reception */ |
lypinator | 0:bb348c97df44 | 522 | __HAL_SPDIFRX_RCV(hspdif); |
lypinator | 0:bb348c97df44 | 523 | |
lypinator | 0:bb348c97df44 | 524 | /* Receive control flow */ |
lypinator | 0:bb348c97df44 | 525 | while(Size > 0) |
lypinator | 0:bb348c97df44 | 526 | { |
lypinator | 0:bb348c97df44 | 527 | /* Wait until CSRNE flag is set */ |
lypinator | 0:bb348c97df44 | 528 | if(SPDIFRX_WaitOnFlagUntilTimeout(hspdif, SPDIFRX_FLAG_CSRNE, RESET, Timeout) != HAL_OK) |
lypinator | 0:bb348c97df44 | 529 | { |
lypinator | 0:bb348c97df44 | 530 | return HAL_TIMEOUT; |
lypinator | 0:bb348c97df44 | 531 | } |
lypinator | 0:bb348c97df44 | 532 | |
lypinator | 0:bb348c97df44 | 533 | (*pData++) = hspdif->Instance->CSR; |
lypinator | 0:bb348c97df44 | 534 | Size--; |
lypinator | 0:bb348c97df44 | 535 | } |
lypinator | 0:bb348c97df44 | 536 | |
lypinator | 0:bb348c97df44 | 537 | /* SPDIFRX ready */ |
lypinator | 0:bb348c97df44 | 538 | hspdif->State = HAL_SPDIFRX_STATE_READY; |
lypinator | 0:bb348c97df44 | 539 | |
lypinator | 0:bb348c97df44 | 540 | /* Process Unlocked */ |
lypinator | 0:bb348c97df44 | 541 | __HAL_UNLOCK(hspdif); |
lypinator | 0:bb348c97df44 | 542 | |
lypinator | 0:bb348c97df44 | 543 | return HAL_OK; |
lypinator | 0:bb348c97df44 | 544 | } |
lypinator | 0:bb348c97df44 | 545 | else |
lypinator | 0:bb348c97df44 | 546 | { |
lypinator | 0:bb348c97df44 | 547 | return HAL_BUSY; |
lypinator | 0:bb348c97df44 | 548 | } |
lypinator | 0:bb348c97df44 | 549 | } |
lypinator | 0:bb348c97df44 | 550 | /** |
lypinator | 0:bb348c97df44 | 551 | * @brief Receive an amount of data (Data Flow) in non-blocking mode with Interrupt |
lypinator | 0:bb348c97df44 | 552 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 553 | * @param pData a 32-bit pointer to the Receive data buffer. |
lypinator | 0:bb348c97df44 | 554 | * @param Size number of data sample to be received . |
lypinator | 0:bb348c97df44 | 555 | * @retval HAL status |
lypinator | 0:bb348c97df44 | 556 | */ |
lypinator | 0:bb348c97df44 | 557 | HAL_StatusTypeDef HAL_SPDIFRX_ReceiveDataFlow_IT(SPDIFRX_HandleTypeDef *hspdif, uint32_t *pData, uint16_t Size) |
lypinator | 0:bb348c97df44 | 558 | { |
lypinator | 0:bb348c97df44 | 559 | __IO uint32_t count = SPDIFRX_TIMEOUT_VALUE * (SystemCoreClock / 24U / 1000U); |
lypinator | 0:bb348c97df44 | 560 | |
lypinator | 0:bb348c97df44 | 561 | if((hspdif->State == HAL_SPDIFRX_STATE_READY) || (hspdif->State == HAL_SPDIFRX_STATE_BUSY_CX)) |
lypinator | 0:bb348c97df44 | 562 | { |
lypinator | 0:bb348c97df44 | 563 | if((pData == NULL) || (Size == 0)) |
lypinator | 0:bb348c97df44 | 564 | { |
lypinator | 0:bb348c97df44 | 565 | return HAL_ERROR; |
lypinator | 0:bb348c97df44 | 566 | } |
lypinator | 0:bb348c97df44 | 567 | |
lypinator | 0:bb348c97df44 | 568 | /* Process Locked */ |
lypinator | 0:bb348c97df44 | 569 | __HAL_LOCK(hspdif); |
lypinator | 0:bb348c97df44 | 570 | |
lypinator | 0:bb348c97df44 | 571 | hspdif->pRxBuffPtr = pData; |
lypinator | 0:bb348c97df44 | 572 | hspdif->RxXferSize = Size; |
lypinator | 0:bb348c97df44 | 573 | hspdif->RxXferCount = Size; |
lypinator | 0:bb348c97df44 | 574 | |
lypinator | 0:bb348c97df44 | 575 | hspdif->ErrorCode = HAL_SPDIFRX_ERROR_NONE; |
lypinator | 0:bb348c97df44 | 576 | |
lypinator | 0:bb348c97df44 | 577 | /* Check if a receive process is ongoing or not */ |
lypinator | 0:bb348c97df44 | 578 | hspdif->State = HAL_SPDIFRX_STATE_BUSY_RX; |
lypinator | 0:bb348c97df44 | 579 | |
lypinator | 0:bb348c97df44 | 580 | /* Enable the SPDIFRX PE Error Interrupt */ |
lypinator | 0:bb348c97df44 | 581 | __HAL_SPDIFRX_ENABLE_IT(hspdif, SPDIFRX_IT_PERRIE); |
lypinator | 0:bb348c97df44 | 582 | |
lypinator | 0:bb348c97df44 | 583 | /* Enable the SPDIFRX OVR Error Interrupt */ |
lypinator | 0:bb348c97df44 | 584 | __HAL_SPDIFRX_ENABLE_IT(hspdif, SPDIFRX_IT_OVRIE); |
lypinator | 0:bb348c97df44 | 585 | |
lypinator | 0:bb348c97df44 | 586 | /* Process Unlocked */ |
lypinator | 0:bb348c97df44 | 587 | __HAL_UNLOCK(hspdif); |
lypinator | 0:bb348c97df44 | 588 | |
lypinator | 0:bb348c97df44 | 589 | /* Enable the SPDIFRX RXNE interrupt */ |
lypinator | 0:bb348c97df44 | 590 | __HAL_SPDIFRX_ENABLE_IT(hspdif, SPDIFRX_IT_RXNE); |
lypinator | 0:bb348c97df44 | 591 | |
lypinator | 0:bb348c97df44 | 592 | if ((SPDIFRX->CR & SPDIFRX_CR_SPDIFEN) != SPDIFRX_STATE_SYNC || (SPDIFRX->CR & SPDIFRX_CR_SPDIFEN) != 0x00U) |
lypinator | 0:bb348c97df44 | 593 | { |
lypinator | 0:bb348c97df44 | 594 | /* Start synchronization */ |
lypinator | 0:bb348c97df44 | 595 | __HAL_SPDIFRX_SYNC(hspdif); |
lypinator | 0:bb348c97df44 | 596 | |
lypinator | 0:bb348c97df44 | 597 | /* Wait until SYNCD flag is set */ |
lypinator | 0:bb348c97df44 | 598 | do |
lypinator | 0:bb348c97df44 | 599 | { |
lypinator | 0:bb348c97df44 | 600 | if (count-- == 0U) |
lypinator | 0:bb348c97df44 | 601 | { |
lypinator | 0:bb348c97df44 | 602 | /* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt process */ |
lypinator | 0:bb348c97df44 | 603 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_RXNE); |
lypinator | 0:bb348c97df44 | 604 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_CSRNE); |
lypinator | 0:bb348c97df44 | 605 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_PERRIE); |
lypinator | 0:bb348c97df44 | 606 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_OVRIE); |
lypinator | 0:bb348c97df44 | 607 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_SBLKIE); |
lypinator | 0:bb348c97df44 | 608 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_SYNCDIE); |
lypinator | 0:bb348c97df44 | 609 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_IFEIE); |
lypinator | 0:bb348c97df44 | 610 | |
lypinator | 0:bb348c97df44 | 611 | hspdif->State= HAL_SPDIFRX_STATE_READY; |
lypinator | 0:bb348c97df44 | 612 | |
lypinator | 0:bb348c97df44 | 613 | /* Process Unlocked */ |
lypinator | 0:bb348c97df44 | 614 | __HAL_UNLOCK(hspdif); |
lypinator | 0:bb348c97df44 | 615 | |
lypinator | 0:bb348c97df44 | 616 | return HAL_TIMEOUT; |
lypinator | 0:bb348c97df44 | 617 | } |
lypinator | 0:bb348c97df44 | 618 | } |
lypinator | 0:bb348c97df44 | 619 | while (__HAL_SPDIFRX_GET_FLAG(hspdif, SPDIFRX_FLAG_SYNCD) == RESET); |
lypinator | 0:bb348c97df44 | 620 | |
lypinator | 0:bb348c97df44 | 621 | /* Start reception */ |
lypinator | 0:bb348c97df44 | 622 | __HAL_SPDIFRX_RCV(hspdif); |
lypinator | 0:bb348c97df44 | 623 | } |
lypinator | 0:bb348c97df44 | 624 | |
lypinator | 0:bb348c97df44 | 625 | return HAL_OK; |
lypinator | 0:bb348c97df44 | 626 | } |
lypinator | 0:bb348c97df44 | 627 | else |
lypinator | 0:bb348c97df44 | 628 | { |
lypinator | 0:bb348c97df44 | 629 | return HAL_BUSY; |
lypinator | 0:bb348c97df44 | 630 | } |
lypinator | 0:bb348c97df44 | 631 | } |
lypinator | 0:bb348c97df44 | 632 | |
lypinator | 0:bb348c97df44 | 633 | /** |
lypinator | 0:bb348c97df44 | 634 | * @brief Receive an amount of data (Control Flow) with Interrupt |
lypinator | 0:bb348c97df44 | 635 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 636 | * @param pData a 32-bit pointer to the Receive data buffer. |
lypinator | 0:bb348c97df44 | 637 | * @param Size number of data sample (Control Flow) to be received : |
lypinator | 0:bb348c97df44 | 638 | * @retval HAL status |
lypinator | 0:bb348c97df44 | 639 | */ |
lypinator | 0:bb348c97df44 | 640 | HAL_StatusTypeDef HAL_SPDIFRX_ReceiveControlFlow_IT(SPDIFRX_HandleTypeDef *hspdif, uint32_t *pData, uint16_t Size) |
lypinator | 0:bb348c97df44 | 641 | { |
lypinator | 0:bb348c97df44 | 642 | __IO uint32_t count = SPDIFRX_TIMEOUT_VALUE * (SystemCoreClock / 24U / 1000U); |
lypinator | 0:bb348c97df44 | 643 | |
lypinator | 0:bb348c97df44 | 644 | if((hspdif->State == HAL_SPDIFRX_STATE_READY) || (hspdif->State == HAL_SPDIFRX_STATE_BUSY_RX)) |
lypinator | 0:bb348c97df44 | 645 | { |
lypinator | 0:bb348c97df44 | 646 | if((pData == NULL ) || (Size == 0)) |
lypinator | 0:bb348c97df44 | 647 | { |
lypinator | 0:bb348c97df44 | 648 | return HAL_ERROR; |
lypinator | 0:bb348c97df44 | 649 | } |
lypinator | 0:bb348c97df44 | 650 | |
lypinator | 0:bb348c97df44 | 651 | /* Process Locked */ |
lypinator | 0:bb348c97df44 | 652 | __HAL_LOCK(hspdif); |
lypinator | 0:bb348c97df44 | 653 | |
lypinator | 0:bb348c97df44 | 654 | hspdif->pCsBuffPtr = pData; |
lypinator | 0:bb348c97df44 | 655 | hspdif->CsXferSize = Size; |
lypinator | 0:bb348c97df44 | 656 | hspdif->CsXferCount = Size; |
lypinator | 0:bb348c97df44 | 657 | |
lypinator | 0:bb348c97df44 | 658 | hspdif->ErrorCode = HAL_SPDIFRX_ERROR_NONE; |
lypinator | 0:bb348c97df44 | 659 | |
lypinator | 0:bb348c97df44 | 660 | /* Check if a receive process is ongoing or not */ |
lypinator | 0:bb348c97df44 | 661 | hspdif->State = HAL_SPDIFRX_STATE_BUSY_CX; |
lypinator | 0:bb348c97df44 | 662 | |
lypinator | 0:bb348c97df44 | 663 | /* Enable the SPDIFRX PE Error Interrupt */ |
lypinator | 0:bb348c97df44 | 664 | __HAL_SPDIFRX_ENABLE_IT(hspdif, SPDIFRX_IT_PERRIE); |
lypinator | 0:bb348c97df44 | 665 | |
lypinator | 0:bb348c97df44 | 666 | /* Enable the SPDIFRX OVR Error Interrupt */ |
lypinator | 0:bb348c97df44 | 667 | __HAL_SPDIFRX_ENABLE_IT(hspdif, SPDIFRX_IT_OVRIE); |
lypinator | 0:bb348c97df44 | 668 | |
lypinator | 0:bb348c97df44 | 669 | /* Process Unlocked */ |
lypinator | 0:bb348c97df44 | 670 | __HAL_UNLOCK(hspdif); |
lypinator | 0:bb348c97df44 | 671 | |
lypinator | 0:bb348c97df44 | 672 | /* Enable the SPDIFRX CSRNE interrupt */ |
lypinator | 0:bb348c97df44 | 673 | __HAL_SPDIFRX_ENABLE_IT(hspdif, SPDIFRX_IT_CSRNE); |
lypinator | 0:bb348c97df44 | 674 | |
lypinator | 0:bb348c97df44 | 675 | if ((SPDIFRX->CR & SPDIFRX_CR_SPDIFEN) != SPDIFRX_STATE_SYNC || (SPDIFRX->CR & SPDIFRX_CR_SPDIFEN) != 0x00U) |
lypinator | 0:bb348c97df44 | 676 | { |
lypinator | 0:bb348c97df44 | 677 | /* Start synchronization */ |
lypinator | 0:bb348c97df44 | 678 | __HAL_SPDIFRX_SYNC(hspdif); |
lypinator | 0:bb348c97df44 | 679 | |
lypinator | 0:bb348c97df44 | 680 | /* Wait until SYNCD flag is set */ |
lypinator | 0:bb348c97df44 | 681 | do |
lypinator | 0:bb348c97df44 | 682 | { |
lypinator | 0:bb348c97df44 | 683 | if (count-- == 0U) |
lypinator | 0:bb348c97df44 | 684 | { |
lypinator | 0:bb348c97df44 | 685 | /* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt process */ |
lypinator | 0:bb348c97df44 | 686 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_RXNE); |
lypinator | 0:bb348c97df44 | 687 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_CSRNE); |
lypinator | 0:bb348c97df44 | 688 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_PERRIE); |
lypinator | 0:bb348c97df44 | 689 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_OVRIE); |
lypinator | 0:bb348c97df44 | 690 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_SBLKIE); |
lypinator | 0:bb348c97df44 | 691 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_SYNCDIE); |
lypinator | 0:bb348c97df44 | 692 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_IFEIE); |
lypinator | 0:bb348c97df44 | 693 | |
lypinator | 0:bb348c97df44 | 694 | hspdif->State= HAL_SPDIFRX_STATE_READY; |
lypinator | 0:bb348c97df44 | 695 | |
lypinator | 0:bb348c97df44 | 696 | /* Process Unlocked */ |
lypinator | 0:bb348c97df44 | 697 | __HAL_UNLOCK(hspdif); |
lypinator | 0:bb348c97df44 | 698 | |
lypinator | 0:bb348c97df44 | 699 | return HAL_TIMEOUT; |
lypinator | 0:bb348c97df44 | 700 | } |
lypinator | 0:bb348c97df44 | 701 | } |
lypinator | 0:bb348c97df44 | 702 | while (__HAL_SPDIFRX_GET_FLAG(hspdif, SPDIFRX_FLAG_SYNCD) == RESET); |
lypinator | 0:bb348c97df44 | 703 | |
lypinator | 0:bb348c97df44 | 704 | /* Start reception */ |
lypinator | 0:bb348c97df44 | 705 | __HAL_SPDIFRX_RCV(hspdif); |
lypinator | 0:bb348c97df44 | 706 | } |
lypinator | 0:bb348c97df44 | 707 | |
lypinator | 0:bb348c97df44 | 708 | return HAL_OK; |
lypinator | 0:bb348c97df44 | 709 | } |
lypinator | 0:bb348c97df44 | 710 | else |
lypinator | 0:bb348c97df44 | 711 | { |
lypinator | 0:bb348c97df44 | 712 | return HAL_BUSY; |
lypinator | 0:bb348c97df44 | 713 | } |
lypinator | 0:bb348c97df44 | 714 | } |
lypinator | 0:bb348c97df44 | 715 | |
lypinator | 0:bb348c97df44 | 716 | /** |
lypinator | 0:bb348c97df44 | 717 | * @brief Receive an amount of data (Data Flow) mode with DMA |
lypinator | 0:bb348c97df44 | 718 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 719 | * @param pData a 32-bit pointer to the Receive data buffer. |
lypinator | 0:bb348c97df44 | 720 | * @param Size number of data sample to be received : |
lypinator | 0:bb348c97df44 | 721 | * @retval HAL status |
lypinator | 0:bb348c97df44 | 722 | */ |
lypinator | 0:bb348c97df44 | 723 | HAL_StatusTypeDef HAL_SPDIFRX_ReceiveDataFlow_DMA(SPDIFRX_HandleTypeDef *hspdif, uint32_t *pData, uint16_t Size) |
lypinator | 0:bb348c97df44 | 724 | { |
lypinator | 0:bb348c97df44 | 725 | __IO uint32_t count = SPDIFRX_TIMEOUT_VALUE * (SystemCoreClock / 24U / 1000U); |
lypinator | 0:bb348c97df44 | 726 | |
lypinator | 0:bb348c97df44 | 727 | if((pData == NULL) || (Size == 0)) |
lypinator | 0:bb348c97df44 | 728 | { |
lypinator | 0:bb348c97df44 | 729 | return HAL_ERROR; |
lypinator | 0:bb348c97df44 | 730 | } |
lypinator | 0:bb348c97df44 | 731 | |
lypinator | 0:bb348c97df44 | 732 | if((hspdif->State == HAL_SPDIFRX_STATE_READY) || (hspdif->State == HAL_SPDIFRX_STATE_BUSY_CX)) |
lypinator | 0:bb348c97df44 | 733 | { |
lypinator | 0:bb348c97df44 | 734 | hspdif->pRxBuffPtr = pData; |
lypinator | 0:bb348c97df44 | 735 | hspdif->RxXferSize = Size; |
lypinator | 0:bb348c97df44 | 736 | hspdif->RxXferCount = Size; |
lypinator | 0:bb348c97df44 | 737 | |
lypinator | 0:bb348c97df44 | 738 | /* Process Locked */ |
lypinator | 0:bb348c97df44 | 739 | __HAL_LOCK(hspdif); |
lypinator | 0:bb348c97df44 | 740 | |
lypinator | 0:bb348c97df44 | 741 | hspdif->ErrorCode = HAL_SPDIFRX_ERROR_NONE; |
lypinator | 0:bb348c97df44 | 742 | hspdif->State = HAL_SPDIFRX_STATE_BUSY_RX; |
lypinator | 0:bb348c97df44 | 743 | |
lypinator | 0:bb348c97df44 | 744 | /* Set the SPDIFRX Rx DMA Half transfer complete callback */ |
lypinator | 0:bb348c97df44 | 745 | hspdif->hdmaDrRx->XferHalfCpltCallback = SPDIFRX_DMARxHalfCplt; |
lypinator | 0:bb348c97df44 | 746 | |
lypinator | 0:bb348c97df44 | 747 | /* Set the SPDIFRX Rx DMA transfer complete callback */ |
lypinator | 0:bb348c97df44 | 748 | hspdif->hdmaDrRx->XferCpltCallback = SPDIFRX_DMARxCplt; |
lypinator | 0:bb348c97df44 | 749 | |
lypinator | 0:bb348c97df44 | 750 | /* Set the DMA error callback */ |
lypinator | 0:bb348c97df44 | 751 | hspdif->hdmaDrRx->XferErrorCallback = SPDIFRX_DMAError; |
lypinator | 0:bb348c97df44 | 752 | |
lypinator | 0:bb348c97df44 | 753 | /* Enable the DMA request */ |
lypinator | 0:bb348c97df44 | 754 | HAL_DMA_Start_IT(hspdif->hdmaDrRx, (uint32_t)&hspdif->Instance->DR, (uint32_t)hspdif->pRxBuffPtr, Size); |
lypinator | 0:bb348c97df44 | 755 | |
lypinator | 0:bb348c97df44 | 756 | /* Enable RXDMAEN bit in SPDIFRX CR register for data flow reception*/ |
lypinator | 0:bb348c97df44 | 757 | hspdif->Instance->CR |= SPDIFRX_CR_RXDMAEN; |
lypinator | 0:bb348c97df44 | 758 | |
lypinator | 0:bb348c97df44 | 759 | if ((SPDIFRX->CR & SPDIFRX_CR_SPDIFEN) != SPDIFRX_STATE_SYNC || (SPDIFRX->CR & SPDIFRX_CR_SPDIFEN) != 0x00U) |
lypinator | 0:bb348c97df44 | 760 | { |
lypinator | 0:bb348c97df44 | 761 | /* Start synchronization */ |
lypinator | 0:bb348c97df44 | 762 | __HAL_SPDIFRX_SYNC(hspdif); |
lypinator | 0:bb348c97df44 | 763 | |
lypinator | 0:bb348c97df44 | 764 | /* Wait until SYNCD flag is set */ |
lypinator | 0:bb348c97df44 | 765 | do |
lypinator | 0:bb348c97df44 | 766 | { |
lypinator | 0:bb348c97df44 | 767 | if (count-- == 0U) |
lypinator | 0:bb348c97df44 | 768 | { |
lypinator | 0:bb348c97df44 | 769 | /* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt process */ |
lypinator | 0:bb348c97df44 | 770 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_RXNE); |
lypinator | 0:bb348c97df44 | 771 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_CSRNE); |
lypinator | 0:bb348c97df44 | 772 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_PERRIE); |
lypinator | 0:bb348c97df44 | 773 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_OVRIE); |
lypinator | 0:bb348c97df44 | 774 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_SBLKIE); |
lypinator | 0:bb348c97df44 | 775 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_SYNCDIE); |
lypinator | 0:bb348c97df44 | 776 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_IFEIE); |
lypinator | 0:bb348c97df44 | 777 | |
lypinator | 0:bb348c97df44 | 778 | hspdif->State= HAL_SPDIFRX_STATE_READY; |
lypinator | 0:bb348c97df44 | 779 | |
lypinator | 0:bb348c97df44 | 780 | /* Process Unlocked */ |
lypinator | 0:bb348c97df44 | 781 | __HAL_UNLOCK(hspdif); |
lypinator | 0:bb348c97df44 | 782 | |
lypinator | 0:bb348c97df44 | 783 | return HAL_TIMEOUT; |
lypinator | 0:bb348c97df44 | 784 | } |
lypinator | 0:bb348c97df44 | 785 | } |
lypinator | 0:bb348c97df44 | 786 | while (__HAL_SPDIFRX_GET_FLAG(hspdif, SPDIFRX_FLAG_SYNCD) == RESET); |
lypinator | 0:bb348c97df44 | 787 | |
lypinator | 0:bb348c97df44 | 788 | /* Start reception */ |
lypinator | 0:bb348c97df44 | 789 | __HAL_SPDIFRX_RCV(hspdif); |
lypinator | 0:bb348c97df44 | 790 | } |
lypinator | 0:bb348c97df44 | 791 | |
lypinator | 0:bb348c97df44 | 792 | /* Process Unlocked */ |
lypinator | 0:bb348c97df44 | 793 | __HAL_UNLOCK(hspdif); |
lypinator | 0:bb348c97df44 | 794 | |
lypinator | 0:bb348c97df44 | 795 | return HAL_OK; |
lypinator | 0:bb348c97df44 | 796 | } |
lypinator | 0:bb348c97df44 | 797 | else |
lypinator | 0:bb348c97df44 | 798 | { |
lypinator | 0:bb348c97df44 | 799 | return HAL_BUSY; |
lypinator | 0:bb348c97df44 | 800 | } |
lypinator | 0:bb348c97df44 | 801 | } |
lypinator | 0:bb348c97df44 | 802 | |
lypinator | 0:bb348c97df44 | 803 | /** |
lypinator | 0:bb348c97df44 | 804 | * @brief Receive an amount of data (Control Flow) with DMA |
lypinator | 0:bb348c97df44 | 805 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 806 | * @param pData a 32-bit pointer to the Receive data buffer. |
lypinator | 0:bb348c97df44 | 807 | * @param Size number of data (Control Flow) sample to be received : |
lypinator | 0:bb348c97df44 | 808 | * @retval HAL status |
lypinator | 0:bb348c97df44 | 809 | */ |
lypinator | 0:bb348c97df44 | 810 | HAL_StatusTypeDef HAL_SPDIFRX_ReceiveControlFlow_DMA(SPDIFRX_HandleTypeDef *hspdif, uint32_t *pData, uint16_t Size) |
lypinator | 0:bb348c97df44 | 811 | { |
lypinator | 0:bb348c97df44 | 812 | __IO uint32_t count = SPDIFRX_TIMEOUT_VALUE * (SystemCoreClock / 24U / 1000U); |
lypinator | 0:bb348c97df44 | 813 | |
lypinator | 0:bb348c97df44 | 814 | if((pData == NULL) || (Size == 0)) |
lypinator | 0:bb348c97df44 | 815 | { |
lypinator | 0:bb348c97df44 | 816 | return HAL_ERROR; |
lypinator | 0:bb348c97df44 | 817 | } |
lypinator | 0:bb348c97df44 | 818 | |
lypinator | 0:bb348c97df44 | 819 | if((hspdif->State == HAL_SPDIFRX_STATE_READY) || (hspdif->State == HAL_SPDIFRX_STATE_BUSY_RX)) |
lypinator | 0:bb348c97df44 | 820 | { |
lypinator | 0:bb348c97df44 | 821 | hspdif->pCsBuffPtr = pData; |
lypinator | 0:bb348c97df44 | 822 | hspdif->CsXferSize = Size; |
lypinator | 0:bb348c97df44 | 823 | hspdif->CsXferCount = Size; |
lypinator | 0:bb348c97df44 | 824 | |
lypinator | 0:bb348c97df44 | 825 | /* Process Locked */ |
lypinator | 0:bb348c97df44 | 826 | __HAL_LOCK(hspdif); |
lypinator | 0:bb348c97df44 | 827 | |
lypinator | 0:bb348c97df44 | 828 | hspdif->ErrorCode = HAL_SPDIFRX_ERROR_NONE; |
lypinator | 0:bb348c97df44 | 829 | hspdif->State = HAL_SPDIFRX_STATE_BUSY_CX; |
lypinator | 0:bb348c97df44 | 830 | |
lypinator | 0:bb348c97df44 | 831 | /* Set the SPDIFRX Rx DMA Half transfer complete callback */ |
lypinator | 0:bb348c97df44 | 832 | hspdif->hdmaCsRx->XferHalfCpltCallback = SPDIFRX_DMACxHalfCplt; |
lypinator | 0:bb348c97df44 | 833 | |
lypinator | 0:bb348c97df44 | 834 | /* Set the SPDIFRX Rx DMA transfer complete callback */ |
lypinator | 0:bb348c97df44 | 835 | hspdif->hdmaCsRx->XferCpltCallback = SPDIFRX_DMACxCplt; |
lypinator | 0:bb348c97df44 | 836 | |
lypinator | 0:bb348c97df44 | 837 | /* Set the DMA error callback */ |
lypinator | 0:bb348c97df44 | 838 | hspdif->hdmaCsRx->XferErrorCallback = SPDIFRX_DMAError; |
lypinator | 0:bb348c97df44 | 839 | |
lypinator | 0:bb348c97df44 | 840 | /* Enable the DMA request */ |
lypinator | 0:bb348c97df44 | 841 | HAL_DMA_Start_IT(hspdif->hdmaCsRx, (uint32_t)&hspdif->Instance->CSR, (uint32_t)hspdif->pCsBuffPtr, Size); |
lypinator | 0:bb348c97df44 | 842 | |
lypinator | 0:bb348c97df44 | 843 | /* Enable CBDMAEN bit in SPDIFRX CR register for control flow reception*/ |
lypinator | 0:bb348c97df44 | 844 | hspdif->Instance->CR |= SPDIFRX_CR_CBDMAEN; |
lypinator | 0:bb348c97df44 | 845 | |
lypinator | 0:bb348c97df44 | 846 | if ((SPDIFRX->CR & SPDIFRX_CR_SPDIFEN) != SPDIFRX_STATE_SYNC || (SPDIFRX->CR & SPDIFRX_CR_SPDIFEN) != 0x00U) |
lypinator | 0:bb348c97df44 | 847 | { |
lypinator | 0:bb348c97df44 | 848 | /* Start synchronization */ |
lypinator | 0:bb348c97df44 | 849 | __HAL_SPDIFRX_SYNC(hspdif); |
lypinator | 0:bb348c97df44 | 850 | |
lypinator | 0:bb348c97df44 | 851 | /* Wait until SYNCD flag is set */ |
lypinator | 0:bb348c97df44 | 852 | do |
lypinator | 0:bb348c97df44 | 853 | { |
lypinator | 0:bb348c97df44 | 854 | if (count-- == 0U) |
lypinator | 0:bb348c97df44 | 855 | { |
lypinator | 0:bb348c97df44 | 856 | /* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt process */ |
lypinator | 0:bb348c97df44 | 857 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_RXNE); |
lypinator | 0:bb348c97df44 | 858 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_CSRNE); |
lypinator | 0:bb348c97df44 | 859 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_PERRIE); |
lypinator | 0:bb348c97df44 | 860 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_OVRIE); |
lypinator | 0:bb348c97df44 | 861 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_SBLKIE); |
lypinator | 0:bb348c97df44 | 862 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_SYNCDIE); |
lypinator | 0:bb348c97df44 | 863 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_IFEIE); |
lypinator | 0:bb348c97df44 | 864 | |
lypinator | 0:bb348c97df44 | 865 | hspdif->State= HAL_SPDIFRX_STATE_READY; |
lypinator | 0:bb348c97df44 | 866 | |
lypinator | 0:bb348c97df44 | 867 | /* Process Unlocked */ |
lypinator | 0:bb348c97df44 | 868 | __HAL_UNLOCK(hspdif); |
lypinator | 0:bb348c97df44 | 869 | |
lypinator | 0:bb348c97df44 | 870 | return HAL_TIMEOUT; |
lypinator | 0:bb348c97df44 | 871 | } |
lypinator | 0:bb348c97df44 | 872 | } |
lypinator | 0:bb348c97df44 | 873 | while (__HAL_SPDIFRX_GET_FLAG(hspdif, SPDIFRX_FLAG_SYNCD) == RESET); |
lypinator | 0:bb348c97df44 | 874 | |
lypinator | 0:bb348c97df44 | 875 | /* Start reception */ |
lypinator | 0:bb348c97df44 | 876 | __HAL_SPDIFRX_RCV(hspdif); |
lypinator | 0:bb348c97df44 | 877 | } |
lypinator | 0:bb348c97df44 | 878 | |
lypinator | 0:bb348c97df44 | 879 | /* Process Unlocked */ |
lypinator | 0:bb348c97df44 | 880 | __HAL_UNLOCK(hspdif); |
lypinator | 0:bb348c97df44 | 881 | |
lypinator | 0:bb348c97df44 | 882 | return HAL_OK; |
lypinator | 0:bb348c97df44 | 883 | } |
lypinator | 0:bb348c97df44 | 884 | else |
lypinator | 0:bb348c97df44 | 885 | { |
lypinator | 0:bb348c97df44 | 886 | return HAL_BUSY; |
lypinator | 0:bb348c97df44 | 887 | } |
lypinator | 0:bb348c97df44 | 888 | } |
lypinator | 0:bb348c97df44 | 889 | |
lypinator | 0:bb348c97df44 | 890 | /** |
lypinator | 0:bb348c97df44 | 891 | * @brief stop the audio stream receive from the Media. |
lypinator | 0:bb348c97df44 | 892 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 893 | * @retval None |
lypinator | 0:bb348c97df44 | 894 | */ |
lypinator | 0:bb348c97df44 | 895 | HAL_StatusTypeDef HAL_SPDIFRX_DMAStop(SPDIFRX_HandleTypeDef *hspdif) |
lypinator | 0:bb348c97df44 | 896 | { |
lypinator | 0:bb348c97df44 | 897 | /* Process Locked */ |
lypinator | 0:bb348c97df44 | 898 | __HAL_LOCK(hspdif); |
lypinator | 0:bb348c97df44 | 899 | |
lypinator | 0:bb348c97df44 | 900 | /* Disable the SPDIFRX DMA requests */ |
lypinator | 0:bb348c97df44 | 901 | hspdif->Instance->CR &= (uint16_t)(~SPDIFRX_CR_RXDMAEN); |
lypinator | 0:bb348c97df44 | 902 | hspdif->Instance->CR &= (uint16_t)(~SPDIFRX_CR_CBDMAEN); |
lypinator | 0:bb348c97df44 | 903 | |
lypinator | 0:bb348c97df44 | 904 | /* Disable the SPDIFRX DMA channel */ |
lypinator | 0:bb348c97df44 | 905 | __HAL_DMA_DISABLE(hspdif->hdmaDrRx); |
lypinator | 0:bb348c97df44 | 906 | __HAL_DMA_DISABLE(hspdif->hdmaCsRx); |
lypinator | 0:bb348c97df44 | 907 | |
lypinator | 0:bb348c97df44 | 908 | /* Disable SPDIFRX peripheral */ |
lypinator | 0:bb348c97df44 | 909 | __HAL_SPDIFRX_IDLE(hspdif); |
lypinator | 0:bb348c97df44 | 910 | |
lypinator | 0:bb348c97df44 | 911 | hspdif->State = HAL_SPDIFRX_STATE_READY; |
lypinator | 0:bb348c97df44 | 912 | |
lypinator | 0:bb348c97df44 | 913 | /* Process Unlocked */ |
lypinator | 0:bb348c97df44 | 914 | __HAL_UNLOCK(hspdif); |
lypinator | 0:bb348c97df44 | 915 | |
lypinator | 0:bb348c97df44 | 916 | return HAL_OK; |
lypinator | 0:bb348c97df44 | 917 | } |
lypinator | 0:bb348c97df44 | 918 | |
lypinator | 0:bb348c97df44 | 919 | /** |
lypinator | 0:bb348c97df44 | 920 | * @brief This function handles SPDIFRX interrupt request. |
lypinator | 0:bb348c97df44 | 921 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 922 | * @retval HAL status |
lypinator | 0:bb348c97df44 | 923 | */ |
lypinator | 0:bb348c97df44 | 924 | void HAL_SPDIFRX_IRQHandler(SPDIFRX_HandleTypeDef *hspdif) |
lypinator | 0:bb348c97df44 | 925 | { |
lypinator | 0:bb348c97df44 | 926 | /* SPDIFRX in mode Data Flow Reception ------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 927 | if((__HAL_SPDIFRX_GET_FLAG(hspdif, SPDIFRX_FLAG_RXNE) != RESET) && (__HAL_SPDIFRX_GET_IT_SOURCE(hspdif, SPDIFRX_IT_RXNE) != RESET)) |
lypinator | 0:bb348c97df44 | 928 | { |
lypinator | 0:bb348c97df44 | 929 | __HAL_SPDIFRX_CLEAR_IT(hspdif, SPDIFRX_IT_RXNE); |
lypinator | 0:bb348c97df44 | 930 | SPDIFRX_ReceiveDataFlow_IT(hspdif); |
lypinator | 0:bb348c97df44 | 931 | } |
lypinator | 0:bb348c97df44 | 932 | |
lypinator | 0:bb348c97df44 | 933 | /* SPDIFRX in mode Control Flow Reception ------------------------------------------------*/ |
lypinator | 0:bb348c97df44 | 934 | if((__HAL_SPDIFRX_GET_FLAG(hspdif, SPDIFRX_FLAG_CSRNE) != RESET) && (__HAL_SPDIFRX_GET_IT_SOURCE(hspdif, SPDIFRX_IT_CSRNE) != RESET)) |
lypinator | 0:bb348c97df44 | 935 | { |
lypinator | 0:bb348c97df44 | 936 | __HAL_SPDIFRX_CLEAR_IT(hspdif, SPDIFRX_IT_CSRNE); |
lypinator | 0:bb348c97df44 | 937 | SPDIFRX_ReceiveControlFlow_IT(hspdif); |
lypinator | 0:bb348c97df44 | 938 | } |
lypinator | 0:bb348c97df44 | 939 | |
lypinator | 0:bb348c97df44 | 940 | /* SPDIFRX Overrun error interrupt occurred ---------------------------------*/ |
lypinator | 0:bb348c97df44 | 941 | if((__HAL_SPDIFRX_GET_FLAG(hspdif, SPDIFRX_FLAG_OVR) != RESET) && (__HAL_SPDIFRX_GET_IT_SOURCE(hspdif, SPDIFRX_IT_OVRIE) != RESET)) |
lypinator | 0:bb348c97df44 | 942 | { |
lypinator | 0:bb348c97df44 | 943 | __HAL_SPDIFRX_CLEAR_IT(hspdif, SPDIFRX_FLAG_OVR); |
lypinator | 0:bb348c97df44 | 944 | |
lypinator | 0:bb348c97df44 | 945 | /* Change the SPDIFRX error code */ |
lypinator | 0:bb348c97df44 | 946 | hspdif->ErrorCode |= HAL_SPDIFRX_ERROR_OVR; |
lypinator | 0:bb348c97df44 | 947 | |
lypinator | 0:bb348c97df44 | 948 | /* the transfer is not stopped */ |
lypinator | 0:bb348c97df44 | 949 | HAL_SPDIFRX_ErrorCallback(hspdif); |
lypinator | 0:bb348c97df44 | 950 | } |
lypinator | 0:bb348c97df44 | 951 | |
lypinator | 0:bb348c97df44 | 952 | /* SPDIFRX Parity error interrupt occurred ---------------------------------*/ |
lypinator | 0:bb348c97df44 | 953 | if((__HAL_SPDIFRX_GET_FLAG(hspdif, SPDIFRX_FLAG_PERR) != RESET) && (__HAL_SPDIFRX_GET_IT_SOURCE(hspdif, SPDIFRX_IT_PERRIE) != RESET)) |
lypinator | 0:bb348c97df44 | 954 | { |
lypinator | 0:bb348c97df44 | 955 | __HAL_SPDIFRX_CLEAR_IT(hspdif, SPDIFRX_FLAG_PERR); |
lypinator | 0:bb348c97df44 | 956 | |
lypinator | 0:bb348c97df44 | 957 | /* Change the SPDIFRX error code */ |
lypinator | 0:bb348c97df44 | 958 | hspdif->ErrorCode |= HAL_SPDIFRX_ERROR_PE; |
lypinator | 0:bb348c97df44 | 959 | |
lypinator | 0:bb348c97df44 | 960 | /* the transfer is not stopped */ |
lypinator | 0:bb348c97df44 | 961 | HAL_SPDIFRX_ErrorCallback(hspdif); |
lypinator | 0:bb348c97df44 | 962 | } |
lypinator | 0:bb348c97df44 | 963 | } |
lypinator | 0:bb348c97df44 | 964 | |
lypinator | 0:bb348c97df44 | 965 | /** |
lypinator | 0:bb348c97df44 | 966 | * @brief Rx Transfer (Data flow) half completed callbacks |
lypinator | 0:bb348c97df44 | 967 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 968 | * @retval None |
lypinator | 0:bb348c97df44 | 969 | */ |
lypinator | 0:bb348c97df44 | 970 | __weak void HAL_SPDIFRX_RxHalfCpltCallback(SPDIFRX_HandleTypeDef *hspdif) |
lypinator | 0:bb348c97df44 | 971 | { |
lypinator | 0:bb348c97df44 | 972 | /* Prevent unused argument(s) compilation warning */ |
lypinator | 0:bb348c97df44 | 973 | UNUSED(hspdif); |
lypinator | 0:bb348c97df44 | 974 | /* NOTE : This function Should not be modified, when the callback is needed, |
lypinator | 0:bb348c97df44 | 975 | the HAL_SPDIFRX_RxCpltCallback could be implemented in the user file |
lypinator | 0:bb348c97df44 | 976 | */ |
lypinator | 0:bb348c97df44 | 977 | } |
lypinator | 0:bb348c97df44 | 978 | |
lypinator | 0:bb348c97df44 | 979 | /** |
lypinator | 0:bb348c97df44 | 980 | * @brief Rx Transfer (Data flow) completed callbacks |
lypinator | 0:bb348c97df44 | 981 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 982 | * @retval None |
lypinator | 0:bb348c97df44 | 983 | */ |
lypinator | 0:bb348c97df44 | 984 | __weak void HAL_SPDIFRX_RxCpltCallback(SPDIFRX_HandleTypeDef *hspdif) |
lypinator | 0:bb348c97df44 | 985 | { |
lypinator | 0:bb348c97df44 | 986 | /* Prevent unused argument(s) compilation warning */ |
lypinator | 0:bb348c97df44 | 987 | UNUSED(hspdif); |
lypinator | 0:bb348c97df44 | 988 | /* NOTE : This function Should not be modified, when the callback is needed, |
lypinator | 0:bb348c97df44 | 989 | the HAL_SPDIFRX_RxCpltCallback could be implemented in the user file |
lypinator | 0:bb348c97df44 | 990 | */ |
lypinator | 0:bb348c97df44 | 991 | } |
lypinator | 0:bb348c97df44 | 992 | |
lypinator | 0:bb348c97df44 | 993 | /** |
lypinator | 0:bb348c97df44 | 994 | * @brief Rx (Control flow) Transfer half completed callbacks |
lypinator | 0:bb348c97df44 | 995 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 996 | * @retval None |
lypinator | 0:bb348c97df44 | 997 | */ |
lypinator | 0:bb348c97df44 | 998 | __weak void HAL_SPDIFRX_CxHalfCpltCallback(SPDIFRX_HandleTypeDef *hspdif) |
lypinator | 0:bb348c97df44 | 999 | { |
lypinator | 0:bb348c97df44 | 1000 | /* Prevent unused argument(s) compilation warning */ |
lypinator | 0:bb348c97df44 | 1001 | UNUSED(hspdif); |
lypinator | 0:bb348c97df44 | 1002 | /* NOTE : This function Should not be modified, when the callback is needed, |
lypinator | 0:bb348c97df44 | 1003 | the HAL_SPDIFRX_RxCpltCallback could be implemented in the user file |
lypinator | 0:bb348c97df44 | 1004 | */ |
lypinator | 0:bb348c97df44 | 1005 | } |
lypinator | 0:bb348c97df44 | 1006 | |
lypinator | 0:bb348c97df44 | 1007 | /** |
lypinator | 0:bb348c97df44 | 1008 | * @brief Rx Transfer (Control flow) completed callbacks |
lypinator | 0:bb348c97df44 | 1009 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 1010 | * @retval None |
lypinator | 0:bb348c97df44 | 1011 | */ |
lypinator | 0:bb348c97df44 | 1012 | __weak void HAL_SPDIFRX_CxCpltCallback(SPDIFRX_HandleTypeDef *hspdif) |
lypinator | 0:bb348c97df44 | 1013 | { |
lypinator | 0:bb348c97df44 | 1014 | /* Prevent unused argument(s) compilation warning */ |
lypinator | 0:bb348c97df44 | 1015 | UNUSED(hspdif); |
lypinator | 0:bb348c97df44 | 1016 | /* NOTE : This function Should not be modified, when the callback is needed, |
lypinator | 0:bb348c97df44 | 1017 | the HAL_SPDIFRX_RxCpltCallback could be implemented in the user file |
lypinator | 0:bb348c97df44 | 1018 | */ |
lypinator | 0:bb348c97df44 | 1019 | } |
lypinator | 0:bb348c97df44 | 1020 | |
lypinator | 0:bb348c97df44 | 1021 | /** |
lypinator | 0:bb348c97df44 | 1022 | * @brief SPDIFRX error callbacks |
lypinator | 0:bb348c97df44 | 1023 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 1024 | * @retval None |
lypinator | 0:bb348c97df44 | 1025 | */ |
lypinator | 0:bb348c97df44 | 1026 | __weak void HAL_SPDIFRX_ErrorCallback(SPDIFRX_HandleTypeDef *hspdif) |
lypinator | 0:bb348c97df44 | 1027 | { |
lypinator | 0:bb348c97df44 | 1028 | /* Prevent unused argument(s) compilation warning */ |
lypinator | 0:bb348c97df44 | 1029 | UNUSED(hspdif); |
lypinator | 0:bb348c97df44 | 1030 | /* NOTE : This function Should not be modified, when the callback is needed, |
lypinator | 0:bb348c97df44 | 1031 | the HAL_SPDIFRX_ErrorCallback could be implemented in the user file |
lypinator | 0:bb348c97df44 | 1032 | */ |
lypinator | 0:bb348c97df44 | 1033 | } |
lypinator | 0:bb348c97df44 | 1034 | |
lypinator | 0:bb348c97df44 | 1035 | /** |
lypinator | 0:bb348c97df44 | 1036 | * @} |
lypinator | 0:bb348c97df44 | 1037 | */ |
lypinator | 0:bb348c97df44 | 1038 | |
lypinator | 0:bb348c97df44 | 1039 | /** @defgroup SPDIFRX_Exported_Functions_Group3 Peripheral State and Errors functions |
lypinator | 0:bb348c97df44 | 1040 | * @brief Peripheral State functions |
lypinator | 0:bb348c97df44 | 1041 | * |
lypinator | 0:bb348c97df44 | 1042 | @verbatim |
lypinator | 0:bb348c97df44 | 1043 | =============================================================================== |
lypinator | 0:bb348c97df44 | 1044 | ##### Peripheral State and Errors functions ##### |
lypinator | 0:bb348c97df44 | 1045 | =============================================================================== |
lypinator | 0:bb348c97df44 | 1046 | [..] |
lypinator | 0:bb348c97df44 | 1047 | This subsection permit to get in run-time the status of the peripheral |
lypinator | 0:bb348c97df44 | 1048 | and the data flow. |
lypinator | 0:bb348c97df44 | 1049 | |
lypinator | 0:bb348c97df44 | 1050 | @endverbatim |
lypinator | 0:bb348c97df44 | 1051 | * @{ |
lypinator | 0:bb348c97df44 | 1052 | */ |
lypinator | 0:bb348c97df44 | 1053 | |
lypinator | 0:bb348c97df44 | 1054 | /** |
lypinator | 0:bb348c97df44 | 1055 | * @brief Return the SPDIFRX state |
lypinator | 0:bb348c97df44 | 1056 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 1057 | * @retval HAL state |
lypinator | 0:bb348c97df44 | 1058 | */ |
lypinator | 0:bb348c97df44 | 1059 | HAL_SPDIFRX_StateTypeDef HAL_SPDIFRX_GetState(SPDIFRX_HandleTypeDef *hspdif) |
lypinator | 0:bb348c97df44 | 1060 | { |
lypinator | 0:bb348c97df44 | 1061 | return hspdif->State; |
lypinator | 0:bb348c97df44 | 1062 | } |
lypinator | 0:bb348c97df44 | 1063 | |
lypinator | 0:bb348c97df44 | 1064 | /** |
lypinator | 0:bb348c97df44 | 1065 | * @brief Return the SPDIFRX error code |
lypinator | 0:bb348c97df44 | 1066 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 1067 | * @retval SPDIFRX Error Code |
lypinator | 0:bb348c97df44 | 1068 | */ |
lypinator | 0:bb348c97df44 | 1069 | uint32_t HAL_SPDIFRX_GetError(SPDIFRX_HandleTypeDef *hspdif) |
lypinator | 0:bb348c97df44 | 1070 | { |
lypinator | 0:bb348c97df44 | 1071 | return hspdif->ErrorCode; |
lypinator | 0:bb348c97df44 | 1072 | } |
lypinator | 0:bb348c97df44 | 1073 | |
lypinator | 0:bb348c97df44 | 1074 | /** |
lypinator | 0:bb348c97df44 | 1075 | * @} |
lypinator | 0:bb348c97df44 | 1076 | */ |
lypinator | 0:bb348c97df44 | 1077 | |
lypinator | 0:bb348c97df44 | 1078 | /** |
lypinator | 0:bb348c97df44 | 1079 | * @brief DMA SPDIFRX receive process (Data flow) complete callback |
lypinator | 0:bb348c97df44 | 1080 | * @param hdma DMA handle |
lypinator | 0:bb348c97df44 | 1081 | * @retval None |
lypinator | 0:bb348c97df44 | 1082 | */ |
lypinator | 0:bb348c97df44 | 1083 | static void SPDIFRX_DMARxCplt(DMA_HandleTypeDef *hdma) |
lypinator | 0:bb348c97df44 | 1084 | { |
lypinator | 0:bb348c97df44 | 1085 | SPDIFRX_HandleTypeDef* hspdif = ( SPDIFRX_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent; |
lypinator | 0:bb348c97df44 | 1086 | |
lypinator | 0:bb348c97df44 | 1087 | /* Disable Rx DMA Request */ |
lypinator | 0:bb348c97df44 | 1088 | hspdif->Instance->CR &= (uint16_t)(~SPDIFRX_CR_RXDMAEN); |
lypinator | 0:bb348c97df44 | 1089 | hspdif->RxXferCount = 0U; |
lypinator | 0:bb348c97df44 | 1090 | |
lypinator | 0:bb348c97df44 | 1091 | hspdif->State = HAL_SPDIFRX_STATE_READY; |
lypinator | 0:bb348c97df44 | 1092 | HAL_SPDIFRX_RxCpltCallback(hspdif); |
lypinator | 0:bb348c97df44 | 1093 | } |
lypinator | 0:bb348c97df44 | 1094 | |
lypinator | 0:bb348c97df44 | 1095 | /** |
lypinator | 0:bb348c97df44 | 1096 | * @brief DMA SPDIFRX receive process (Data flow) half complete callback |
lypinator | 0:bb348c97df44 | 1097 | * @param hdma DMA handle |
lypinator | 0:bb348c97df44 | 1098 | * @retval None |
lypinator | 0:bb348c97df44 | 1099 | */ |
lypinator | 0:bb348c97df44 | 1100 | static void SPDIFRX_DMARxHalfCplt(DMA_HandleTypeDef *hdma) |
lypinator | 0:bb348c97df44 | 1101 | { |
lypinator | 0:bb348c97df44 | 1102 | SPDIFRX_HandleTypeDef* hspdif = (SPDIFRX_HandleTypeDef*)((DMA_HandleTypeDef*)hdma)->Parent; |
lypinator | 0:bb348c97df44 | 1103 | |
lypinator | 0:bb348c97df44 | 1104 | HAL_SPDIFRX_RxHalfCpltCallback(hspdif); |
lypinator | 0:bb348c97df44 | 1105 | } |
lypinator | 0:bb348c97df44 | 1106 | |
lypinator | 0:bb348c97df44 | 1107 | /** |
lypinator | 0:bb348c97df44 | 1108 | * @brief DMA SPDIFRX receive process (Control flow) complete callback |
lypinator | 0:bb348c97df44 | 1109 | * @param hdma DMA handle |
lypinator | 0:bb348c97df44 | 1110 | * @retval None |
lypinator | 0:bb348c97df44 | 1111 | */ |
lypinator | 0:bb348c97df44 | 1112 | static void SPDIFRX_DMACxCplt(DMA_HandleTypeDef *hdma) |
lypinator | 0:bb348c97df44 | 1113 | { |
lypinator | 0:bb348c97df44 | 1114 | SPDIFRX_HandleTypeDef* hspdif = ( SPDIFRX_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent; |
lypinator | 0:bb348c97df44 | 1115 | |
lypinator | 0:bb348c97df44 | 1116 | /* Disable Cb DMA Request */ |
lypinator | 0:bb348c97df44 | 1117 | hspdif->Instance->CR &= (uint16_t)(~SPDIFRX_CR_CBDMAEN); |
lypinator | 0:bb348c97df44 | 1118 | hspdif->CsXferCount = 0U; |
lypinator | 0:bb348c97df44 | 1119 | |
lypinator | 0:bb348c97df44 | 1120 | hspdif->State = HAL_SPDIFRX_STATE_READY; |
lypinator | 0:bb348c97df44 | 1121 | HAL_SPDIFRX_CxCpltCallback(hspdif); |
lypinator | 0:bb348c97df44 | 1122 | } |
lypinator | 0:bb348c97df44 | 1123 | |
lypinator | 0:bb348c97df44 | 1124 | /** |
lypinator | 0:bb348c97df44 | 1125 | * @brief DMA SPDIFRX receive process (Control flow) half complete callback |
lypinator | 0:bb348c97df44 | 1126 | * @param hdma DMA handle |
lypinator | 0:bb348c97df44 | 1127 | * @retval None |
lypinator | 0:bb348c97df44 | 1128 | */ |
lypinator | 0:bb348c97df44 | 1129 | static void SPDIFRX_DMACxHalfCplt(DMA_HandleTypeDef *hdma) |
lypinator | 0:bb348c97df44 | 1130 | { |
lypinator | 0:bb348c97df44 | 1131 | SPDIFRX_HandleTypeDef* hspdif = (SPDIFRX_HandleTypeDef*)((DMA_HandleTypeDef*)hdma)->Parent; |
lypinator | 0:bb348c97df44 | 1132 | |
lypinator | 0:bb348c97df44 | 1133 | HAL_SPDIFRX_CxHalfCpltCallback(hspdif); |
lypinator | 0:bb348c97df44 | 1134 | } |
lypinator | 0:bb348c97df44 | 1135 | |
lypinator | 0:bb348c97df44 | 1136 | /** |
lypinator | 0:bb348c97df44 | 1137 | * @brief DMA SPDIFRX communication error callback |
lypinator | 0:bb348c97df44 | 1138 | * @param hdma DMA handle |
lypinator | 0:bb348c97df44 | 1139 | * @retval None |
lypinator | 0:bb348c97df44 | 1140 | */ |
lypinator | 0:bb348c97df44 | 1141 | static void SPDIFRX_DMAError(DMA_HandleTypeDef *hdma) |
lypinator | 0:bb348c97df44 | 1142 | { |
lypinator | 0:bb348c97df44 | 1143 | SPDIFRX_HandleTypeDef* hspdif = ( SPDIFRX_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent; |
lypinator | 0:bb348c97df44 | 1144 | |
lypinator | 0:bb348c97df44 | 1145 | /* Disable Rx and Cb DMA Request */ |
lypinator | 0:bb348c97df44 | 1146 | hspdif->Instance->CR &= (uint16_t)(~(SPDIFRX_CR_RXDMAEN | SPDIFRX_CR_CBDMAEN)); |
lypinator | 0:bb348c97df44 | 1147 | hspdif->RxXferCount = 0U; |
lypinator | 0:bb348c97df44 | 1148 | |
lypinator | 0:bb348c97df44 | 1149 | hspdif->State= HAL_SPDIFRX_STATE_READY; |
lypinator | 0:bb348c97df44 | 1150 | |
lypinator | 0:bb348c97df44 | 1151 | /* Set the error code and execute error callback*/ |
lypinator | 0:bb348c97df44 | 1152 | hspdif->ErrorCode |= HAL_SPDIFRX_ERROR_DMA; |
lypinator | 0:bb348c97df44 | 1153 | HAL_SPDIFRX_ErrorCallback(hspdif); |
lypinator | 0:bb348c97df44 | 1154 | } |
lypinator | 0:bb348c97df44 | 1155 | |
lypinator | 0:bb348c97df44 | 1156 | /** |
lypinator | 0:bb348c97df44 | 1157 | * @brief Receive an amount of data (Data Flow) with Interrupt |
lypinator | 0:bb348c97df44 | 1158 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 1159 | * @retval None |
lypinator | 0:bb348c97df44 | 1160 | */ |
lypinator | 0:bb348c97df44 | 1161 | static void SPDIFRX_ReceiveDataFlow_IT(SPDIFRX_HandleTypeDef *hspdif) |
lypinator | 0:bb348c97df44 | 1162 | { |
lypinator | 0:bb348c97df44 | 1163 | /* Receive data */ |
lypinator | 0:bb348c97df44 | 1164 | (*hspdif->pRxBuffPtr++) = hspdif->Instance->DR; |
lypinator | 0:bb348c97df44 | 1165 | hspdif->RxXferCount--; |
lypinator | 0:bb348c97df44 | 1166 | |
lypinator | 0:bb348c97df44 | 1167 | if(hspdif->RxXferCount == 0U) |
lypinator | 0:bb348c97df44 | 1168 | { |
lypinator | 0:bb348c97df44 | 1169 | /* Disable RXNE/PE and OVR interrupts */ |
lypinator | 0:bb348c97df44 | 1170 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_OVRIE | SPDIFRX_IT_PERRIE | SPDIFRX_IT_RXNE); |
lypinator | 0:bb348c97df44 | 1171 | |
lypinator | 0:bb348c97df44 | 1172 | hspdif->State = HAL_SPDIFRX_STATE_READY; |
lypinator | 0:bb348c97df44 | 1173 | |
lypinator | 0:bb348c97df44 | 1174 | /* Process Unlocked */ |
lypinator | 0:bb348c97df44 | 1175 | __HAL_UNLOCK(hspdif); |
lypinator | 0:bb348c97df44 | 1176 | |
lypinator | 0:bb348c97df44 | 1177 | HAL_SPDIFRX_RxCpltCallback(hspdif); |
lypinator | 0:bb348c97df44 | 1178 | } |
lypinator | 0:bb348c97df44 | 1179 | } |
lypinator | 0:bb348c97df44 | 1180 | |
lypinator | 0:bb348c97df44 | 1181 | /** |
lypinator | 0:bb348c97df44 | 1182 | * @brief Receive an amount of data (Control Flow) with Interrupt |
lypinator | 0:bb348c97df44 | 1183 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 1184 | * @retval None |
lypinator | 0:bb348c97df44 | 1185 | */ |
lypinator | 0:bb348c97df44 | 1186 | static void SPDIFRX_ReceiveControlFlow_IT(SPDIFRX_HandleTypeDef *hspdif) |
lypinator | 0:bb348c97df44 | 1187 | { |
lypinator | 0:bb348c97df44 | 1188 | /* Receive data */ |
lypinator | 0:bb348c97df44 | 1189 | (*hspdif->pCsBuffPtr++) = hspdif->Instance->CSR; |
lypinator | 0:bb348c97df44 | 1190 | hspdif->CsXferCount--; |
lypinator | 0:bb348c97df44 | 1191 | |
lypinator | 0:bb348c97df44 | 1192 | if(hspdif->CsXferCount == 0U) |
lypinator | 0:bb348c97df44 | 1193 | { |
lypinator | 0:bb348c97df44 | 1194 | /* Disable CSRNE interrupt */ |
lypinator | 0:bb348c97df44 | 1195 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_CSRNE); |
lypinator | 0:bb348c97df44 | 1196 | |
lypinator | 0:bb348c97df44 | 1197 | hspdif->State = HAL_SPDIFRX_STATE_READY; |
lypinator | 0:bb348c97df44 | 1198 | |
lypinator | 0:bb348c97df44 | 1199 | /* Process Unlocked */ |
lypinator | 0:bb348c97df44 | 1200 | __HAL_UNLOCK(hspdif); |
lypinator | 0:bb348c97df44 | 1201 | |
lypinator | 0:bb348c97df44 | 1202 | HAL_SPDIFRX_CxCpltCallback(hspdif); |
lypinator | 0:bb348c97df44 | 1203 | } |
lypinator | 0:bb348c97df44 | 1204 | } |
lypinator | 0:bb348c97df44 | 1205 | |
lypinator | 0:bb348c97df44 | 1206 | /** |
lypinator | 0:bb348c97df44 | 1207 | * @brief This function handles SPDIFRX Communication Timeout. |
lypinator | 0:bb348c97df44 | 1208 | * @param hspdif SPDIFRX handle |
lypinator | 0:bb348c97df44 | 1209 | * @param Flag Flag checked |
lypinator | 0:bb348c97df44 | 1210 | * @param Status Value of the flag expected |
lypinator | 0:bb348c97df44 | 1211 | * @param Timeout Duration of the timeout |
lypinator | 0:bb348c97df44 | 1212 | * @retval HAL status |
lypinator | 0:bb348c97df44 | 1213 | */ |
lypinator | 0:bb348c97df44 | 1214 | static HAL_StatusTypeDef SPDIFRX_WaitOnFlagUntilTimeout(SPDIFRX_HandleTypeDef *hspdif, uint32_t Flag, FlagStatus Status, uint32_t Timeout) |
lypinator | 0:bb348c97df44 | 1215 | { |
lypinator | 0:bb348c97df44 | 1216 | uint32_t tickstart = 0U; |
lypinator | 0:bb348c97df44 | 1217 | |
lypinator | 0:bb348c97df44 | 1218 | /* Get tick */ |
lypinator | 0:bb348c97df44 | 1219 | tickstart = HAL_GetTick(); |
lypinator | 0:bb348c97df44 | 1220 | |
lypinator | 0:bb348c97df44 | 1221 | /* Wait until flag is set */ |
lypinator | 0:bb348c97df44 | 1222 | if(Status == RESET) |
lypinator | 0:bb348c97df44 | 1223 | { |
lypinator | 0:bb348c97df44 | 1224 | while(__HAL_SPDIFRX_GET_FLAG(hspdif, Flag) == RESET) |
lypinator | 0:bb348c97df44 | 1225 | { |
lypinator | 0:bb348c97df44 | 1226 | /* Check for the Timeout */ |
lypinator | 0:bb348c97df44 | 1227 | if(Timeout != HAL_MAX_DELAY) |
lypinator | 0:bb348c97df44 | 1228 | { |
lypinator | 0:bb348c97df44 | 1229 | if((Timeout == 0U)||((HAL_GetTick() - tickstart ) > Timeout)) |
lypinator | 0:bb348c97df44 | 1230 | { |
lypinator | 0:bb348c97df44 | 1231 | /* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt process */ |
lypinator | 0:bb348c97df44 | 1232 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_RXNE); |
lypinator | 0:bb348c97df44 | 1233 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_CSRNE); |
lypinator | 0:bb348c97df44 | 1234 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_PERRIE); |
lypinator | 0:bb348c97df44 | 1235 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_OVRIE); |
lypinator | 0:bb348c97df44 | 1236 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_SBLKIE); |
lypinator | 0:bb348c97df44 | 1237 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_SYNCDIE); |
lypinator | 0:bb348c97df44 | 1238 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_IFEIE); |
lypinator | 0:bb348c97df44 | 1239 | |
lypinator | 0:bb348c97df44 | 1240 | hspdif->State= HAL_SPDIFRX_STATE_READY; |
lypinator | 0:bb348c97df44 | 1241 | |
lypinator | 0:bb348c97df44 | 1242 | /* Process Unlocked */ |
lypinator | 0:bb348c97df44 | 1243 | __HAL_UNLOCK(hspdif); |
lypinator | 0:bb348c97df44 | 1244 | |
lypinator | 0:bb348c97df44 | 1245 | return HAL_TIMEOUT; |
lypinator | 0:bb348c97df44 | 1246 | } |
lypinator | 0:bb348c97df44 | 1247 | } |
lypinator | 0:bb348c97df44 | 1248 | } |
lypinator | 0:bb348c97df44 | 1249 | } |
lypinator | 0:bb348c97df44 | 1250 | else |
lypinator | 0:bb348c97df44 | 1251 | { |
lypinator | 0:bb348c97df44 | 1252 | while(__HAL_SPDIFRX_GET_FLAG(hspdif, Flag) != RESET) |
lypinator | 0:bb348c97df44 | 1253 | { |
lypinator | 0:bb348c97df44 | 1254 | /* Check for the Timeout */ |
lypinator | 0:bb348c97df44 | 1255 | if(Timeout != HAL_MAX_DELAY) |
lypinator | 0:bb348c97df44 | 1256 | { |
lypinator | 0:bb348c97df44 | 1257 | if((Timeout == 0U)||((HAL_GetTick() - tickstart ) > Timeout)) |
lypinator | 0:bb348c97df44 | 1258 | { |
lypinator | 0:bb348c97df44 | 1259 | /* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt process */ |
lypinator | 0:bb348c97df44 | 1260 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_RXNE); |
lypinator | 0:bb348c97df44 | 1261 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_CSRNE); |
lypinator | 0:bb348c97df44 | 1262 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_PERRIE); |
lypinator | 0:bb348c97df44 | 1263 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_OVRIE); |
lypinator | 0:bb348c97df44 | 1264 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_SBLKIE); |
lypinator | 0:bb348c97df44 | 1265 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_SYNCDIE); |
lypinator | 0:bb348c97df44 | 1266 | __HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_IFEIE); |
lypinator | 0:bb348c97df44 | 1267 | |
lypinator | 0:bb348c97df44 | 1268 | hspdif->State= HAL_SPDIFRX_STATE_READY; |
lypinator | 0:bb348c97df44 | 1269 | |
lypinator | 0:bb348c97df44 | 1270 | /* Process Unlocked */ |
lypinator | 0:bb348c97df44 | 1271 | __HAL_UNLOCK(hspdif); |
lypinator | 0:bb348c97df44 | 1272 | |
lypinator | 0:bb348c97df44 | 1273 | return HAL_TIMEOUT; |
lypinator | 0:bb348c97df44 | 1274 | } |
lypinator | 0:bb348c97df44 | 1275 | } |
lypinator | 0:bb348c97df44 | 1276 | } |
lypinator | 0:bb348c97df44 | 1277 | } |
lypinator | 0:bb348c97df44 | 1278 | return HAL_OK; |
lypinator | 0:bb348c97df44 | 1279 | } |
lypinator | 0:bb348c97df44 | 1280 | |
lypinator | 0:bb348c97df44 | 1281 | /** |
lypinator | 0:bb348c97df44 | 1282 | * @} |
lypinator | 0:bb348c97df44 | 1283 | */ |
lypinator | 0:bb348c97df44 | 1284 | #endif /* STM32F446xx */ |
lypinator | 0:bb348c97df44 | 1285 | |
lypinator | 0:bb348c97df44 | 1286 | #endif /* HAL_SPDIFRX_MODULE_ENABLED */ |
lypinator | 0:bb348c97df44 | 1287 | /** |
lypinator | 0:bb348c97df44 | 1288 | * @} |
lypinator | 0:bb348c97df44 | 1289 | */ |
lypinator | 0:bb348c97df44 | 1290 | |
lypinator | 0:bb348c97df44 | 1291 | /** |
lypinator | 0:bb348c97df44 | 1292 | * @} |
lypinator | 0:bb348c97df44 | 1293 | */ |
lypinator | 0:bb348c97df44 | 1294 | |
lypinator | 0:bb348c97df44 | 1295 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
lypinator | 0:bb348c97df44 | 1296 |