| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx.h | |||
| * @author MCD Application Team | |||
| * @version V2.5.1 | |||
| * @date 28-June-2016 | |||
| * @version V2.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief CMSIS STM32F4xx Device Peripheral Access Layer Header File. | |||
| * | |||
| * The file is the unique include file that the application programmer | |||
| @@ -79,7 +79,7 @@ | |||
| !defined (STM32F401xC) && !defined (STM32F401xE) && !defined (STM32F410Tx) && !defined (STM32F410Cx) && \ | |||
| !defined (STM32F410Rx) && !defined (STM32F411xE) && !defined (STM32F446xx) && !defined (STM32F469xx) && \ | |||
| !defined (STM32F479xx) && !defined (STM32F412Cx) && !defined (STM32F412Rx) && !defined (STM32F412Vx) && \ | |||
| !defined (STM32F412Zx) | |||
| !defined (STM32F412Zx) && !defined (STM32F413xx) && !defined (STM32F423xx) | |||
| /* #define STM32F405xx */ /*!< STM32F405RG, STM32F405VG and STM32F405ZG Devices */ | |||
| /* #define STM32F415xx */ /*!< STM32F415RG, STM32F415VG and STM32F415ZG Devices */ | |||
| /* #define STM32F407xx */ /*!< STM32F407VG, STM32F407VE, STM32F407ZG, STM32F407ZE, STM32F407IG and STM32F407IE Devices */ | |||
| @@ -106,6 +106,9 @@ | |||
| /* #define STM32F412Zx */ /*!< STM32F412ZET, STM32F412ZGT, STM32F412ZEJ and STM32F412ZGJ Devices */ | |||
| /* #define STM32F412Vx */ /*!< STM32F412VET, STM32F412VGT, STM32F412VEH and STM32F412VGH Devices */ | |||
| /* #define STM32F412Rx */ /*!< STM32F412RET, STM32F412RGT, STM32F412REY and STM32F412RGY Devices */ | |||
| /* #define STM32F413xx */ /*!< STM32F413CH, STM32F413MH, STM32F413RH, STM32F413VH, STM32F413ZH, STM32F413CG, STM32F413MG, | |||
| STM32F413RG, STM32F413VG and STM32F413ZG Devices */ | |||
| /* #define STM32F423xx */ /*!< STM32F423CH, STM32F423RH, STM32F423VH and STM32F423ZH Devices */ | |||
| #endif | |||
| /* Tip: To avoid modifying this file each time you need to switch between these | |||
| @@ -121,11 +124,11 @@ | |||
| #endif /* USE_HAL_DRIVER */ | |||
| /** | |||
| * @brief CMSIS version number V2.5.1 | |||
| * @brief CMSIS version number V2.6.0 | |||
| */ | |||
| #define __STM32F4xx_CMSIS_VERSION_MAIN (0x02U) /*!< [31:24] main version */ | |||
| #define __STM32F4xx_CMSIS_VERSION_SUB1 (0x05U) /*!< [23:16] sub1 version */ | |||
| #define __STM32F4xx_CMSIS_VERSION_SUB2 (0x01U) /*!< [15:8] sub2 version */ | |||
| #define __STM32F4xx_CMSIS_VERSION_SUB1 (0x06U) /*!< [23:16] sub1 version */ | |||
| #define __STM32F4xx_CMSIS_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */ | |||
| #define __STM32F4xx_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */ | |||
| #define __STM32F4xx_CMSIS_VERSION ((__STM32F4xx_CMSIS_VERSION_MAIN << 24)\ | |||
| |(__STM32F4xx_CMSIS_VERSION_SUB1 << 16)\ | |||
| @@ -182,6 +185,10 @@ | |||
| #include "stm32f412rx.h" | |||
| #elif defined(STM32F412Vx) | |||
| #include "stm32f412vx.h" | |||
| #elif defined(STM32F413xx) | |||
| #include "stm32f413xx.h" | |||
| #elif defined(STM32F423xx) | |||
| #include "stm32f423xx.h" | |||
| #else | |||
| #error "Please select first the target STM32F4xx device used in your application (in stm32f4xx.h file)" | |||
| #endif | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file system_stm32f4xx.h | |||
| * @author MCD Application Team | |||
| * @version V2.5.1 | |||
| * @date 28-June-2016 | |||
| * @version V2.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -75,6 +75,8 @@ | |||
| */ | |||
| extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ | |||
| extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */ | |||
| extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */ | |||
| /** | |||
| * @} | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32_hal_legacy.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief This file contains aliases definition for the STM32Cube HAL constants | |||
| * macros and functions maintained for legacy purpose. | |||
| ****************************************************************************** | |||
| @@ -2216,26 +2216,26 @@ | |||
| #define __USART3_CLK_SLEEP_ENABLE __HAL_RCC_USART3_CLK_SLEEP_ENABLE | |||
| #define __USART3_FORCE_RESET __HAL_RCC_USART3_FORCE_RESET | |||
| #define __USART3_RELEASE_RESET __HAL_RCC_USART3_RELEASE_RESET | |||
| #define __USART4_CLK_DISABLE __HAL_RCC_UART4_CLK_DISABLE | |||
| #define __USART4_CLK_ENABLE __HAL_RCC_UART4_CLK_ENABLE | |||
| #define __USART4_CLK_SLEEP_ENABLE __HAL_RCC_UART4_CLK_SLEEP_ENABLE | |||
| #define __USART4_CLK_SLEEP_DISABLE __HAL_RCC_UART4_CLK_SLEEP_DISABLE | |||
| #define __USART4_FORCE_RESET __HAL_RCC_UART4_FORCE_RESET | |||
| #define __USART4_RELEASE_RESET __HAL_RCC_UART4_RELEASE_RESET | |||
| #define __USART5_CLK_DISABLE __HAL_RCC_UART5_CLK_DISABLE | |||
| #define __USART5_CLK_ENABLE __HAL_RCC_UART5_CLK_ENABLE | |||
| #define __USART5_CLK_SLEEP_ENABLE __HAL_RCC_UART5_CLK_SLEEP_ENABLE | |||
| #define __USART5_CLK_SLEEP_DISABLE __HAL_RCC_UART5_CLK_SLEEP_DISABLE | |||
| #define __USART5_FORCE_RESET __HAL_RCC_UART5_FORCE_RESET | |||
| #define __USART5_RELEASE_RESET __HAL_RCC_UART5_RELEASE_RESET | |||
| #define __USART7_CLK_DISABLE __HAL_RCC_UART7_CLK_DISABLE | |||
| #define __USART7_CLK_ENABLE __HAL_RCC_UART7_CLK_ENABLE | |||
| #define __USART7_FORCE_RESET __HAL_RCC_UART7_FORCE_RESET | |||
| #define __USART7_RELEASE_RESET __HAL_RCC_UART7_RELEASE_RESET | |||
| #define __USART8_CLK_DISABLE __HAL_RCC_UART8_CLK_DISABLE | |||
| #define __USART8_CLK_ENABLE __HAL_RCC_UART8_CLK_ENABLE | |||
| #define __USART8_FORCE_RESET __HAL_RCC_UART8_FORCE_RESET | |||
| #define __USART8_RELEASE_RESET __HAL_RCC_UART8_RELEASE_RESET | |||
| #define __USART4_CLK_DISABLE __HAL_RCC_USART4_CLK_DISABLE | |||
| #define __USART4_CLK_ENABLE __HAL_RCC_USART4_CLK_ENABLE | |||
| #define __USART4_CLK_SLEEP_ENABLE __HAL_RCC_USART4_CLK_SLEEP_ENABLE | |||
| #define __USART4_CLK_SLEEP_DISABLE __HAL_RCC_USART4_CLK_SLEEP_DISABLE | |||
| #define __USART4_FORCE_RESET __HAL_RCC_USART4_FORCE_RESET | |||
| #define __USART4_RELEASE_RESET __HAL_RCC_USART4_RELEASE_RESET | |||
| #define __USART5_CLK_DISABLE __HAL_RCC_USART5_CLK_DISABLE | |||
| #define __USART5_CLK_ENABLE __HAL_RCC_USART5_CLK_ENABLE | |||
| #define __USART5_CLK_SLEEP_ENABLE __HAL_RCC_USART5_CLK_SLEEP_ENABLE | |||
| #define __USART5_CLK_SLEEP_DISABLE __HAL_RCC_USART5_CLK_SLEEP_DISABLE | |||
| #define __USART5_FORCE_RESET __HAL_RCC_USART5_FORCE_RESET | |||
| #define __USART5_RELEASE_RESET __HAL_RCC_USART5_RELEASE_RESET | |||
| #define __USART7_CLK_DISABLE __HAL_RCC_USART7_CLK_DISABLE | |||
| #define __USART7_CLK_ENABLE __HAL_RCC_USART7_CLK_ENABLE | |||
| #define __USART7_FORCE_RESET __HAL_RCC_USART7_FORCE_RESET | |||
| #define __USART7_RELEASE_RESET __HAL_RCC_USART7_RELEASE_RESET | |||
| #define __USART8_CLK_DISABLE __HAL_RCC_USART8_CLK_DISABLE | |||
| #define __USART8_CLK_ENABLE __HAL_RCC_USART8_CLK_ENABLE | |||
| #define __USART8_FORCE_RESET __HAL_RCC_USART8_FORCE_RESET | |||
| #define __USART8_RELEASE_RESET __HAL_RCC_USART8_RELEASE_RESET | |||
| #define __USB_CLK_DISABLE __HAL_RCC_USB_CLK_DISABLE | |||
| #define __USB_CLK_ENABLE __HAL_RCC_USB_CLK_ENABLE | |||
| #define __USB_FORCE_RESET __HAL_RCC_USB_FORCE_RESET | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief This file contains all the functions prototypes for the HAL | |||
| * module driver. | |||
| ****************************************************************************** | |||
| @@ -57,6 +57,7 @@ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup HAL_Exported_Macros HAL Exported Macros | |||
| * @{ | |||
| @@ -149,7 +150,7 @@ | |||
| }while(0); | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ | |||
| #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) | |||
| #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /** @defgroup Cortex_Lockup_Enable Cortex Lockup Enable | |||
| * @{ | |||
| */ | |||
| @@ -177,7 +178,7 @@ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ | |||
| #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx || STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_adc.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file containing functions prototypes of ADC HAL library. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_adc_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of ADC HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -232,9 +232,10 @@ typedef struct | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || \ | |||
| defined(STM32F410Rx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || \ | |||
| defined(STM32F412Cx) | |||
| defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define ADC_CHANNEL_TEMPSENSOR ((uint32_t)ADC_CHANNEL_16) | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F410xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cxs */ | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F410xx || STM32F412Zx || | |||
| STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #if defined(STM32F411xE) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ | |||
| defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) | |||
| @@ -257,7 +258,7 @@ typedef struct | |||
| #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) | |||
| /** | |||
| * @brief Disable internal path of ADC channel Vbat | |||
| * @Note Use case of this macro: | |||
| * @note Use case of this macro: | |||
| * On devices STM32F42x and STM32F43x, ADC internal channels | |||
| * Vbat and VrefInt share the same internal path, only | |||
| * one of them can be enabled.This macro is to be used when ADC | |||
| @@ -322,9 +323,10 @@ HAL_StatusTypeDef HAL_ADCEx_MultiModeConfigChannel(ADC_HandleTypeDef* hadc, ADC_ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || \ | |||
| defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define IS_ADC_CHANNEL(CHANNEL) ((CHANNEL) <= ADC_CHANNEL_18) | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || | |||
| STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ | |||
| defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_can.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of CAN HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -45,8 +45,9 @@ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ | |||
| defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ | |||
| defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ | |||
| defined(STM32F423xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| @@ -757,7 +758,7 @@ HAL_CAN_StateTypeDef HAL_CAN_GetState(CAN_HandleTypeDef* hcan); | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\ | |||
| STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ | |||
| STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| @@ -0,0 +1,747 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_cec.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of CEC HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_CEC_H | |||
| #define __STM32F4xx_HAL_CEC_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #if defined(STM32F446xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup CEC | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup CEC_Exported_Types CEC Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief CEC Init Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t SignalFreeTime; /*!< Set SFT field, specifies the Signal Free Time. | |||
| It can be one of @ref CEC_Signal_Free_Time | |||
| and belongs to the set {0,...,7} where | |||
| 0x0 is the default configuration | |||
| else means 0.5 + (SignalFreeTime - 1) nominal data bit periods */ | |||
| uint32_t Tolerance; /*!< Set RXTOL bit, specifies the tolerance accepted on the received waveforms, | |||
| it can be a value of @ref CEC_Tolerance : it is either CEC_STANDARD_TOLERANCE | |||
| or CEC_EXTENDED_TOLERANCE */ | |||
| uint32_t BRERxStop; /*!< Set BRESTP bit @ref CEC_BRERxStop : specifies whether or not a Bit Rising Error stops the reception. | |||
| CEC_NO_RX_STOP_ON_BRE: reception is not stopped. | |||
| CEC_RX_STOP_ON_BRE: reception is stopped. */ | |||
| uint32_t BREErrorBitGen; /*!< Set BREGEN bit @ref CEC_BREErrorBitGen : specifies whether or not an Error-Bit is generated on the | |||
| CEC line upon Bit Rising Error detection. | |||
| CEC_BRE_ERRORBIT_NO_GENERATION: no error-bit generation. | |||
| CEC_BRE_ERRORBIT_GENERATION: error-bit generation if BRESTP is set. */ | |||
| uint32_t LBPEErrorBitGen; /*!< Set LBPEGEN bit @ref CEC_LBPEErrorBitGen : specifies whether or not an Error-Bit is generated on the | |||
| CEC line upon Long Bit Period Error detection. | |||
| CEC_LBPE_ERRORBIT_NO_GENERATION: no error-bit generation. | |||
| CEC_LBPE_ERRORBIT_GENERATION: error-bit generation. */ | |||
| uint32_t BroadcastMsgNoErrorBitGen; /*!< Set BRDNOGEN bit @ref CEC_BroadCastMsgErrorBitGen : allows to avoid an Error-Bit generation on the CEC line | |||
| upon an error detected on a broadcast message. | |||
| It supersedes BREGEN and LBPEGEN bits for a broadcast message error handling. It can take two values: | |||
| 1) CEC_BROADCASTERROR_ERRORBIT_GENERATION. | |||
| a) BRE detection: error-bit generation on the CEC line if BRESTP=CEC_RX_STOP_ON_BRE | |||
| and BREGEN=CEC_BRE_ERRORBIT_NO_GENERATION. | |||
| b) LBPE detection: error-bit generation on the CEC line | |||
| if LBPGEN=CEC_LBPE_ERRORBIT_NO_GENERATION. | |||
| 2) CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION. | |||
| no error-bit generation in case neither a) nor b) are satisfied. Additionally, | |||
| there is no error-bit generation in case of Short Bit Period Error detection in | |||
| a broadcast message while LSTN bit is set. */ | |||
| uint32_t SignalFreeTimeOption; /*!< Set SFTOP bit @ref CEC_SFT_Option : specifies when SFT timer starts. | |||
| CEC_SFT_START_ON_TXSOM SFT: timer starts when TXSOM is set by software. | |||
| CEC_SFT_START_ON_TX_RX_END: SFT timer starts automatically at the end of message transmission/reception. */ | |||
| uint32_t ListenMode; /*!< Set LSTN bit @ref CEC_Listening_Mode : specifies device listening mode. It can take two values: | |||
| CEC_REDUCED_LISTENING_MODE: CEC peripheral receives only message addressed to its | |||
| own address (OAR). Messages addressed to different destination are ignored. | |||
| Broadcast messages are always received. | |||
| CEC_FULL_LISTENING_MODE: CEC peripheral receives messages addressed to its own | |||
| address (OAR) with positive acknowledge. Messages addressed to different destination | |||
| are received, but without interfering with the CEC bus: no acknowledge sent. */ | |||
| uint16_t OwnAddress; /*!< Own addresses configuration | |||
| This parameter can be a value of @ref CEC_OWN_ADDRESS */ | |||
| uint8_t *RxBuffer; /*!< CEC Rx buffer pointeur */ | |||
| }CEC_InitTypeDef; | |||
| /** | |||
| * @brief HAL CEC State structures definition | |||
| * @note HAL CEC State value is a combination of 2 different substates: gState and RxState. | |||
| * - gState contains CEC state information related to global Handle management | |||
| * and also information related to Tx operations. | |||
| * gState value coding follow below described bitmap : | |||
| * b7 (not used) | |||
| * x : Should be set to 0 | |||
| * b6 Error information | |||
| * 0 : No Error | |||
| * 1 : Error | |||
| * b5 IP initilisation status | |||
| * 0 : Reset (IP not initialized) | |||
| * 1 : Init done (IP initialized. HAL CEC Init function already called) | |||
| * b4-b3 (not used) | |||
| * xx : Should be set to 00 | |||
| * b2 Intrinsic process state | |||
| * 0 : Ready | |||
| * 1 : Busy (IP busy with some configuration or internal operations) | |||
| * b1 (not used) | |||
| * x : Should be set to 0 | |||
| * b0 Tx state | |||
| * 0 : Ready (no Tx operation ongoing) | |||
| * 1 : Busy (Tx operation ongoing) | |||
| * - RxState contains information related to Rx operations. | |||
| * RxState value coding follow below described bitmap : | |||
| * b7-b6 (not used) | |||
| * xx : Should be set to 00 | |||
| * b5 IP initilisation status | |||
| * 0 : Reset (IP not initialized) | |||
| * 1 : Init done (IP initialized) | |||
| * b4-b2 (not used) | |||
| * xxx : Should be set to 000 | |||
| * b1 Rx state | |||
| * 0 : Ready (no Rx operation ongoing) | |||
| * 1 : Busy (Rx operation ongoing) | |||
| * b0 (not used) | |||
| * x : Should be set to 0. | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_CEC_STATE_RESET = 0x00U, /*!< Peripheral is not yet Initialized | |||
| Value is allowed for gState and RxState */ | |||
| HAL_CEC_STATE_READY = 0x20U, /*!< Peripheral Initialized and ready for use | |||
| Value is allowed for gState and RxState */ | |||
| HAL_CEC_STATE_BUSY = 0x24U, /*!< an internal process is ongoing | |||
| Value is allowed for gState only */ | |||
| HAL_CEC_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing | |||
| Value is allowed for RxState only */ | |||
| HAL_CEC_STATE_BUSY_TX = 0x21U, /*!< Data Transmission process is ongoing | |||
| Value is allowed for gState only */ | |||
| HAL_CEC_STATE_ERROR = 0x60U /*!< Error Value is allowed for gState only */ | |||
| }HAL_CEC_StateTypeDef; | |||
| /** | |||
| * @brief CEC handle Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| CEC_TypeDef *Instance; /*!< CEC registers base address */ | |||
| CEC_InitTypeDef Init; /*!< CEC communication parameters */ | |||
| uint8_t *pTxBuffPtr; /*!< Pointer to CEC Tx transfer Buffer */ | |||
| uint16_t TxXferCount; /*!< CEC Tx Transfer Counter */ | |||
| uint16_t RxXferSize; /*!< CEC Rx Transfer size, 0: header received only */ | |||
| HAL_LockTypeDef Lock; /*!< Locking object */ | |||
| HAL_CEC_StateTypeDef gState; /*!< CEC state information related to global Handle management | |||
| and also related to Tx operations. | |||
| This parameter can be a value of @ref HAL_CEC_StateTypeDef */ | |||
| HAL_CEC_StateTypeDef RxState; /*!< CEC state information related to Rx operations. | |||
| This parameter can be a value of @ref HAL_CEC_StateTypeDef */ | |||
| uint32_t ErrorCode; /*!< For errors handling purposes, copy of ISR register | |||
| in case error is reported */ | |||
| }CEC_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup CEC_Exported_Constants CEC Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup CEC_Error_Code CEC Error Code | |||
| * @{ | |||
| */ | |||
| #define HAL_CEC_ERROR_NONE ((uint32_t)0x00000000U)/*!< no error */ | |||
| #define HAL_CEC_ERROR_RXOVR CEC_ISR_RXOVR /*!< CEC Rx-Overrun */ | |||
| #define HAL_CEC_ERROR_BRE CEC_ISR_BRE /*!< CEC Rx Bit Rising Error */ | |||
| #define HAL_CEC_ERROR_SBPE CEC_ISR_SBPE /*!< CEC Rx Short Bit period Error */ | |||
| #define HAL_CEC_ERROR_LBPE CEC_ISR_LBPE /*!< CEC Rx Long Bit period Error */ | |||
| #define HAL_CEC_ERROR_RXACKE CEC_ISR_RXACKE /*!< CEC Rx Missing Acknowledge */ | |||
| #define HAL_CEC_ERROR_ARBLST CEC_ISR_ARBLST /*!< CEC Arbitration Lost */ | |||
| #define HAL_CEC_ERROR_TXUDR CEC_ISR_TXUDR /*!< CEC Tx-Buffer Underrun */ | |||
| #define HAL_CEC_ERROR_TXERR CEC_ISR_TXERR /*!< CEC Tx-Error */ | |||
| #define HAL_CEC_ERROR_TXACKE CEC_ISR_TXACKE /*!< CEC Tx Missing Acknowledge */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CEC_Signal_Free_Time CEC Signal Free Time setting parameter | |||
| * @{ | |||
| */ | |||
| #define CEC_DEFAULT_SFT ((uint32_t)0x00000000U) | |||
| #define CEC_0_5_BITPERIOD_SFT ((uint32_t)0x00000001U) | |||
| #define CEC_1_5_BITPERIOD_SFT ((uint32_t)0x00000002U) | |||
| #define CEC_2_5_BITPERIOD_SFT ((uint32_t)0x00000003U) | |||
| #define CEC_3_5_BITPERIOD_SFT ((uint32_t)0x00000004U) | |||
| #define CEC_4_5_BITPERIOD_SFT ((uint32_t)0x00000005U) | |||
| #define CEC_5_5_BITPERIOD_SFT ((uint32_t)0x00000006U) | |||
| #define CEC_6_5_BITPERIOD_SFT ((uint32_t)0x00000007U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CEC_Tolerance CEC Receiver Tolerance | |||
| * @{ | |||
| */ | |||
| #define CEC_STANDARD_TOLERANCE ((uint32_t)0x00000000U) | |||
| #define CEC_EXTENDED_TOLERANCE ((uint32_t)CEC_CFGR_RXTOL) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CEC_BRERxStop CEC Reception Stop on Error | |||
| * @{ | |||
| */ | |||
| #define CEC_NO_RX_STOP_ON_BRE ((uint32_t)0x00000000U) | |||
| #define CEC_RX_STOP_ON_BRE ((uint32_t)CEC_CFGR_BRESTP) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CEC_BREErrorBitGen CEC Error Bit Generation if Bit Rise Error reported | |||
| * @{ | |||
| */ | |||
| #define CEC_BRE_ERRORBIT_NO_GENERATION ((uint32_t)0x00000000U) | |||
| #define CEC_BRE_ERRORBIT_GENERATION ((uint32_t)CEC_CFGR_BREGEN) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CEC_LBPEErrorBitGen CEC Error Bit Generation if Long Bit Period Error reported | |||
| * @{ | |||
| */ | |||
| #define CEC_LBPE_ERRORBIT_NO_GENERATION ((uint32_t)0x00000000U) | |||
| #define CEC_LBPE_ERRORBIT_GENERATION ((uint32_t)CEC_CFGR_LBPEGEN) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CEC_BroadCastMsgErrorBitGen CEC Error Bit Generation on Broadcast message | |||
| * @{ | |||
| */ | |||
| #define CEC_BROADCASTERROR_ERRORBIT_GENERATION ((uint32_t)0x00000000U) | |||
| #define CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION ((uint32_t)CEC_CFGR_BRDNOGEN) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CEC_SFT_Option CEC Signal Free Time start option | |||
| * @{ | |||
| */ | |||
| #define CEC_SFT_START_ON_TXSOM ((uint32_t)0x00000000U) | |||
| #define CEC_SFT_START_ON_TX_RX_END ((uint32_t)CEC_CFGR_SFTOPT) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CEC_Listening_Mode CEC Listening mode option | |||
| * @{ | |||
| */ | |||
| #define CEC_REDUCED_LISTENING_MODE ((uint32_t)0x00000000U) | |||
| #define CEC_FULL_LISTENING_MODE ((uint32_t)CEC_CFGR_LSTN) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CEC_OAR_Position CEC Device Own Address position in CEC CFGR register | |||
| * @{ | |||
| */ | |||
| #define CEC_CFGR_OAR_LSB_POS ((uint32_t) 16U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CEC_Initiator_Position CEC Initiator logical address position in message header | |||
| * @{ | |||
| */ | |||
| #define CEC_INITIATOR_LSB_POS ((uint32_t) 4U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CEC_OWN_ADDRESS CEC Own Address | |||
| * @{ | |||
| */ | |||
| #define CEC_OWN_ADDRESS_NONE ((uint16_t) 0x0000U) /* Reset value */ | |||
| #define CEC_OWN_ADDRESS_0 ((uint16_t) 0x0001U) /* Logical Address 0 */ | |||
| #define CEC_OWN_ADDRESS_1 ((uint16_t) 0x0002U) /* Logical Address 1 */ | |||
| #define CEC_OWN_ADDRESS_2 ((uint16_t) 0x0004U) /* Logical Address 2 */ | |||
| #define CEC_OWN_ADDRESS_3 ((uint16_t) 0x0008U) /* Logical Address 3 */ | |||
| #define CEC_OWN_ADDRESS_4 ((uint16_t) 0x0010U) /* Logical Address 4 */ | |||
| #define CEC_OWN_ADDRESS_5 ((uint16_t) 0x0020U) /* Logical Address 5 */ | |||
| #define CEC_OWN_ADDRESS_6 ((uint16_t) 0x0040U) /* Logical Address 6 */ | |||
| #define CEC_OWN_ADDRESS_7 ((uint16_t) 0x0080U) /* Logical Address 7 */ | |||
| #define CEC_OWN_ADDRESS_8 ((uint16_t) 0x0100U) /* Logical Address 9 */ | |||
| #define CEC_OWN_ADDRESS_9 ((uint16_t) 0x0200U) /* Logical Address 10 */ | |||
| #define CEC_OWN_ADDRESS_10 ((uint16_t) 0x0400U) /* Logical Address 11 */ | |||
| #define CEC_OWN_ADDRESS_11 ((uint16_t) 0x0800U) /* Logical Address 12 */ | |||
| #define CEC_OWN_ADDRESS_12 ((uint16_t) 0x1000U) /* Logical Address 13 */ | |||
| #define CEC_OWN_ADDRESS_13 ((uint16_t) 0x2000U) /* Logical Address 14 */ | |||
| #define CEC_OWN_ADDRESS_14 ((uint16_t) 0x4000U) /* Logical Address 15 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CEC_Interrupts_Definitions CEC Interrupts definition | |||
| * @{ | |||
| */ | |||
| #define CEC_IT_TXACKE CEC_IER_TXACKEIE | |||
| #define CEC_IT_TXERR CEC_IER_TXERRIE | |||
| #define CEC_IT_TXUDR CEC_IER_TXUDRIE | |||
| #define CEC_IT_TXEND CEC_IER_TXENDIE | |||
| #define CEC_IT_TXBR CEC_IER_TXBRIE | |||
| #define CEC_IT_ARBLST CEC_IER_ARBLSTIE | |||
| #define CEC_IT_RXACKE CEC_IER_RXACKEIE | |||
| #define CEC_IT_LBPE CEC_IER_LBPEIE | |||
| #define CEC_IT_SBPE CEC_IER_SBPEIE | |||
| #define CEC_IT_BRE CEC_IER_BREIE | |||
| #define CEC_IT_RXOVR CEC_IER_RXOVRIE | |||
| #define CEC_IT_RXEND CEC_IER_RXENDIE | |||
| #define CEC_IT_RXBR CEC_IER_RXBRIE | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CEC_Flags_Definitions CEC Flags definition | |||
| * @{ | |||
| */ | |||
| #define CEC_FLAG_TXACKE CEC_ISR_TXACKE | |||
| #define CEC_FLAG_TXERR CEC_ISR_TXERR | |||
| #define CEC_FLAG_TXUDR CEC_ISR_TXUDR | |||
| #define CEC_FLAG_TXEND CEC_ISR_TXEND | |||
| #define CEC_FLAG_TXBR CEC_ISR_TXBR | |||
| #define CEC_FLAG_ARBLST CEC_ISR_ARBLST | |||
| #define CEC_FLAG_RXACKE CEC_ISR_RXACKE | |||
| #define CEC_FLAG_LBPE CEC_ISR_LBPE | |||
| #define CEC_FLAG_SBPE CEC_ISR_SBPE | |||
| #define CEC_FLAG_BRE CEC_ISR_BRE | |||
| #define CEC_FLAG_RXOVR CEC_ISR_RXOVR | |||
| #define CEC_FLAG_RXEND CEC_ISR_RXEND | |||
| #define CEC_FLAG_RXBR CEC_ISR_RXBR | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CEC_ALL_ERROR CEC all RX or TX errors flags | |||
| * @{ | |||
| */ | |||
| #define CEC_ISR_ALL_ERROR ((uint32_t)CEC_ISR_RXOVR|CEC_ISR_BRE|CEC_ISR_SBPE|CEC_ISR_LBPE|CEC_ISR_RXACKE|\ | |||
| CEC_ISR_ARBLST|CEC_ISR_TXUDR|CEC_ISR_TXERR|CEC_ISR_TXACKE) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CEC_IER_ALL_RX CEC all RX errors interrupts enabling flag | |||
| * @{ | |||
| */ | |||
| #define CEC_IER_RX_ALL_ERR ((uint32_t)CEC_IER_RXACKEIE|CEC_IER_LBPEIE|CEC_IER_SBPEIE|CEC_IER_BREIE|CEC_IER_RXOVRIE) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CEC_IER_ALL_TX CEC all TX errors interrupts enabling flag | |||
| * @{ | |||
| */ | |||
| #define CEC_IER_TX_ALL_ERR ((uint32_t)CEC_IER_TXACKEIE|CEC_IER_TXERRIE|CEC_IER_TXUDRIE|CEC_IER_ARBLSTIE) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macros -----------------------------------------------------------*/ | |||
| /** @defgroup CEC_Exported_Macros CEC Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset CEC handle gstate & RxState | |||
| * @param __HANDLE__: CEC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_CEC_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->gState = HAL_CEC_STATE_RESET; \ | |||
| (__HANDLE__)->RxState = HAL_CEC_STATE_RESET; \ | |||
| } while(0) | |||
| /** @brief Checks whether or not the specified CEC interrupt flag is set. | |||
| * @param __HANDLE__: specifies the CEC Handle. | |||
| * @param __FLAG__: specifies the flag to check. | |||
| * @arg CEC_FLAG_TXACKE: Tx Missing acknowledge Error | |||
| * @arg CEC_FLAG_TXERR: Tx Error. | |||
| * @arg CEC_FLAG_TXUDR: Tx-Buffer Underrun. | |||
| * @arg CEC_FLAG_TXEND: End of transmission (successful transmission of the last byte). | |||
| * @arg CEC_FLAG_TXBR: Tx-Byte Request. | |||
| * @arg CEC_FLAG_ARBLST: Arbitration Lost | |||
| * @arg CEC_FLAG_RXACKE: Rx-Missing Acknowledge | |||
| * @arg CEC_FLAG_LBPE: Rx Long period Error | |||
| * @arg CEC_FLAG_SBPE: Rx Short period Error | |||
| * @arg CEC_FLAG_BRE: Rx Bit Rising Error | |||
| * @arg CEC_FLAG_RXOVR: Rx Overrun. | |||
| * @arg CEC_FLAG_RXEND: End Of Reception. | |||
| * @arg CEC_FLAG_RXBR: Rx-Byte Received. | |||
| * @retval ITStatus | |||
| */ | |||
| #define __HAL_CEC_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR & (__FLAG__)) | |||
| /** @brief Clears the interrupt or status flag when raised (write at 1) | |||
| * @param __HANDLE__: specifies the CEC Handle. | |||
| * @param __FLAG__: specifies the interrupt/status flag to clear. | |||
| * This parameter can be one of the following values: | |||
| * @arg CEC_FLAG_TXACKE: Tx Missing acknowledge Error | |||
| * @arg CEC_FLAG_TXERR: Tx Error. | |||
| * @arg CEC_FLAG_TXUDR: Tx-Buffer Underrun. | |||
| * @arg CEC_FLAG_TXEND: End of transmission (successful transmission of the last byte). | |||
| * @arg CEC_FLAG_TXBR: Tx-Byte Request. | |||
| * @arg CEC_FLAG_ARBLST: Arbitration Lost | |||
| * @arg CEC_FLAG_RXACKE: Rx-Missing Acknowledge | |||
| * @arg CEC_FLAG_LBPE: Rx Long period Error | |||
| * @arg CEC_FLAG_SBPE: Rx Short period Error | |||
| * @arg CEC_FLAG_BRE: Rx Bit Rising Error | |||
| * @arg CEC_FLAG_RXOVR: Rx Overrun. | |||
| * @arg CEC_FLAG_RXEND: End Of Reception. | |||
| * @arg CEC_FLAG_RXBR: Rx-Byte Received. | |||
| * @retval none | |||
| */ | |||
| #define __HAL_CEC_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR |= (__FLAG__)) | |||
| /** @brief Enables the specified CEC interrupt. | |||
| * @param __HANDLE__: specifies the CEC Handle. | |||
| * @param __INTERRUPT__: specifies the CEC interrupt to enable. | |||
| * This parameter can be one of the following values: | |||
| * @arg CEC_IT_TXACKE: Tx Missing acknowledge Error IT Enable | |||
| * @arg CEC_IT_TXERR: Tx Error IT Enable | |||
| * @arg CEC_IT_TXUDR: Tx-Buffer Underrun IT Enable | |||
| * @arg CEC_IT_TXEND: End of transmission IT Enable | |||
| * @arg CEC_IT_TXBR: Tx-Byte Request IT Enable | |||
| * @arg CEC_IT_ARBLST: Arbitration Lost IT Enable | |||
| * @arg CEC_IT_RXACKE: Rx-Missing Acknowledge IT Enable | |||
| * @arg CEC_IT_LBPE: Rx Long period Error IT Enable | |||
| * @arg CEC_IT_SBPE: Rx Short period Error IT Enable | |||
| * @arg CEC_IT_BRE: Rx Bit Rising Error IT Enable | |||
| * @arg CEC_IT_RXOVR: Rx Overrun IT Enable | |||
| * @arg CEC_IT_RXEND: End Of Reception IT Enable | |||
| * @arg CEC_IT_RXBR: Rx-Byte Received IT Enable | |||
| * @retval none | |||
| */ | |||
| #define __HAL_CEC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__)) | |||
| /** @brief Disables the specified CEC interrupt. | |||
| * @param __HANDLE__: specifies the CEC Handle. | |||
| * @param __INTERRUPT__: specifies the CEC interrupt to disable. | |||
| * This parameter can be one of the following values: | |||
| * @arg CEC_IT_TXACKE: Tx Missing acknowledge Error IT Enable | |||
| * @arg CEC_IT_TXERR: Tx Error IT Enable | |||
| * @arg CEC_IT_TXUDR: Tx-Buffer Underrun IT Enable | |||
| * @arg CEC_IT_TXEND: End of transmission IT Enable | |||
| * @arg CEC_IT_TXBR: Tx-Byte Request IT Enable | |||
| * @arg CEC_IT_ARBLST: Arbitration Lost IT Enable | |||
| * @arg CEC_IT_RXACKE: Rx-Missing Acknowledge IT Enable | |||
| * @arg CEC_IT_LBPE: Rx Long period Error IT Enable | |||
| * @arg CEC_IT_SBPE: Rx Short period Error IT Enable | |||
| * @arg CEC_IT_BRE: Rx Bit Rising Error IT Enable | |||
| * @arg CEC_IT_RXOVR: Rx Overrun IT Enable | |||
| * @arg CEC_IT_RXEND: End Of Reception IT Enable | |||
| * @arg CEC_IT_RXBR: Rx-Byte Received IT Enable | |||
| * @retval none | |||
| */ | |||
| #define __HAL_CEC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= (~(__INTERRUPT__))) | |||
| /** @brief Checks whether or not the specified CEC interrupt is enabled. | |||
| * @param __HANDLE__: specifies the CEC Handle. | |||
| * @param __INTERRUPT__: specifies the CEC interrupt to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg CEC_IT_TXACKE: Tx Missing acknowledge Error IT Enable | |||
| * @arg CEC_IT_TXERR: Tx Error IT Enable | |||
| * @arg CEC_IT_TXUDR: Tx-Buffer Underrun IT Enable | |||
| * @arg CEC_IT_TXEND: End of transmission IT Enable | |||
| * @arg CEC_IT_TXBR: Tx-Byte Request IT Enable | |||
| * @arg CEC_IT_ARBLST: Arbitration Lost IT Enable | |||
| * @arg CEC_IT_RXACKE: Rx-Missing Acknowledge IT Enable | |||
| * @arg CEC_IT_LBPE: Rx Long period Error IT Enable | |||
| * @arg CEC_IT_SBPE: Rx Short period Error IT Enable | |||
| * @arg CEC_IT_BRE: Rx Bit Rising Error IT Enable | |||
| * @arg CEC_IT_RXOVR: Rx Overrun IT Enable | |||
| * @arg CEC_IT_RXEND: End Of Reception IT Enable | |||
| * @arg CEC_IT_RXBR: Rx-Byte Received IT Enable | |||
| * @retval FlagStatus | |||
| */ | |||
| #define __HAL_CEC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER & (__INTERRUPT__)) | |||
| /** @brief Enables the CEC device | |||
| * @param __HANDLE__: specifies the CEC Handle. | |||
| * @retval none | |||
| */ | |||
| #define __HAL_CEC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= CEC_CR_CECEN) | |||
| /** @brief Disables the CEC device | |||
| * @param __HANDLE__: specifies the CEC Handle. | |||
| * @retval none | |||
| */ | |||
| #define __HAL_CEC_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~CEC_CR_CECEN) | |||
| /** @brief Set Transmission Start flag | |||
| * @param __HANDLE__: specifies the CEC Handle. | |||
| * @retval none | |||
| */ | |||
| #define __HAL_CEC_FIRST_BYTE_TX_SET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CEC_CR_TXSOM) | |||
| /** @brief Set Transmission End flag | |||
| * @param __HANDLE__: specifies the CEC Handle. | |||
| * @retval none | |||
| * If the CEC message consists of only one byte, TXEOM must be set before of TXSOM. | |||
| */ | |||
| #define __HAL_CEC_LAST_BYTE_TX_SET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CEC_CR_TXEOM) | |||
| /** @brief Get Transmission Start flag | |||
| * @param __HANDLE__: specifies the CEC Handle. | |||
| * @retval FlagStatus | |||
| */ | |||
| #define __HAL_CEC_GET_TRANSMISSION_START_FLAG(__HANDLE__) ((__HANDLE__)->Instance->CR & CEC_CR_TXSOM) | |||
| /** @brief Get Transmission End flag | |||
| * @param __HANDLE__: specifies the CEC Handle. | |||
| * @retval FlagStatus | |||
| */ | |||
| #define __HAL_CEC_GET_TRANSMISSION_END_FLAG(__HANDLE__) ((__HANDLE__)->Instance->CR & CEC_CR_TXEOM) | |||
| /** @brief Clear OAR register | |||
| * @param __HANDLE__: specifies the CEC Handle. | |||
| * @retval none | |||
| */ | |||
| #define __HAL_CEC_CLEAR_OAR(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CFGR, CEC_CFGR_OAR) | |||
| /** @brief Set OAR register (without resetting previously set address in case of multi-address mode) | |||
| * To reset OAR, __HAL_CEC_CLEAR_OAR() needs to be called beforehand | |||
| * @param __HANDLE__: specifies the CEC Handle. | |||
| * @param __ADDRESS__: Own Address value (CEC logical address is identified by bit position) | |||
| * @retval none | |||
| */ | |||
| #define __HAL_CEC_SET_OAR(__HANDLE__,__ADDRESS__) SET_BIT((__HANDLE__)->Instance->CFGR, (__ADDRESS__)<< CEC_CFGR_OAR_LSB_POS) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup CEC_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup CEC_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| /* Initialization and de-initialization functions ****************************/ | |||
| HAL_StatusTypeDef HAL_CEC_Init(CEC_HandleTypeDef *hcec); | |||
| HAL_StatusTypeDef HAL_CEC_DeInit(CEC_HandleTypeDef *hcec); | |||
| HAL_StatusTypeDef HAL_CEC_SetDeviceAddress(CEC_HandleTypeDef *hcec, uint16_t CEC_OwnAddress); | |||
| void HAL_CEC_MspInit(CEC_HandleTypeDef *hcec); | |||
| void HAL_CEC_MspDeInit(CEC_HandleTypeDef *hcec); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup CEC_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| /* I/O operation functions ***************************************************/ | |||
| HAL_StatusTypeDef HAL_CEC_Transmit_IT(CEC_HandleTypeDef *hcec, uint8_t InitiatorAddress,uint8_t DestinationAddress, uint8_t *pData, uint32_t Size); | |||
| uint32_t HAL_CEC_GetLastReceivedFrameSize(CEC_HandleTypeDef *hcec); | |||
| void HAL_CEC_ChangeRxBuffer(CEC_HandleTypeDef *hcec, uint8_t* Rxbuffer); | |||
| void HAL_CEC_IRQHandler(CEC_HandleTypeDef *hcec); | |||
| void HAL_CEC_TxCpltCallback(CEC_HandleTypeDef *hcec); | |||
| void HAL_CEC_RxCpltCallback(CEC_HandleTypeDef *hcec, uint32_t RxFrameSize); | |||
| void HAL_CEC_ErrorCallback(CEC_HandleTypeDef *hcec); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup CEC_Exported_Functions_Group3 | |||
| * @{ | |||
| */ | |||
| /* Peripheral State functions ************************************************/ | |||
| HAL_CEC_StateTypeDef HAL_CEC_GetState(CEC_HandleTypeDef *hcec); | |||
| uint32_t HAL_CEC_GetError(CEC_HandleTypeDef *hcec); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /** @defgroup CEC_Private_Types CEC Private Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /** @defgroup CEC_Private_Variables CEC Private Variables | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup CEC_Private_Constants CEC Private Constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup CEC_Private_Macros CEC Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_CEC_SIGNALFREETIME(__SFT__) ((__SFT__) <= CEC_CFGR_SFT) | |||
| #define IS_CEC_TOLERANCE(__RXTOL__) (((__RXTOL__) == CEC_STANDARD_TOLERANCE) || \ | |||
| ((__RXTOL__) == CEC_EXTENDED_TOLERANCE)) | |||
| #define IS_CEC_BRERXSTOP(__BRERXSTOP__) (((__BRERXSTOP__) == CEC_NO_RX_STOP_ON_BRE) || \ | |||
| ((__BRERXSTOP__) == CEC_RX_STOP_ON_BRE)) | |||
| #define IS_CEC_BREERRORBITGEN(__ERRORBITGEN__) (((__ERRORBITGEN__) == CEC_BRE_ERRORBIT_NO_GENERATION) || \ | |||
| ((__ERRORBITGEN__) == CEC_BRE_ERRORBIT_GENERATION)) | |||
| #define IS_CEC_LBPEERRORBITGEN(__ERRORBITGEN__) (((__ERRORBITGEN__) == CEC_LBPE_ERRORBIT_NO_GENERATION) || \ | |||
| ((__ERRORBITGEN__) == CEC_LBPE_ERRORBIT_GENERATION)) | |||
| #define IS_CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION(__ERRORBITGEN__) (((__ERRORBITGEN__) == CEC_BROADCASTERROR_ERRORBIT_GENERATION) || \ | |||
| ((__ERRORBITGEN__) == CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION)) | |||
| #define IS_CEC_SFTOP(__SFTOP__) (((__SFTOP__) == CEC_SFT_START_ON_TXSOM) || \ | |||
| ((__SFTOP__) == CEC_SFT_START_ON_TX_RX_END)) | |||
| #define IS_CEC_LISTENING_MODE(__MODE__) (((__MODE__) == CEC_REDUCED_LISTENING_MODE) || \ | |||
| ((__MODE__) == CEC_FULL_LISTENING_MODE)) | |||
| /** @brief Check CEC message size. | |||
| * The message size is the payload size: without counting the header, | |||
| * it varies from 0 byte (ping operation, one header only, no payload) to | |||
| * 15 bytes (1 opcode and up to 14 operands following the header). | |||
| * @param __SIZE__: CEC message size. | |||
| * @retval Test result (TRUE or FALSE). | |||
| */ | |||
| #define IS_CEC_MSGSIZE(__SIZE__) ((__SIZE__) <= 0x10) | |||
| /** @brief Check CEC device Own Address Register (OAR) setting. | |||
| * OAR address is written in a 15-bit field within CEC_CFGR register. | |||
| * @param __ADDRESS__: CEC own address. | |||
| * @retval Test result (TRUE or FALSE). | |||
| */ | |||
| #define IS_CEC_OWN_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0x7FFFU) | |||
| /** @brief Check CEC initiator or destination logical address setting. | |||
| * Initiator and destination addresses are coded over 4 bits. | |||
| * @param __ADDRESS__: CEC initiator or logical address. | |||
| * @retval Test result (TRUE or FALSE). | |||
| */ | |||
| #define IS_CEC_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0x0FU) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup CEC_Private_Functions CEC Private Functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F446xx */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_CEC_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,454 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_conf_template.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief HAL configuration template file. | |||
| * This file should be copied to the application folder and renamed | |||
| * to stm32f4xx_hal_conf.h. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_CONF_H | |||
| #define __STM32F4xx_HAL_CONF_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /* ########################## Module Selection ############################## */ | |||
| /** | |||
| * @brief This is the list of modules to be used in the HAL driver | |||
| */ | |||
| #define HAL_MODULE_ENABLED | |||
| #define HAL_ADC_MODULE_ENABLED | |||
| #define HAL_CAN_MODULE_ENABLED | |||
| #define HAL_CRC_MODULE_ENABLED | |||
| #define HAL_CEC_MODULE_ENABLED | |||
| #define HAL_CRYP_MODULE_ENABLED | |||
| #define HAL_DAC_MODULE_ENABLED | |||
| #define HAL_DCMI_MODULE_ENABLED | |||
| #define HAL_DMA_MODULE_ENABLED | |||
| #define HAL_DMA2D_MODULE_ENABLED | |||
| #define HAL_ETH_MODULE_ENABLED | |||
| #define HAL_FLASH_MODULE_ENABLED | |||
| #define HAL_NAND_MODULE_ENABLED | |||
| #define HAL_NOR_MODULE_ENABLED | |||
| #define HAL_PCCARD_MODULE_ENABLED | |||
| #define HAL_SRAM_MODULE_ENABLED | |||
| #define HAL_SDRAM_MODULE_ENABLED | |||
| #define HAL_HASH_MODULE_ENABLED | |||
| #define HAL_GPIO_MODULE_ENABLED | |||
| #define HAL_I2C_MODULE_ENABLED | |||
| #define HAL_I2S_MODULE_ENABLED | |||
| #define HAL_IWDG_MODULE_ENABLED | |||
| #define HAL_LTDC_MODULE_ENABLED | |||
| #define HAL_DSI_MODULE_ENABLED | |||
| #define HAL_PWR_MODULE_ENABLED | |||
| #define HAL_QSPI_MODULE_ENABLED | |||
| #define HAL_RCC_MODULE_ENABLED | |||
| #define HAL_RNG_MODULE_ENABLED | |||
| #define HAL_RTC_MODULE_ENABLED | |||
| #define HAL_SAI_MODULE_ENABLED | |||
| #define HAL_SD_MODULE_ENABLED | |||
| #define HAL_SPI_MODULE_ENABLED | |||
| #define HAL_TIM_MODULE_ENABLED | |||
| #define HAL_UART_MODULE_ENABLED | |||
| #define HAL_USART_MODULE_ENABLED | |||
| #define HAL_IRDA_MODULE_ENABLED | |||
| #define HAL_SMARTCARD_MODULE_ENABLED | |||
| #define HAL_WWDG_MODULE_ENABLED | |||
| #define HAL_CORTEX_MODULE_ENABLED | |||
| #define HAL_PCD_MODULE_ENABLED | |||
| #define HAL_HCD_MODULE_ENABLED | |||
| #define HAL_FMPI2C_MODULE_ENABLED | |||
| #define HAL_SPDIFRX_MODULE_ENABLED | |||
| #define HAL_DFSDM_MODULE_ENABLED | |||
| #define HAL_LPTIM_MODULE_ENABLED | |||
| /* ########################## HSE/HSI Values adaptation ##################### */ | |||
| /** | |||
| * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. | |||
| * This value is used by the RCC HAL module to compute the system frequency | |||
| * (when HSE is used as system clock source, directly or through the PLL). | |||
| */ | |||
| #if !defined (HSE_VALUE) | |||
| #define HSE_VALUE ((uint32_t)25000000U) /*!< Value of the External oscillator in Hz */ | |||
| #endif /* HSE_VALUE */ | |||
| #if !defined (HSE_STARTUP_TIMEOUT) | |||
| #define HSE_STARTUP_TIMEOUT ((uint32_t)100U) /*!< Time out for HSE start up, in ms */ | |||
| #endif /* HSE_STARTUP_TIMEOUT */ | |||
| /** | |||
| * @brief Internal High Speed oscillator (HSI) value. | |||
| * This value is used by the RCC HAL module to compute the system frequency | |||
| * (when HSI is used as system clock source, directly or through the PLL). | |||
| */ | |||
| #if !defined (HSI_VALUE) | |||
| #define HSI_VALUE ((uint32_t)16000000U) /*!< Value of the Internal oscillator in Hz*/ | |||
| #endif /* HSI_VALUE */ | |||
| /** | |||
| * @brief Internal Low Speed oscillator (LSI) value. | |||
| */ | |||
| #if !defined (LSI_VALUE) | |||
| #define LSI_VALUE ((uint32_t)32000U) /*!< LSI Typical Value in Hz*/ | |||
| #endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz | |||
| The real value may vary depending on the variations | |||
| in voltage and temperature.*/ | |||
| /** | |||
| * @brief External Low Speed oscillator (LSE) value. | |||
| */ | |||
| #if !defined (LSE_VALUE) | |||
| #define LSE_VALUE ((uint32_t)32768U) /*!< Value of the External Low Speed oscillator in Hz */ | |||
| #endif /* LSE_VALUE */ | |||
| #if !defined (LSE_STARTUP_TIMEOUT) | |||
| #define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */ | |||
| #endif /* LSE_STARTUP_TIMEOUT */ | |||
| /** | |||
| * @brief External clock source for I2S peripheral | |||
| * This value is used by the I2S HAL module to compute the I2S clock source | |||
| * frequency, this source is inserted directly through I2S_CKIN pad. | |||
| */ | |||
| #if !defined (EXTERNAL_CLOCK_VALUE) | |||
| #define EXTERNAL_CLOCK_VALUE ((uint32_t)12288000U) /*!< Value of the Internal oscillator in Hz*/ | |||
| #endif /* EXTERNAL_CLOCK_VALUE */ | |||
| /* Tip: To avoid modifying this file each time you need to use different HSE, | |||
| === you can define the HSE value in your toolchain compiler preprocessor. */ | |||
| /* ########################### System Configuration ######################### */ | |||
| /** | |||
| * @brief This is the HAL system configuration section | |||
| */ | |||
| #define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */ | |||
| #define TICK_INT_PRIORITY ((uint32_t)0x0FU) /*!< tick interrupt priority */ | |||
| #define USE_RTOS 0U | |||
| #define PREFETCH_ENABLE 1U | |||
| #define INSTRUCTION_CACHE_ENABLE 1U | |||
| #define DATA_CACHE_ENABLE 1U | |||
| /* ########################## Assert Selection ############################## */ | |||
| /** | |||
| * @brief Uncomment the line below to expanse the "assert_param" macro in the | |||
| * HAL drivers code | |||
| */ | |||
| /* #define USE_FULL_ASSERT 1U */ | |||
| /* ################## Ethernet peripheral configuration ##################### */ | |||
| /* Section 1 : Ethernet peripheral configuration */ | |||
| /* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */ | |||
| #define MAC_ADDR0 2U | |||
| #define MAC_ADDR1 0U | |||
| #define MAC_ADDR2 0U | |||
| #define MAC_ADDR3 0U | |||
| #define MAC_ADDR4 0U | |||
| #define MAC_ADDR5 0U | |||
| /* Definition of the Ethernet driver buffers size and count */ | |||
| #define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */ | |||
| #define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */ | |||
| #define ETH_RXBUFNB ((uint32_t)4U) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */ | |||
| #define ETH_TXBUFNB ((uint32_t)4U) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */ | |||
| /* Section 2: PHY configuration section */ | |||
| /* DP83848 PHY Address*/ | |||
| #define DP83848_PHY_ADDRESS 0x01U | |||
| /* PHY Reset delay these values are based on a 1 ms Systick interrupt*/ | |||
| #define PHY_RESET_DELAY ((uint32_t)0x000000FFU) | |||
| /* PHY Configuration delay */ | |||
| #define PHY_CONFIG_DELAY ((uint32_t)0x00000FFFU) | |||
| #define PHY_READ_TO ((uint32_t)0x0000FFFFU) | |||
| #define PHY_WRITE_TO ((uint32_t)0x0000FFFFU) | |||
| /* Section 3: Common PHY Registers */ | |||
| #define PHY_BCR ((uint16_t)0x0000U) /*!< Transceiver Basic Control Register */ | |||
| #define PHY_BSR ((uint16_t)0x0001U) /*!< Transceiver Basic Status Register */ | |||
| #define PHY_RESET ((uint16_t)0x8000U) /*!< PHY Reset */ | |||
| #define PHY_LOOPBACK ((uint16_t)0x4000U) /*!< Select loop-back mode */ | |||
| #define PHY_FULLDUPLEX_100M ((uint16_t)0x2100U) /*!< Set the full-duplex mode at 100 Mb/s */ | |||
| #define PHY_HALFDUPLEX_100M ((uint16_t)0x2000U) /*!< Set the half-duplex mode at 100 Mb/s */ | |||
| #define PHY_FULLDUPLEX_10M ((uint16_t)0x0100U) /*!< Set the full-duplex mode at 10 Mb/s */ | |||
| #define PHY_HALFDUPLEX_10M ((uint16_t)0x0000U) /*!< Set the half-duplex mode at 10 Mb/s */ | |||
| #define PHY_AUTONEGOTIATION ((uint16_t)0x1000U) /*!< Enable auto-negotiation function */ | |||
| #define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200U) /*!< Restart auto-negotiation function */ | |||
| #define PHY_POWERDOWN ((uint16_t)0x0800U) /*!< Select the power down mode */ | |||
| #define PHY_ISOLATE ((uint16_t)0x0400U) /*!< Isolate PHY from MII */ | |||
| #define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020U) /*!< Auto-Negotiation process completed */ | |||
| #define PHY_LINKED_STATUS ((uint16_t)0x0004U) /*!< Valid link established */ | |||
| #define PHY_JABBER_DETECTION ((uint16_t)0x0002U) /*!< Jabber condition detected */ | |||
| /* Section 4: Extended PHY Registers */ | |||
| #define PHY_SR ((uint16_t)0x0010U) /*!< PHY status register Offset */ | |||
| #define PHY_MICR ((uint16_t)0x0011U) /*!< MII Interrupt Control Register */ | |||
| #define PHY_MISR ((uint16_t)0x0012U) /*!< MII Interrupt Status and Misc. Control Register */ | |||
| #define PHY_LINK_STATUS ((uint16_t)0x0001U) /*!< PHY Link mask */ | |||
| #define PHY_SPEED_STATUS ((uint16_t)0x0002U) /*!< PHY Speed mask */ | |||
| #define PHY_DUPLEX_STATUS ((uint16_t)0x0004U) /*!< PHY Duplex mask */ | |||
| #define PHY_MICR_INT_EN ((uint16_t)0x0002U) /*!< PHY Enable interrupts */ | |||
| #define PHY_MICR_INT_OE ((uint16_t)0x0001U) /*!< PHY Enable output interrupt events */ | |||
| #define PHY_MISR_LINK_INT_EN ((uint16_t)0x0020U) /*!< Enable Interrupt on change of link status */ | |||
| #define PHY_LINK_INTERRUPT ((uint16_t)0x2000U) /*!< PHY link status interrupt mask */ | |||
| /* ################## SPI peripheral configuration ########################## */ | |||
| /* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver | |||
| * Activated: CRC code is present inside driver | |||
| * Deactivated: CRC code cleaned from driver | |||
| */ | |||
| #define USE_SPI_CRC 1U | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| /** | |||
| * @brief Include module's header file | |||
| */ | |||
| #ifdef HAL_RCC_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_rcc.h" | |||
| #endif /* HAL_RCC_MODULE_ENABLED */ | |||
| #ifdef HAL_GPIO_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_gpio.h" | |||
| #endif /* HAL_GPIO_MODULE_ENABLED */ | |||
| #ifdef HAL_DMA_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_dma.h" | |||
| #endif /* HAL_DMA_MODULE_ENABLED */ | |||
| #ifdef HAL_CORTEX_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_cortex.h" | |||
| #endif /* HAL_CORTEX_MODULE_ENABLED */ | |||
| #ifdef HAL_ADC_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_adc.h" | |||
| #endif /* HAL_ADC_MODULE_ENABLED */ | |||
| #ifdef HAL_CAN_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_can.h" | |||
| #endif /* HAL_CAN_MODULE_ENABLED */ | |||
| #ifdef HAL_CRC_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_crc.h" | |||
| #endif /* HAL_CRC_MODULE_ENABLED */ | |||
| #ifdef HAL_CRYP_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_cryp.h" | |||
| #endif /* HAL_CRYP_MODULE_ENABLED */ | |||
| #ifdef HAL_DMA2D_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_dma2d.h" | |||
| #endif /* HAL_DMA2D_MODULE_ENABLED */ | |||
| #ifdef HAL_DAC_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_dac.h" | |||
| #endif /* HAL_DAC_MODULE_ENABLED */ | |||
| #ifdef HAL_DCMI_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_dcmi.h" | |||
| #endif /* HAL_DCMI_MODULE_ENABLED */ | |||
| #ifdef HAL_ETH_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_eth.h" | |||
| #endif /* HAL_ETH_MODULE_ENABLED */ | |||
| #ifdef HAL_FLASH_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_flash.h" | |||
| #endif /* HAL_FLASH_MODULE_ENABLED */ | |||
| #ifdef HAL_SRAM_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_sram.h" | |||
| #endif /* HAL_SRAM_MODULE_ENABLED */ | |||
| #ifdef HAL_NOR_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_nor.h" | |||
| #endif /* HAL_NOR_MODULE_ENABLED */ | |||
| #ifdef HAL_NAND_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_nand.h" | |||
| #endif /* HAL_NAND_MODULE_ENABLED */ | |||
| #ifdef HAL_PCCARD_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_pccard.h" | |||
| #endif /* HAL_PCCARD_MODULE_ENABLED */ | |||
| #ifdef HAL_SDRAM_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_sdram.h" | |||
| #endif /* HAL_SDRAM_MODULE_ENABLED */ | |||
| #ifdef HAL_HASH_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_hash.h" | |||
| #endif /* HAL_HASH_MODULE_ENABLED */ | |||
| #ifdef HAL_I2C_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_i2c.h" | |||
| #endif /* HAL_I2C_MODULE_ENABLED */ | |||
| #ifdef HAL_I2S_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_i2s.h" | |||
| #endif /* HAL_I2S_MODULE_ENABLED */ | |||
| #ifdef HAL_IWDG_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_iwdg.h" | |||
| #endif /* HAL_IWDG_MODULE_ENABLED */ | |||
| #ifdef HAL_LTDC_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_ltdc.h" | |||
| #endif /* HAL_LTDC_MODULE_ENABLED */ | |||
| #ifdef HAL_PWR_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_pwr.h" | |||
| #endif /* HAL_PWR_MODULE_ENABLED */ | |||
| #ifdef HAL_RNG_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_rng.h" | |||
| #endif /* HAL_RNG_MODULE_ENABLED */ | |||
| #ifdef HAL_RTC_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_rtc.h" | |||
| #endif /* HAL_RTC_MODULE_ENABLED */ | |||
| #ifdef HAL_SAI_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_sai.h" | |||
| #endif /* HAL_SAI_MODULE_ENABLED */ | |||
| #ifdef HAL_SD_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_sd.h" | |||
| #endif /* HAL_SD_MODULE_ENABLED */ | |||
| #ifdef HAL_SPI_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_spi.h" | |||
| #endif /* HAL_SPI_MODULE_ENABLED */ | |||
| #ifdef HAL_TIM_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_tim.h" | |||
| #endif /* HAL_TIM_MODULE_ENABLED */ | |||
| #ifdef HAL_UART_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_uart.h" | |||
| #endif /* HAL_UART_MODULE_ENABLED */ | |||
| #ifdef HAL_USART_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_usart.h" | |||
| #endif /* HAL_USART_MODULE_ENABLED */ | |||
| #ifdef HAL_IRDA_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_irda.h" | |||
| #endif /* HAL_IRDA_MODULE_ENABLED */ | |||
| #ifdef HAL_SMARTCARD_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_smartcard.h" | |||
| #endif /* HAL_SMARTCARD_MODULE_ENABLED */ | |||
| #ifdef HAL_WWDG_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_wwdg.h" | |||
| #endif /* HAL_WWDG_MODULE_ENABLED */ | |||
| #ifdef HAL_PCD_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_pcd.h" | |||
| #endif /* HAL_PCD_MODULE_ENABLED */ | |||
| #ifdef HAL_HCD_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_hcd.h" | |||
| #endif /* HAL_HCD_MODULE_ENABLED */ | |||
| #ifdef HAL_DSI_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_dsi.h" | |||
| #endif /* HAL_DSI_MODULE_ENABLED */ | |||
| #ifdef HAL_QSPI_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_qspi.h" | |||
| #endif /* HAL_QSPI_MODULE_ENABLED */ | |||
| #ifdef HAL_CEC_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_cec.h" | |||
| #endif /* HAL_CEC_MODULE_ENABLED */ | |||
| #ifdef HAL_FMPI2C_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_fmpi2c.h" | |||
| #endif /* HAL_FMPI2C_MODULE_ENABLED */ | |||
| #ifdef HAL_SPDIFRX_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_spdifrx.h" | |||
| #endif /* HAL_SPDIFRX_MODULE_ENABLED */ | |||
| #ifdef HAL_DFSDM_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_dfsdm.h" | |||
| #endif /* HAL_DFSDM_MODULE_ENABLED */ | |||
| #ifdef HAL_LPTIM_MODULE_ENABLED | |||
| #include "stm32f4xx_hal_lptim.h" | |||
| #endif /* HAL_LPTIM_MODULE_ENABLED */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| #ifdef USE_FULL_ASSERT | |||
| /** | |||
| * @brief The assert_param macro is used for function's parameters check. | |||
| * @param expr: If expr is false, it calls assert_failed function | |||
| * which reports the name of the source file and the source | |||
| * line number of the call that failed. | |||
| * If expr is true, it returns no value. | |||
| * @retval None | |||
| */ | |||
| #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) | |||
| /* Exported functions ------------------------------------------------------- */ | |||
| void assert_failed(uint8_t* file, uint32_t line); | |||
| #else | |||
| #define assert_param(expr) ((void)0) | |||
| #endif /* USE_FULL_ASSERT */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_CONF_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_cortex.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of CORTEX HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -0,0 +1,249 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_crc.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of CRC HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_CRC_H | |||
| #define __STM32F4xx_HAL_CRC_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @defgroup CRC CRC | |||
| * @brief CRC HAL module driver | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup CRC_Exported_Types CRC Exported Types | |||
| * @{ | |||
| */ | |||
| /** @defgroup CRC_Exported_Types_Group1 CRC State Structure definition | |||
| * @{ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_CRC_STATE_RESET = 0x00U, /*!< CRC not yet initialized or disabled */ | |||
| HAL_CRC_STATE_READY = 0x01U, /*!< CRC initialized and ready for use */ | |||
| HAL_CRC_STATE_BUSY = 0x02U, /*!< CRC internal process is ongoing */ | |||
| HAL_CRC_STATE_TIMEOUT = 0x03U, /*!< CRC timeout state */ | |||
| HAL_CRC_STATE_ERROR = 0x04U /*!< CRC error state */ | |||
| }HAL_CRC_StateTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CRC_Exported_Types_Group2 CRC Handle Structure definition | |||
| * @{ | |||
| */ | |||
| typedef struct | |||
| { | |||
| CRC_TypeDef *Instance; /*!< Register base address */ | |||
| HAL_LockTypeDef Lock; /*!< CRC locking object */ | |||
| __IO HAL_CRC_StateTypeDef State; /*!< CRC communication state */ | |||
| }CRC_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup CRC_Exported_Macros CRC Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Resets CRC handle state | |||
| * @param __HANDLE__: CRC handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_CRC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CRC_STATE_RESET) | |||
| /** | |||
| * @brief Resets CRC Data Register. | |||
| * @param __HANDLE__: CRC handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_CRC_DR_RESET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_RESET) | |||
| /** | |||
| * @brief Stores a 8-bit data in the Independent Data(ID) register. | |||
| * @param __HANDLE__: CRC handle | |||
| * @param __VALUE__: 8-bit value to be stored in the ID register | |||
| * @retval None | |||
| */ | |||
| #define __HAL_CRC_SET_IDR(__HANDLE__, __VALUE__) (WRITE_REG((__HANDLE__)->Instance->IDR, (__VALUE__))) | |||
| /** | |||
| * @brief Returns the 8-bit data stored in the Independent Data(ID) register. | |||
| * @param __HANDLE__: CRC handle | |||
| * @retval 8-bit value of the ID register | |||
| */ | |||
| #define __HAL_CRC_GET_IDR(__HANDLE__) (((__HANDLE__)->Instance->IDR) & CRC_IDR_IDR) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @defgroup CRC_Exported_Functions CRC Exported Functions | |||
| * @{ | |||
| */ | |||
| /** @defgroup CRC_Exported_Functions_Group1 Initialization and de-initialization functions | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc); | |||
| HAL_StatusTypeDef HAL_CRC_DeInit (CRC_HandleTypeDef *hcrc); | |||
| void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc); | |||
| void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CRC_Exported_Functions_Group2 Peripheral Control functions | |||
| * @{ | |||
| */ | |||
| uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength); | |||
| uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CRC_Exported_Functions_Group3 Peripheral State functions | |||
| * @{ | |||
| */ | |||
| HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /** @defgroup CRC_Private_Types CRC Private Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private defines -----------------------------------------------------------*/ | |||
| /** @defgroup CRC_Private_Defines CRC Private Defines | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /** @defgroup CRC_Private_Variables CRC Private Variables | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup CRC_Private_Constants CRC Private Constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup CRC_Private_Macros CRC Private Macros | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions prototypes ----------------------------------------------*/ | |||
| /** @defgroup CRC_Private_Functions_Prototypes CRC Private Functions Prototypes | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup CRC_Private_Functions CRC Private Functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_CRC_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,295 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_cryp_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of CRYP HAL Extension module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_CRYP_EX_H | |||
| #define __STM32F4xx_HAL_CRYP_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| #if defined(CRYP) | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup CRYPEx | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup CRYPEx_Exported_Constants CRYPEx Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup CRYPEx_Exported_Constants_Group1 CRYP AlgoModeDirection | |||
| * @{ | |||
| */ | |||
| #define CRYP_CR_ALGOMODE_AES_GCM_ENCRYPT ((uint32_t)0x00080000U) | |||
| #define CRYP_CR_ALGOMODE_AES_GCM_DECRYPT ((uint32_t)0x00080004U) | |||
| #define CRYP_CR_ALGOMODE_AES_CCM_ENCRYPT ((uint32_t)0x00080008U) | |||
| #define CRYP_CR_ALGOMODE_AES_CCM_DECRYPT ((uint32_t)0x0008000CU) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CRYPEx_Exported_Constants_Group3 CRYP PhaseConfig | |||
| * @brief The phases are relevant only to AES-GCM and AES-CCM | |||
| * @{ | |||
| */ | |||
| #define CRYP_PHASE_INIT ((uint32_t)0x00000000U) | |||
| #define CRYP_PHASE_HEADER CRYP_CR_GCM_CCMPH_0 | |||
| #define CRYP_PHASE_PAYLOAD CRYP_CR_GCM_CCMPH_1 | |||
| #define CRYP_PHASE_FINAL CRYP_CR_GCM_CCMPH | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup CRYPEx_Exported_Macros CRYP Exported Macros | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief Set the phase: Init, header, payload, final. | |||
| * This is relevant only for GCM and CCM modes. | |||
| * @param __HANDLE__: specifies the CRYP handle. | |||
| * @param __PHASE__: The phase. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_CRYP_SET_PHASE(__HANDLE__, __PHASE__) do{(__HANDLE__)->Instance->CR &= (uint32_t)(~CRYP_CR_GCM_CCMPH);\ | |||
| (__HANDLE__)->Instance->CR |= (uint32_t)(__PHASE__);\ | |||
| }while(0) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @defgroup CRYPEx_Exported_Functions CRYPEx Exported Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup CRYPEx_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| /* AES encryption/decryption using polling ***********************************/ | |||
| HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Finish(CRYP_HandleTypeDef *hcryp, uint32_t Size, uint8_t *AuthTag, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Finish(CRYP_HandleTypeDef *hcryp, uint8_t *AuthTag, uint32_t Timeout); | |||
| /* AES encryption/decryption using interrupt *********************************/ | |||
| HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData); | |||
| HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData); | |||
| HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData); | |||
| HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData); | |||
| /* AES encryption/decryption using DMA ***************************************/ | |||
| HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData); | |||
| HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData); | |||
| HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData); | |||
| HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup CRYPEx_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| void HAL_CRYPEx_GCMCCM_IRQHandler(CRYP_HandleTypeDef *hcryp); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /** @defgroup CRYPEx_Private_Types CRYPEx Private Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /** @defgroup CRYPEx_Private_Variables CRYPEx Private Variables | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup CRYPEx_Private_Constants CRYPEx Private Constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup CRYPEx_Private_Macros CRYPEx Private Macros | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup CRYPEx_Private_Functions CRYPEx Private Functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* CRYP */ | |||
| #if defined (AES) | |||
| /** @addtogroup CRYPEx_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup CRYPEx_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| /* CallBack functions ********************************************************/ | |||
| void HAL_CRYPEx_ComputationCpltCallback(CRYP_HandleTypeDef *hcryp); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup CRYPEx_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| /* AES encryption/decryption processing functions ****************************/ | |||
| HAL_StatusTypeDef HAL_CRYPEx_AES(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint16_t Size, uint8_t *pOutputData, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_CRYPEx_AES_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint16_t Size, uint8_t *pOutputData); | |||
| HAL_StatusTypeDef HAL_CRYPEx_AES_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint16_t Size, uint8_t *pOutputData); | |||
| /* AES encryption/decryption/authentication processing functions *************/ | |||
| HAL_StatusTypeDef HAL_CRYPEx_AES_Auth(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint64_t Size, uint8_t *pOutputData, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_CRYPEx_AES_Auth_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint64_t Size, uint8_t *pOutputData); | |||
| HAL_StatusTypeDef HAL_CRYPEx_AES_Auth_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint64_t Size, uint8_t *pOutputData); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup CRYPEx_Exported_Functions_Group3 | |||
| * @{ | |||
| */ | |||
| /* AES suspension/resumption functions ***************************************/ | |||
| void HAL_CRYPEx_Read_IVRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Output); | |||
| void HAL_CRYPEx_Write_IVRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Input); | |||
| void HAL_CRYPEx_Read_SuspendRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Output); | |||
| void HAL_CRYPEx_Write_SuspendRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Input); | |||
| void HAL_CRYPEx_Read_KeyRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Output, uint32_t KeySize); | |||
| void HAL_CRYPEx_Write_KeyRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Input, uint32_t KeySize); | |||
| void HAL_CRYPEx_Read_ControlRegister(CRYP_HandleTypeDef *hcryp, uint8_t* Output); | |||
| void HAL_CRYPEx_Write_ControlRegister(CRYP_HandleTypeDef *hcryp, uint8_t* Input); | |||
| void HAL_CRYPEx_ProcessSuspend(CRYP_HandleTypeDef *hcryp); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions -----------------------------------------------------------*/ | |||
| /** @addtogroup CRYPEx_Private_Functions CRYPEx Private Functions | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef CRYP_AES_Auth_IT(CRYP_HandleTypeDef *hcryp); | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* AES */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_CRYP_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_dac.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of DAC HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -46,7 +46,7 @@ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ | |||
| defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ | |||
| defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) ||\ | |||
| defined(STM32F469xx) || defined(STM32F479xx) | |||
| defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| @@ -394,7 +394,8 @@ void HAL_DAC_DMAUnderrunCallbackCh1(DAC_HandleTypeDef *hdac); | |||
| */ | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx ||\ | |||
| STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||\ | |||
| STM32F410xx || STM32F446xx || STM32F469xx || STM32F479xx */ | |||
| STM32F410xx || STM32F446xx || STM32F469xx || STM32F479xx ||\ | |||
| STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_dac.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of DAC HAL Extension module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -46,7 +46,7 @@ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ | |||
| defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ | |||
| defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) ||\ | |||
| defined(STM32F469xx) || defined(STM32F479xx) | |||
| defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| @@ -181,7 +181,8 @@ void DAC_DMAHalfConvCpltCh2(DMA_HandleTypeDef *hdma); | |||
| */ | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx ||\ | |||
| STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||\ | |||
| STM32F410xx || STM32F446xx || STM32F469xx || STM32F479xx */ | |||
| STM32F410xx || STM32F446xx || STM32F469xx || STM32F479xx ||\ | |||
| STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| @@ -0,0 +1,537 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_dcmi.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of DCMI HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_DCMI_H | |||
| #define __STM32F4xx_HAL_DCMI_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #if defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) ||\ | |||
| defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) || defined(STM32F469xx) ||\ | |||
| defined(STM32F479xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /* Include DCMI HAL Extended module */ | |||
| /* (include on top of file since DCMI structures are defined in extended file) */ | |||
| #include "stm32f4xx_hal_dcmi_ex.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup DCMI DCMI | |||
| * @brief DCMI HAL module driver | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup DCMI_Exported_Types DCMI Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief HAL DCMI State structures definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_DCMI_STATE_RESET = 0x00U, /*!< DCMI not yet initialized or disabled */ | |||
| HAL_DCMI_STATE_READY = 0x01U, /*!< DCMI initialized and ready for use */ | |||
| HAL_DCMI_STATE_BUSY = 0x02U, /*!< DCMI internal processing is ongoing */ | |||
| HAL_DCMI_STATE_TIMEOUT = 0x03U, /*!< DCMI timeout state */ | |||
| HAL_DCMI_STATE_ERROR = 0x04U, /*!< DCMI error state */ | |||
| HAL_DCMI_STATE_SUSPENDED = 0x05U /*!< DCMI suspend state */ | |||
| }HAL_DCMI_StateTypeDef; | |||
| /** | |||
| * @brief DCMI handle Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| DCMI_TypeDef *Instance; /*!< DCMI Register base address */ | |||
| DCMI_InitTypeDef Init; /*!< DCMI parameters */ | |||
| HAL_LockTypeDef Lock; /*!< DCMI locking object */ | |||
| __IO HAL_DCMI_StateTypeDef State; /*!< DCMI state */ | |||
| __IO uint32_t XferCount; /*!< DMA transfer counter */ | |||
| __IO uint32_t XferSize; /*!< DMA transfer size */ | |||
| uint32_t XferTransferNumber; /*!< DMA transfer number */ | |||
| uint32_t pBuffPtr; /*!< Pointer to DMA output buffer */ | |||
| DMA_HandleTypeDef *DMA_Handle; /*!< Pointer to the DMA handler */ | |||
| __IO uint32_t ErrorCode; /*!< DCMI Error code */ | |||
| }DCMI_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup DCMI_Exported_Constants DCMI Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup DCMI_Error_Code DCMI Error Code | |||
| * @{ | |||
| */ | |||
| #define HAL_DCMI_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */ | |||
| #define HAL_DCMI_ERROR_OVR ((uint32_t)0x00000001U) /*!< Overrun error */ | |||
| #define HAL_DCMI_ERROR_SYNC ((uint32_t)0x00000002U) /*!< Synchronization error */ | |||
| #define HAL_DCMI_ERROR_TIMEOUT ((uint32_t)0x00000020U) /*!< Timeout error */ | |||
| #define HAL_DCMI_ERROR_DMA ((uint32_t)0x00000040U) /*!< DMA error */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DCMI_Capture_Mode DCMI Capture Mode | |||
| * @{ | |||
| */ | |||
| #define DCMI_MODE_CONTINUOUS ((uint32_t)0x00000000U) /*!< The received data are transferred continuously | |||
| into the destination memory through the DMA */ | |||
| #define DCMI_MODE_SNAPSHOT ((uint32_t)DCMI_CR_CM) /*!< Once activated, the interface waits for the start of | |||
| frame and then transfers a single frame through the DMA */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DCMI_Synchronization_Mode DCMI Synchronization Mode | |||
| * @{ | |||
| */ | |||
| #define DCMI_SYNCHRO_HARDWARE ((uint32_t)0x00000000U) /*!< Hardware synchronization data capture (frame/line start/stop) | |||
| is synchronized with the HSYNC/VSYNC signals */ | |||
| #define DCMI_SYNCHRO_EMBEDDED ((uint32_t)DCMI_CR_ESS) /*!< Embedded synchronization data capture is synchronized with | |||
| synchronization codes embedded in the data flow */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DCMI_PIXCK_Polarity DCMI PIXCK Polarity | |||
| * @{ | |||
| */ | |||
| #define DCMI_PCKPOLARITY_FALLING ((uint32_t)0x00000000U) /*!< Pixel clock active on Falling edge */ | |||
| #define DCMI_PCKPOLARITY_RISING ((uint32_t)DCMI_CR_PCKPOL) /*!< Pixel clock active on Rising edge */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DCMI_VSYNC_Polarity DCMI VSYNC Polarity | |||
| * @{ | |||
| */ | |||
| #define DCMI_VSPOLARITY_LOW ((uint32_t)0x00000000U) /*!< Vertical synchronization active Low */ | |||
| #define DCMI_VSPOLARITY_HIGH ((uint32_t)DCMI_CR_VSPOL) /*!< Vertical synchronization active High */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DCMI_HSYNC_Polarity DCMI HSYNC Polarity | |||
| * @{ | |||
| */ | |||
| #define DCMI_HSPOLARITY_LOW ((uint32_t)0x00000000U) /*!< Horizontal synchronization active Low */ | |||
| #define DCMI_HSPOLARITY_HIGH ((uint32_t)DCMI_CR_HSPOL) /*!< Horizontal synchronization active High */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DCMI_MODE_JPEG DCMI MODE JPEG | |||
| * @{ | |||
| */ | |||
| #define DCMI_JPEG_DISABLE ((uint32_t)0x00000000U) /*!< Mode JPEG Disabled */ | |||
| #define DCMI_JPEG_ENABLE ((uint32_t)DCMI_CR_JPEG) /*!< Mode JPEG Enabled */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DCMI_Capture_Rate DCMI Capture Rate | |||
| * @{ | |||
| */ | |||
| #define DCMI_CR_ALL_FRAME ((uint32_t)0x00000000U) /*!< All frames are captured */ | |||
| #define DCMI_CR_ALTERNATE_2_FRAME ((uint32_t)DCMI_CR_FCRC_0) /*!< Every alternate frame captured */ | |||
| #define DCMI_CR_ALTERNATE_4_FRAME ((uint32_t)DCMI_CR_FCRC_1) /*!< One frame in 4 frames captured */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DCMI_Extended_Data_Mode DCMI Extended Data Mode | |||
| * @{ | |||
| */ | |||
| #define DCMI_EXTEND_DATA_8B ((uint32_t)0x00000000U) /*!< Interface captures 8-bit data on every pixel clock */ | |||
| #define DCMI_EXTEND_DATA_10B ((uint32_t)DCMI_CR_EDM_0) /*!< Interface captures 10-bit data on every pixel clock */ | |||
| #define DCMI_EXTEND_DATA_12B ((uint32_t)DCMI_CR_EDM_1) /*!< Interface captures 12-bit data on every pixel clock */ | |||
| #define DCMI_EXTEND_DATA_14B ((uint32_t)(DCMI_CR_EDM_0 | DCMI_CR_EDM_1)) /*!< Interface captures 14-bit data on every pixel clock */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DCMI_Window_Coordinate DCMI Window Coordinate | |||
| * @{ | |||
| */ | |||
| #define DCMI_WINDOW_COORDINATE ((uint32_t)0x3FFFU) /*!< Window coordinate */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DCMI_Window_Height DCMI Window Height | |||
| * @{ | |||
| */ | |||
| #define DCMI_WINDOW_HEIGHT ((uint32_t)0x1FFFU) /*!< Window Height */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DCMI_Window_Vertical_Line DCMI Window Vertical Line | |||
| * @{ | |||
| */ | |||
| #define DCMI_POSITION_CWSIZE_VLINE (uint32_t)POSITION_VAL(DCMI_CWSIZE_VLINE) /*!< Required left shift to set crop window vertical line count */ | |||
| #define DCMI_POSITION_CWSTRT_VST (uint32_t)POSITION_VAL(DCMI_CWSTRT_VST) /*!< Required left shift to set crop window vertical start line count */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DCMI_interrupt_sources DCMI interrupt sources | |||
| * @{ | |||
| */ | |||
| #define DCMI_IT_FRAME ((uint32_t)DCMI_IER_FRAME_IE) /*!< Capture complete interrupt */ | |||
| #define DCMI_IT_OVR ((uint32_t)DCMI_IER_OVR_IE) /*!< Overrun interrupt */ | |||
| #define DCMI_IT_ERR ((uint32_t)DCMI_IER_ERR_IE) /*!< Synchronization error interrupt */ | |||
| #define DCMI_IT_VSYNC ((uint32_t)DCMI_IER_VSYNC_IE) /*!< VSYNC interrupt */ | |||
| #define DCMI_IT_LINE ((uint32_t)DCMI_IER_LINE_IE) /*!< Line interrupt */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DCMI_Flags DCMI Flags | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief DCMI SR register | |||
| */ | |||
| #define DCMI_FLAG_HSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_HSYNC) /*!< HSYNC pin state (active line / synchronization between lines) */ | |||
| #define DCMI_FLAG_VSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_VSYNC) /*!< VSYNC pin state (active frame / synchronization between frames) */ | |||
| #define DCMI_FLAG_FNE ((uint32_t)DCMI_SR_INDEX|DCMI_SR_FNE) /*!< FIFO not empty flag */ | |||
| /** | |||
| * @brief DCMI RIS register | |||
| */ | |||
| #define DCMI_FLAG_FRAMERI ((uint32_t)DCMI_RISR_FRAME_RIS) /*!< Frame capture complete interrupt flag */ | |||
| #define DCMI_FLAG_OVRRI ((uint32_t)DCMI_RISR_OVR_RIS) /*!< Overrun interrupt flag */ | |||
| #define DCMI_FLAG_ERRRI ((uint32_t)DCMI_RISR_ERR_RIS) /*!< Synchronization error interrupt flag */ | |||
| #define DCMI_FLAG_VSYNCRI ((uint32_t)DCMI_RISR_VSYNC_RIS) /*!< VSYNC interrupt flag */ | |||
| #define DCMI_FLAG_LINERI ((uint32_t)DCMI_RISR_LINE_RIS) /*!< Line interrupt flag */ | |||
| /** | |||
| * @brief DCMI MIS register | |||
| */ | |||
| #define DCMI_FLAG_FRAMEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_FRAME_MIS) /*!< DCMI Frame capture complete masked interrupt status */ | |||
| #define DCMI_FLAG_OVRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_OVR_MIS ) /*!< DCMI Overrun masked interrupt status */ | |||
| #define DCMI_FLAG_ERRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_ERR_MIS ) /*!< DCMI Synchronization error masked interrupt status */ | |||
| #define DCMI_FLAG_VSYNCMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_VSYNC_MIS) /*!< DCMI VSYNC masked interrupt status */ | |||
| #define DCMI_FLAG_LINEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_LINE_MIS ) /*!< DCMI Line masked interrupt status */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup DCMI_Exported_Macros DCMI Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset DCMI handle state | |||
| * @param __HANDLE__: specifies the DCMI handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DCMI_STATE_RESET) | |||
| /** | |||
| * @brief Enable the DCMI. | |||
| * @param __HANDLE__: DCMI handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DCMI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DCMI_CR_ENABLE) | |||
| /** | |||
| * @brief Disable the DCMI. | |||
| * @param __HANDLE__: DCMI handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DCMI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(DCMI_CR_ENABLE)) | |||
| /* Interrupt & Flag management */ | |||
| /** | |||
| * @brief Get the DCMI pending flag. | |||
| * @param __HANDLE__: DCMI handle | |||
| * @param __FLAG__: Get the specified flag. | |||
| * This parameter can be one of the following values (no combination allowed) | |||
| * @arg DCMI_FLAG_HSYNC: HSYNC pin state (active line / synchronization between lines) | |||
| * @arg DCMI_FLAG_VSYNC: VSYNC pin state (active frame / synchronization between frames) | |||
| * @arg DCMI_FLAG_FNE: FIFO empty flag | |||
| * @arg DCMI_FLAG_FRAMERI: Frame capture complete flag mask | |||
| * @arg DCMI_FLAG_OVRRI: Overrun flag mask | |||
| * @arg DCMI_FLAG_ERRRI: Synchronization error flag mask | |||
| * @arg DCMI_FLAG_VSYNCRI: VSYNC flag mask | |||
| * @arg DCMI_FLAG_LINERI: Line flag mask | |||
| * @arg DCMI_FLAG_FRAMEMI: DCMI Capture complete masked interrupt status | |||
| * @arg DCMI_FLAG_OVRMI: DCMI Overrun masked interrupt status | |||
| * @arg DCMI_FLAG_ERRMI: DCMI Synchronization error masked interrupt status | |||
| * @arg DCMI_FLAG_VSYNCMI: DCMI VSYNC masked interrupt status | |||
| * @arg DCMI_FLAG_LINEMI: DCMI Line masked interrupt status | |||
| * @retval The state of FLAG. | |||
| */ | |||
| #define __HAL_DCMI_GET_FLAG(__HANDLE__, __FLAG__)\ | |||
| ((((__FLAG__) & (DCMI_SR_INDEX|DCMI_MIS_INDEX)) == 0x0U)? ((__HANDLE__)->Instance->RISR & (__FLAG__)) :\ | |||
| (((__FLAG__) & DCMI_SR_INDEX) == 0x0U)? ((__HANDLE__)->Instance->MISR & (__FLAG__)) : ((__HANDLE__)->Instance->SR & (__FLAG__))) | |||
| /** | |||
| * @brief Clear the DCMI pending flags. | |||
| * @param __HANDLE__: DCMI handle | |||
| * @param __FLAG__: specifies the flag to clear. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg DCMI_FLAG_FRAMERI: Frame capture complete flag mask | |||
| * @arg DCMI_FLAG_OVRRI: Overrun flag mask | |||
| * @arg DCMI_FLAG_ERRRI: Synchronization error flag mask | |||
| * @arg DCMI_FLAG_VSYNCRI: VSYNC flag mask | |||
| * @arg DCMI_FLAG_LINERI: Line flag mask | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DCMI_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) | |||
| /** | |||
| * @brief Enable the specified DCMI interrupts. | |||
| * @param __HANDLE__: DCMI handle | |||
| * @param __INTERRUPT__: specifies the DCMI interrupt sources to be enabled. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg DCMI_IT_FRAME: Frame capture complete interrupt mask | |||
| * @arg DCMI_IT_OVR: Overrun interrupt mask | |||
| * @arg DCMI_IT_ERR: Synchronization error interrupt mask | |||
| * @arg DCMI_IT_VSYNC: VSYNC interrupt mask | |||
| * @arg DCMI_IT_LINE: Line interrupt mask | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DCMI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__)) | |||
| /** | |||
| * @brief Disable the specified DCMI interrupts. | |||
| * @param __HANDLE__: DCMI handle | |||
| * @param __INTERRUPT__: specifies the DCMI interrupt sources to be enabled. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg DCMI_IT_FRAME: Frame capture complete interrupt mask | |||
| * @arg DCMI_IT_OVR: Overrun interrupt mask | |||
| * @arg DCMI_IT_ERR: Synchronization error interrupt mask | |||
| * @arg DCMI_IT_VSYNC: VSYNC interrupt mask | |||
| * @arg DCMI_IT_LINE: Line interrupt mask | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DCMI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= ~(__INTERRUPT__)) | |||
| /** | |||
| * @brief Check whether the specified DCMI interrupt has occurred or not. | |||
| * @param __HANDLE__: DCMI handle | |||
| * @param __INTERRUPT__: specifies the DCMI interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg DCMI_IT_FRAME: Frame capture complete interrupt mask | |||
| * @arg DCMI_IT_OVR: Overrun interrupt mask | |||
| * @arg DCMI_IT_ERR: Synchronization error interrupt mask | |||
| * @arg DCMI_IT_VSYNC: VSYNC interrupt mask | |||
| * @arg DCMI_IT_LINE: Line interrupt mask | |||
| * @retval The state of INTERRUPT. | |||
| */ | |||
| #define __HAL_DCMI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MISR & (__INTERRUPT__)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup DCMI_Exported_Functions DCMI Exported Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup DCMI_Exported_Functions_Group1 Initialization and Configuration functions | |||
| * @{ | |||
| */ | |||
| /* Initialization and de-initialization functions *****************************/ | |||
| HAL_StatusTypeDef HAL_DCMI_Init(DCMI_HandleTypeDef *hdcmi); | |||
| HAL_StatusTypeDef HAL_DCMI_DeInit(DCMI_HandleTypeDef *hdcmi); | |||
| void HAL_DCMI_MspInit(DCMI_HandleTypeDef* hdcmi); | |||
| void HAL_DCMI_MspDeInit(DCMI_HandleTypeDef* hdcmi); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup DCMI_Exported_Functions_Group2 IO operation functions | |||
| * @{ | |||
| */ | |||
| /* IO operation functions *****************************************************/ | |||
| HAL_StatusTypeDef HAL_DCMI_Start_DMA(DCMI_HandleTypeDef* hdcmi, uint32_t DCMI_Mode, uint32_t pData, uint32_t Length); | |||
| HAL_StatusTypeDef HAL_DCMI_Stop(DCMI_HandleTypeDef* hdcmi); | |||
| HAL_StatusTypeDef HAL_DCMI_Suspend(DCMI_HandleTypeDef* hdcmi); | |||
| HAL_StatusTypeDef HAL_DCMI_Resume(DCMI_HandleTypeDef* hdcmi); | |||
| void HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi); | |||
| void HAL_DCMI_LineEventCallback(DCMI_HandleTypeDef *hdcmi); | |||
| void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi); | |||
| void HAL_DCMI_VsyncEventCallback(DCMI_HandleTypeDef *hdcmi); | |||
| void HAL_DCMI_VsyncCallback(DCMI_HandleTypeDef *hdcmi); | |||
| void HAL_DCMI_HsyncCallback(DCMI_HandleTypeDef *hdcmi); | |||
| void HAL_DCMI_IRQHandler(DCMI_HandleTypeDef *hdcmi); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup DCMI_Exported_Functions_Group3 Peripheral Control functions | |||
| * @{ | |||
| */ | |||
| /* Peripheral Control functions ***********************************************/ | |||
| HAL_StatusTypeDef HAL_DCMI_ConfigCrop(DCMI_HandleTypeDef *hdcmi, uint32_t X0, uint32_t Y0, uint32_t XSize, uint32_t YSize); | |||
| HAL_StatusTypeDef HAL_DCMI_EnableCrop(DCMI_HandleTypeDef *hdcmi); | |||
| HAL_StatusTypeDef HAL_DCMI_DisableCrop(DCMI_HandleTypeDef *hdcmi); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup DCMI_Exported_Functions_Group4 Peripheral State functions | |||
| * @{ | |||
| */ | |||
| /* Peripheral State functions *************************************************/ | |||
| HAL_DCMI_StateTypeDef HAL_DCMI_GetState(DCMI_HandleTypeDef *hdcmi); | |||
| uint32_t HAL_DCMI_GetError(DCMI_HandleTypeDef *hdcmi); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup DCMI_Private_Constants DCMI Private Constants | |||
| * @{ | |||
| */ | |||
| #define DCMI_MIS_INDEX ((uint32_t)0x1000) /*!< DCMI MIS register index */ | |||
| #define DCMI_SR_INDEX ((uint32_t)0x2000) /*!< DCMI SR register index */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macro -------------------------------------------------------------*/ | |||
| /** @defgroup DCMI_Private_Macros DCMI Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_DCMI_CAPTURE_MODE(MODE)(((MODE) == DCMI_MODE_CONTINUOUS) || \ | |||
| ((MODE) == DCMI_MODE_SNAPSHOT)) | |||
| #define IS_DCMI_SYNCHRO(MODE)(((MODE) == DCMI_SYNCHRO_HARDWARE) || \ | |||
| ((MODE) == DCMI_SYNCHRO_EMBEDDED)) | |||
| #define IS_DCMI_PCKPOLARITY(POLARITY)(((POLARITY) == DCMI_PCKPOLARITY_FALLING) || \ | |||
| ((POLARITY) == DCMI_PCKPOLARITY_RISING)) | |||
| #define IS_DCMI_VSPOLARITY(POLARITY)(((POLARITY) == DCMI_VSPOLARITY_LOW) || \ | |||
| ((POLARITY) == DCMI_VSPOLARITY_HIGH)) | |||
| #define IS_DCMI_HSPOLARITY(POLARITY)(((POLARITY) == DCMI_HSPOLARITY_LOW) || \ | |||
| ((POLARITY) == DCMI_HSPOLARITY_HIGH)) | |||
| #define IS_DCMI_MODE_JPEG(JPEG_MODE)(((JPEG_MODE) == DCMI_JPEG_DISABLE) || \ | |||
| ((JPEG_MODE) == DCMI_JPEG_ENABLE)) | |||
| #define IS_DCMI_CAPTURE_RATE(RATE) (((RATE) == DCMI_CR_ALL_FRAME) || \ | |||
| ((RATE) == DCMI_CR_ALTERNATE_2_FRAME) || \ | |||
| ((RATE) == DCMI_CR_ALTERNATE_4_FRAME)) | |||
| #define IS_DCMI_EXTENDED_DATA(DATA)(((DATA) == DCMI_EXTEND_DATA_8B) || \ | |||
| ((DATA) == DCMI_EXTEND_DATA_10B) || \ | |||
| ((DATA) == DCMI_EXTEND_DATA_12B) || \ | |||
| ((DATA) == DCMI_EXTEND_DATA_14B)) | |||
| #define IS_DCMI_WINDOW_COORDINATE(COORDINATE) ((COORDINATE) <= DCMI_WINDOW_COORDINATE) | |||
| #define IS_DCMI_WINDOW_HEIGHT(HEIGHT) ((HEIGHT) <= DCMI_WINDOW_HEIGHT) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @addtogroup DCMI_Private_Functions DCMI Private Functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\ | |||
| STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx ||\ | |||
| STM32F479xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_DCMI_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,230 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_dcmi_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of DCMI Extension HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_DCMI_EX_H | |||
| #define __STM32F4xx_HAL_DCMI_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #if defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) ||\ | |||
| defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) || defined(STM32F469xx) ||\ | |||
| defined(STM32F479xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup DCMIEx | |||
| * @brief DCMI HAL module driver | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup DCMIEx_Exported_Types DCMI Extended Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief DCMIEx Embedded Synchronisation CODE Init structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint8_t FrameStartCode; /*!< Specifies the code of the frame start delimiter. */ | |||
| uint8_t LineStartCode; /*!< Specifies the code of the line start delimiter. */ | |||
| uint8_t LineEndCode; /*!< Specifies the code of the line end delimiter. */ | |||
| uint8_t FrameEndCode; /*!< Specifies the code of the frame end delimiter. */ | |||
| }DCMI_CodesInitTypeDef; | |||
| /** | |||
| * @brief DCMI Init structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t SynchroMode; /*!< Specifies the Synchronization Mode: Hardware or Embedded. | |||
| This parameter can be a value of @ref DCMI_Synchronization_Mode */ | |||
| uint32_t PCKPolarity; /*!< Specifies the Pixel clock polarity: Falling or Rising. | |||
| This parameter can be a value of @ref DCMI_PIXCK_Polarity */ | |||
| uint32_t VSPolarity; /*!< Specifies the Vertical synchronization polarity: High or Low. | |||
| This parameter can be a value of @ref DCMI_VSYNC_Polarity */ | |||
| uint32_t HSPolarity; /*!< Specifies the Horizontal synchronization polarity: High or Low. | |||
| This parameter can be a value of @ref DCMI_HSYNC_Polarity */ | |||
| uint32_t CaptureRate; /*!< Specifies the frequency of frame capture: All, 1/2 or 1/4. | |||
| This parameter can be a value of @ref DCMI_Capture_Rate */ | |||
| uint32_t ExtendedDataMode; /*!< Specifies the data width: 8-bit, 10-bit, 12-bit or 14-bit. | |||
| This parameter can be a value of @ref DCMI_Extended_Data_Mode */ | |||
| DCMI_CodesInitTypeDef SyncroCode; /*!< Specifies the code of the frame start delimiter. */ | |||
| uint32_t JPEGMode; /*!< Enable or Disable the JPEG mode | |||
| This parameter can be a value of @ref DCMI_MODE_JPEG */ | |||
| #if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) | |||
| uint32_t ByteSelectMode; /*!< Specifies the data to be captured by the interface | |||
| This parameter can be a value of @ref DCMIEx_Byte_Select_Mode */ | |||
| uint32_t ByteSelectStart; /*!< Specifies if the data to be captured by the interface is even or odd | |||
| This parameter can be a value of @ref DCMIEx_Byte_Select_Start */ | |||
| uint32_t LineSelectMode; /*!< Specifies the line of data to be captured by the interface | |||
| This parameter can be a value of @ref DCMIEx_Line_Select_Mode */ | |||
| uint32_t LineSelectStart; /*!< Specifies if the line of data to be captured by the interface is even or odd | |||
| This parameter can be a value of @ref DCMIEx_Line_Select_Start */ | |||
| #endif /* STM32F446xx || STM32F469xx || STM32F479xx */ | |||
| }DCMI_InitTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| #if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) | |||
| /** @defgroup DCMIEx_Exported_Constants DCMI Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup DCMIEx_Byte_Select_Mode DCMI Byte Select Mode | |||
| * @{ | |||
| */ | |||
| #define DCMI_BSM_ALL ((uint32_t)0x00000000U) /*!< Interface captures all received data */ | |||
| #define DCMI_BSM_OTHER ((uint32_t)DCMI_CR_BSM_0) /*!< Interface captures every other byte from the received data */ | |||
| #define DCMI_BSM_ALTERNATE_4 ((uint32_t)DCMI_CR_BSM_1) /*!< Interface captures one byte out of four */ | |||
| #define DCMI_BSM_ALTERNATE_2 ((uint32_t)(DCMI_CR_BSM_0 | DCMI_CR_BSM_1)) /*!< Interface captures two bytes out of four */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DCMIEx_Byte_Select_Start DCMI Byte Select Start | |||
| * @{ | |||
| */ | |||
| #define DCMI_OEBS_ODD ((uint32_t)0x00000000U) /*!< Interface captures first data from the frame/line start, second one being dropped */ | |||
| #define DCMI_OEBS_EVEN ((uint32_t)DCMI_CR_OEBS) /*!< Interface captures second data from the frame/line start, first one being dropped */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DCMIEx_Line_Select_Mode DCMI Line Select Mode | |||
| * @{ | |||
| */ | |||
| #define DCMI_LSM_ALL ((uint32_t)0x00000000U) /*!< Interface captures all received lines */ | |||
| #define DCMI_LSM_ALTERNATE_2 ((uint32_t)DCMI_CR_LSM) /*!< Interface captures one line out of two */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DCMIEx_Line_Select_Start DCMI Line Select Start | |||
| * @{ | |||
| */ | |||
| #define DCMI_OELS_ODD ((uint32_t)0x00000000U) /*!< Interface captures first line from the frame start, second one being dropped */ | |||
| #define DCMI_OELS_EVEN ((uint32_t)DCMI_CR_OELS) /*!< Interface captures second line from the frame start, first one being dropped */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F446xx || STM32F469xx || STM32F479xx */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| #define DCMI_POSITION_ESCR_LSC (uint32_t)POSITION_VAL(DCMI_ESCR_LSC) /*!< Required left shift to set line start delimiter */ | |||
| #define DCMI_POSITION_ESCR_LEC (uint32_t)POSITION_VAL(DCMI_ESCR_LEC) /*!< Required left shift to set line end delimiter */ | |||
| #define DCMI_POSITION_ESCR_FEC (uint32_t)POSITION_VAL(DCMI_ESCR_FEC) /*!< Required left shift to set frame end delimiter */ | |||
| /* Private macro -------------------------------------------------------------*/ | |||
| #if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) | |||
| /** @defgroup DCMIEx_Private_Macros DCMI Extended Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_DCMI_BYTE_SELECT_MODE(MODE)(((MODE) == DCMI_BSM_ALL) || \ | |||
| ((MODE) == DCMI_BSM_OTHER) || \ | |||
| ((MODE) == DCMI_BSM_ALTERNATE_4) || \ | |||
| ((MODE) == DCMI_BSM_ALTERNATE_2)) | |||
| #define IS_DCMI_BYTE_SELECT_START(POLARITY)(((POLARITY) == DCMI_OEBS_ODD) || \ | |||
| ((POLARITY) == DCMI_OEBS_EVEN)) | |||
| #define IS_DCMI_LINE_SELECT_MODE(MODE)(((MODE) == DCMI_LSM_ALL) || \ | |||
| ((MODE) == DCMI_LSM_ALTERNATE_2)) | |||
| #define IS_DCMI_LINE_SELECT_START(POLARITY)(((POLARITY) == DCMI_OELS_ODD) || \ | |||
| ((POLARITY) == DCMI_OELS_EVEN)) | |||
| #endif /* STM32F446xx || STM32F469xx || STM32F479xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| #endif /* STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\ | |||
| STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx ||\ | |||
| STM32F479xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_DCMI_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_def.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief This file contains HAL common defines, enumeration, macros and | |||
| * structures definitions. | |||
| ****************************************************************************** | |||
| @@ -0,0 +1,894 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_dfsdm.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of DFSDM HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_DFSDM_H | |||
| #define __STM32F4xx_HAL_DFSDM_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup DFSDM | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup DFSDM_Exported_Types DFSDM Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief HAL DFSDM Channel states definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_DFSDM_CHANNEL_STATE_RESET = 0x00U, /*!< DFSDM channel not initialized */ | |||
| HAL_DFSDM_CHANNEL_STATE_READY = 0x01U, /*!< DFSDM channel initialized and ready for use */ | |||
| HAL_DFSDM_CHANNEL_STATE_ERROR = 0xFFU /*!< DFSDM channel state error */ | |||
| }HAL_DFSDM_Channel_StateTypeDef; | |||
| /** | |||
| * @brief DFSDM channel output clock structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| FunctionalState Activation; /*!< Output clock enable/disable */ | |||
| uint32_t Selection; /*!< Output clock is system clock or audio clock. | |||
| This parameter can be a value of @ref DFSDM_Channel_OuputClock */ | |||
| uint32_t Divider; /*!< Output clock divider. | |||
| This parameter must be a number between Min_Data = 2 and Max_Data = 256 */ | |||
| }DFSDM_Channel_OutputClockTypeDef; | |||
| /** | |||
| * @brief DFSDM channel input structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t Multiplexer; /*!< Input is external serial inputs or internal register. | |||
| This parameter can be a value of @ref DFSDM_Channel_InputMultiplexer */ | |||
| uint32_t DataPacking; /*!< Standard, interleaved or dual mode for internal register. | |||
| This parameter can be a value of @ref DFSDM_Channel_DataPacking */ | |||
| uint32_t Pins; /*!< Input pins are taken from same or following channel. | |||
| This parameter can be a value of @ref DFSDM_Channel_InputPins */ | |||
| }DFSDM_Channel_InputTypeDef; | |||
| /** | |||
| * @brief DFSDM channel serial interface structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t Type; /*!< SPI or Manchester modes. | |||
| This parameter can be a value of @ref DFSDM_Channel_SerialInterfaceType */ | |||
| uint32_t SpiClock; /*!< SPI clock select (external or internal with different sampling point). | |||
| This parameter can be a value of @ref DFSDM_Channel_SpiClock */ | |||
| }DFSDM_Channel_SerialInterfaceTypeDef; | |||
| /** | |||
| * @brief DFSDM channel analog watchdog structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t FilterOrder; /*!< Analog watchdog Sinc filter order. | |||
| This parameter can be a value of @ref DFSDM_Channel_AwdFilterOrder */ | |||
| uint32_t Oversampling; /*!< Analog watchdog filter oversampling ratio. | |||
| This parameter must be a number between Min_Data = 1 and Max_Data = 32 */ | |||
| }DFSDM_Channel_AwdTypeDef; | |||
| /** | |||
| * @brief DFSDM channel init structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| DFSDM_Channel_OutputClockTypeDef OutputClock; /*!< DFSDM channel output clock parameters */ | |||
| DFSDM_Channel_InputTypeDef Input; /*!< DFSDM channel input parameters */ | |||
| DFSDM_Channel_SerialInterfaceTypeDef SerialInterface; /*!< DFSDM channel serial interface parameters */ | |||
| DFSDM_Channel_AwdTypeDef Awd; /*!< DFSDM channel analog watchdog parameters */ | |||
| int32_t Offset; /*!< DFSDM channel offset. | |||
| This parameter must be a number between Min_Data = -8388608 and Max_Data = 8388607 */ | |||
| uint32_t RightBitShift; /*!< DFSDM channel right bit shift. | |||
| This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1F */ | |||
| }DFSDM_Channel_InitTypeDef; | |||
| /** | |||
| * @brief DFSDM channel handle structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| DFSDM_Channel_TypeDef *Instance; /*!< DFSDM channel instance */ | |||
| DFSDM_Channel_InitTypeDef Init; /*!< DFSDM channel init parameters */ | |||
| HAL_DFSDM_Channel_StateTypeDef State; /*!< DFSDM channel state */ | |||
| }DFSDM_Channel_HandleTypeDef; | |||
| /** | |||
| * @brief HAL DFSDM Filter states definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_DFSDM_FILTER_STATE_RESET = 0x00U, /*!< DFSDM filter not initialized */ | |||
| HAL_DFSDM_FILTER_STATE_READY = 0x01U, /*!< DFSDM filter initialized and ready for use */ | |||
| HAL_DFSDM_FILTER_STATE_REG = 0x02U, /*!< DFSDM filter regular conversion in progress */ | |||
| HAL_DFSDM_FILTER_STATE_INJ = 0x03U, /*!< DFSDM filter injected conversion in progress */ | |||
| HAL_DFSDM_FILTER_STATE_REG_INJ = 0x04U, /*!< DFSDM filter regular and injected conversions in progress */ | |||
| HAL_DFSDM_FILTER_STATE_ERROR = 0xFFU /*!< DFSDM filter state error */ | |||
| }HAL_DFSDM_Filter_StateTypeDef; | |||
| /** | |||
| * @brief DFSDM filter regular conversion parameters structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t Trigger; /*!< Trigger used to start regular conversion: software or synchronous. | |||
| This parameter can be a value of @ref DFSDM_Filter_Trigger */ | |||
| FunctionalState FastMode; /*!< Enable/disable fast mode for regular conversion */ | |||
| FunctionalState DmaMode; /*!< Enable/disable DMA for regular conversion */ | |||
| }DFSDM_Filter_RegularParamTypeDef; | |||
| /** | |||
| * @brief DFSDM filter injected conversion parameters structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t Trigger; /*!< Trigger used to start injected conversion: software, external or synchronous. | |||
| This parameter can be a value of @ref DFSDM_Filter_Trigger */ | |||
| FunctionalState ScanMode; /*!< Enable/disable scanning mode for injected conversion */ | |||
| FunctionalState DmaMode; /*!< Enable/disable DMA for injected conversion */ | |||
| uint32_t ExtTrigger; /*!< External trigger. | |||
| This parameter can be a value of @ref DFSDM_Filter_ExtTrigger */ | |||
| uint32_t ExtTriggerEdge; /*!< External trigger edge: rising, falling or both. | |||
| This parameter can be a value of @ref DFSDM_Filter_ExtTriggerEdge */ | |||
| }DFSDM_Filter_InjectedParamTypeDef; | |||
| /** | |||
| * @brief DFSDM filter parameters structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t SincOrder; /*!< Sinc filter order. | |||
| This parameter can be a value of @ref DFSDM_Filter_SincOrder */ | |||
| uint32_t Oversampling; /*!< Filter oversampling ratio. | |||
| This parameter must be a number between Min_Data = 1 and Max_Data = 1024 */ | |||
| uint32_t IntOversampling; /*!< Integrator oversampling ratio. | |||
| This parameter must be a number between Min_Data = 1 and Max_Data = 256 */ | |||
| }DFSDM_Filter_FilterParamTypeDef; | |||
| /** | |||
| * @brief DFSDM filter init structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| DFSDM_Filter_RegularParamTypeDef RegularParam; /*!< DFSDM regular conversion parameters */ | |||
| DFSDM_Filter_InjectedParamTypeDef InjectedParam; /*!< DFSDM injected conversion parameters */ | |||
| DFSDM_Filter_FilterParamTypeDef FilterParam; /*!< DFSDM filter parameters */ | |||
| }DFSDM_Filter_InitTypeDef; | |||
| /** | |||
| * @brief DFSDM filter handle structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| DFSDM_Filter_TypeDef *Instance; /*!< DFSDM filter instance */ | |||
| DFSDM_Filter_InitTypeDef Init; /*!< DFSDM filter init parameters */ | |||
| DMA_HandleTypeDef *hdmaReg; /*!< Pointer on DMA handler for regular conversions */ | |||
| DMA_HandleTypeDef *hdmaInj; /*!< Pointer on DMA handler for injected conversions */ | |||
| uint32_t RegularContMode; /*!< Regular conversion continuous mode */ | |||
| uint32_t RegularTrigger; /*!< Trigger used for regular conversion */ | |||
| uint32_t InjectedTrigger; /*!< Trigger used for injected conversion */ | |||
| uint32_t ExtTriggerEdge; /*!< Rising, falling or both edges selected */ | |||
| FunctionalState InjectedScanMode; /*!< Injected scanning mode */ | |||
| uint32_t InjectedChannelsNbr; /*!< Number of channels in injected sequence */ | |||
| uint32_t InjConvRemaining; /*!< Injected conversions remaining */ | |||
| HAL_DFSDM_Filter_StateTypeDef State; /*!< DFSDM filter state */ | |||
| uint32_t ErrorCode; /*!< DFSDM filter error code */ | |||
| }DFSDM_Filter_HandleTypeDef; | |||
| /** | |||
| * @brief DFSDM filter analog watchdog parameters structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t DataSource; /*!< Values from digital filter or from channel watchdog filter. | |||
| This parameter can be a value of @ref DFSDM_Filter_AwdDataSource */ | |||
| uint32_t Channel; /*!< Analog watchdog channel selection. | |||
| This parameter can be a values combination of @ref DFSDM_Channel_Selection */ | |||
| int32_t HighThreshold; /*!< High threshold for the analog watchdog. | |||
| This parameter must be a number between Min_Data = -8388608 and Max_Data = 8388607 */ | |||
| int32_t LowThreshold; /*!< Low threshold for the analog watchdog. | |||
| This parameter must be a number between Min_Data = -8388608 and Max_Data = 8388607 */ | |||
| uint32_t HighBreakSignal; /*!< Break signal assigned to analog watchdog high threshold event. | |||
| This parameter can be a values combination of @ref DFSDM_BreakSignals */ | |||
| uint32_t LowBreakSignal; /*!< Break signal assigned to analog watchdog low threshold event. | |||
| This parameter can be a values combination of @ref DFSDM_BreakSignals */ | |||
| }DFSDM_Filter_AwdParamTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* End of exported types -----------------------------------------------------*/ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup DFSDM_Exported_Constants DFSDM Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup DFSDM_Channel_OuputClock DFSDM channel output clock selection | |||
| * @{ | |||
| */ | |||
| #define DFSDM_CHANNEL_OUTPUT_CLOCK_SYSTEM ((uint32_t)0x00000000U) /*!< Source for ouput clock is system clock */ | |||
| #define DFSDM_CHANNEL_OUTPUT_CLOCK_AUDIO DFSDM_CHCFGR1_CKOUTSRC /*!< Source for ouput clock is audio clock */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_Channel_InputMultiplexer DFSDM channel input multiplexer | |||
| * @{ | |||
| */ | |||
| #define DFSDM_CHANNEL_EXTERNAL_INPUTS ((uint32_t)0x00000000U) /*!< Data are taken from external inputs */ | |||
| #define DFSDM_CHANNEL_INTERNAL_REGISTER DFSDM_CHCFGR1_DATMPX_1 /*!< Data are taken from internal register */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_Channel_DataPacking DFSDM channel input data packing | |||
| * @{ | |||
| */ | |||
| #define DFSDM_CHANNEL_STANDARD_MODE ((uint32_t)0x00000000U) /*!< Standard data packing mode */ | |||
| #define DFSDM_CHANNEL_INTERLEAVED_MODE DFSDM_CHCFGR1_DATPACK_0 /*!< Interleaved data packing mode */ | |||
| #define DFSDM_CHANNEL_DUAL_MODE DFSDM_CHCFGR1_DATPACK_1 /*!< Dual data packing mode */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_Channel_InputPins DFSDM channel input pins | |||
| * @{ | |||
| */ | |||
| #define DFSDM_CHANNEL_SAME_CHANNEL_PINS ((uint32_t)0x00000000U) /*!< Input from pins on same channel */ | |||
| #define DFSDM_CHANNEL_FOLLOWING_CHANNEL_PINS DFSDM_CHCFGR1_CHINSEL /*!< Input from pins on following channel */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_Channel_SerialInterfaceType DFSDM channel serial interface type | |||
| * @{ | |||
| */ | |||
| #define DFSDM_CHANNEL_SPI_RISING ((uint32_t)0x00000000U) /*!< SPI with rising edge */ | |||
| #define DFSDM_CHANNEL_SPI_FALLING DFSDM_CHCFGR1_SITP_0 /*!< SPI with falling edge */ | |||
| #define DFSDM_CHANNEL_MANCHESTER_RISING DFSDM_CHCFGR1_SITP_1 /*!< Manchester with rising edge */ | |||
| #define DFSDM_CHANNEL_MANCHESTER_FALLING DFSDM_CHCFGR1_SITP /*!< Manchester with falling edge */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_Channel_SpiClock DFSDM channel SPI clock selection | |||
| * @{ | |||
| */ | |||
| #define DFSDM_CHANNEL_SPI_CLOCK_EXTERNAL ((uint32_t)0x00000000U) /*!< External SPI clock */ | |||
| #define DFSDM_CHANNEL_SPI_CLOCK_INTERNAL DFSDM_CHCFGR1_SPICKSEL_0 /*!< Internal SPI clock */ | |||
| #define DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_FALLING DFSDM_CHCFGR1_SPICKSEL_1 /*!< Internal SPI clock divided by 2, falling edge */ | |||
| #define DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_RISING DFSDM_CHCFGR1_SPICKSEL /*!< Internal SPI clock divided by 2, rising edge */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_Channel_AwdFilterOrder DFSDM channel analog watchdog filter order | |||
| * @{ | |||
| */ | |||
| #define DFSDM_CHANNEL_FASTSINC_ORDER ((uint32_t)0x00000000U) /*!< FastSinc filter type */ | |||
| #define DFSDM_CHANNEL_SINC1_ORDER DFSDM_CHAWSCDR_AWFORD_0 /*!< Sinc 1 filter type */ | |||
| #define DFSDM_CHANNEL_SINC2_ORDER DFSDM_CHAWSCDR_AWFORD_1 /*!< Sinc 2 filter type */ | |||
| #define DFSDM_CHANNEL_SINC3_ORDER DFSDM_CHAWSCDR_AWFORD /*!< Sinc 3 filter type */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_Filter_Trigger DFSDM filter conversion trigger | |||
| * @{ | |||
| */ | |||
| #define DFSDM_FILTER_SW_TRIGGER ((uint32_t)0x00000000U) /*!< Software trigger */ | |||
| #define DFSDM_FILTER_SYNC_TRIGGER ((uint32_t)0x00000001U) /*!< Synchronous with DFSDM_FLT0 */ | |||
| #define DFSDM_FILTER_EXT_TRIGGER ((uint32_t)0x00000002U) /*!< External trigger (only for injected conversion) */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_Filter_ExtTrigger DFSDM filter external trigger | |||
| * @{ | |||
| */ | |||
| #if defined(STM32F413xx) || defined(STM32F423xx) | |||
| /* Trigger for stm32f413xx and STM32f423xx devices */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM1_TRGO (0x00000000U) /*!< For All DFSDM1/2 filters */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM3_TRGO DFSDM_FLTCR1_JEXTSEL_0 /*!< For All DFSDM1/2 filters */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM8_TRGO DFSDM_FLTCR1_JEXTSEL_1 /*!< For All DFSDM1/2 filters */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM10_OC1 (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM1 filter 0 and 1 and DFSDM2 filter 0, 1 and 2 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM2_TRGO (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM2 filter 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM4_TRGO DFSDM_FLTCR1_JEXTSEL_2 /*!< For DFSDM1 filter 0 and 1 and DFSDM2 filter 0, 1 and 2 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM11_OC1 DFSDM_FLTCR1_JEXTSEL_2 /*!< For DFSDM2 filter 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM6_TRGO (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM1 filter 0 and 1 and DFSDM2 filter 0 and 1 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM7_TRGO (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM2 filter 2 and 3*/ | |||
| #define DFSDM_FILTER_EXT_TRIG_EXTI11 (DFSDM_FLTCR1_JEXTSEL_1 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For All DFSDM1/2 filters */ | |||
| #define DFSDM_FILTER_EXT_TRIG_EXTI15 DFSDM_FLTCR1_JEXTSEL /*!< For All DFSDM1/2 filters */ | |||
| #else | |||
| /* Trigger for stm32f412xx devices */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM1_TRGO ((uint32_t)0x00000000U) /*!< For DFSDM1 filter 0 and 1*/ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM3_TRGO DFSDM_FLTCR1_JEXTSEL_0 /*!< For DFSDM1 filter 0 and 1*/ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM8_TRGO DFSDM_FLTCR1_JEXTSEL_1 /*!< For DFSDM1 filter 0 and 1*/ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM10_OC1 (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM1 filter 0 and 1*/ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM4_TRGO DFSDM_FLTCR1_JEXTSEL_2 /*!< For DFSDM1 filter 0 and 1*/ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM6_TRGO (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM1 filter 0 and 1*/ | |||
| #define DFSDM_FILTER_EXT_TRIG_EXTI11 (DFSDM_FLTCR1_JEXTSEL_1 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM1 filter 0 and 1*/ | |||
| #define DFSDM_FILTER_EXT_TRIG_EXTI15 DFSDM_FLTCR1_JEXTSEL /*!< For DFSDM1 filter 0 and 1*/ | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_Filter_ExtTriggerEdge DFSDM filter external trigger edge | |||
| * @{ | |||
| */ | |||
| #define DFSDM_FILTER_EXT_TRIG_RISING_EDGE DFSDM_FLTCR1_JEXTEN_0 /*!< External rising edge */ | |||
| #define DFSDM_FILTER_EXT_TRIG_FALLING_EDGE DFSDM_FLTCR1_JEXTEN_1 /*!< External falling edge */ | |||
| #define DFSDM_FILTER_EXT_TRIG_BOTH_EDGES DFSDM_FLTCR1_JEXTEN /*!< External rising and falling edges */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_Filter_SincOrder DFSDM filter sinc order | |||
| * @{ | |||
| */ | |||
| #define DFSDM_FILTER_FASTSINC_ORDER ((uint32_t)0x00000000U) /*!< FastSinc filter type */ | |||
| #define DFSDM_FILTER_SINC1_ORDER DFSDM_FLTFCR_FORD_0 /*!< Sinc 1 filter type */ | |||
| #define DFSDM_FILTER_SINC2_ORDER DFSDM_FLTFCR_FORD_1 /*!< Sinc 2 filter type */ | |||
| #define DFSDM_FILTER_SINC3_ORDER (DFSDM_FLTFCR_FORD_0 | DFSDM_FLTFCR_FORD_1) /*!< Sinc 3 filter type */ | |||
| #define DFSDM_FILTER_SINC4_ORDER DFSDM_FLTFCR_FORD_2 /*!< Sinc 4 filter type */ | |||
| #define DFSDM_FILTER_SINC5_ORDER (DFSDM_FLTFCR_FORD_0 | DFSDM_FLTFCR_FORD_2) /*!< Sinc 5 filter type */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_Filter_AwdDataSource DFSDM filter analog watchdog data source | |||
| * @{ | |||
| */ | |||
| #define DFSDM_FILTER_AWD_FILTER_DATA ((uint32_t)0x00000000U) /*!< From digital filter */ | |||
| #define DFSDM_FILTER_AWD_CHANNEL_DATA DFSDM_FLTCR1_AWFSEL /*!< From analog watchdog channel */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_Filter_ErrorCode DFSDM filter error code | |||
| * @{ | |||
| */ | |||
| #define DFSDM_FILTER_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */ | |||
| #define DFSDM_FILTER_ERROR_REGULAR_OVERRUN ((uint32_t)0x00000001U) /*!< Overrun occurs during regular conversion */ | |||
| #define DFSDM_FILTER_ERROR_INJECTED_OVERRUN ((uint32_t)0x00000002U) /*!< Overrun occurs during injected conversion */ | |||
| #define DFSDM_FILTER_ERROR_DMA ((uint32_t)0x00000003U) /*!< DMA error occurs */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_BreakSignals DFSDM break signals | |||
| * @{ | |||
| */ | |||
| #define DFSDM_NO_BREAK_SIGNAL ((uint32_t)0x00000000U) /*!< No break signal */ | |||
| #define DFSDM_BREAK_SIGNAL_0 ((uint32_t)0x00000001U) /*!< Break signal 0 */ | |||
| #define DFSDM_BREAK_SIGNAL_1 ((uint32_t)0x00000002U) /*!< Break signal 1 */ | |||
| #define DFSDM_BREAK_SIGNAL_2 ((uint32_t)0x00000004U) /*!< Break signal 2 */ | |||
| #define DFSDM_BREAK_SIGNAL_3 ((uint32_t)0x00000008U) /*!< Break signal 3 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_Channel_Selection DFSDM Channel Selection | |||
| * @{ | |||
| */ | |||
| /* DFSDM Channels ------------------------------------------------------------*/ | |||
| /* The DFSDM channels are defined as follows: | |||
| - in 16-bit LSB the channel mask is set | |||
| - in 16-bit MSB the channel number is set | |||
| e.g. for channel 3 definition: | |||
| - the channel mask is 0x00000008U (bit 3 is set) | |||
| - the channel number 3 is 0x00030000 | |||
| --> Consequently, channel 3 definition is 0x00000008U | 0x00030000 = 0x00030008 */ | |||
| #define DFSDM_CHANNEL_0 ((uint32_t)0x00000001U) | |||
| #define DFSDM_CHANNEL_1 ((uint32_t)0x00010002U) | |||
| #define DFSDM_CHANNEL_2 ((uint32_t)0x00020004U) | |||
| #define DFSDM_CHANNEL_3 ((uint32_t)0x00030008U) | |||
| #define DFSDM_CHANNEL_4 ((uint32_t)0x00040010U) /* only for stmm32f413xx and stm32f423xx devices */ | |||
| #define DFSDM_CHANNEL_5 ((uint32_t)0x00050020U) /* only for stmm32f413xx and stm32f423xx devices */ | |||
| #define DFSDM_CHANNEL_6 ((uint32_t)0x00060040U) /* only for stmm32f413xx and stm32f423xx devices */ | |||
| #define DFSDM_CHANNEL_7 ((uint32_t)0x00070080U) /* only for stmm32f413xx and stm32f423xx devices */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_ContinuousMode DFSDM Continuous Mode | |||
| * @{ | |||
| */ | |||
| #define DFSDM_CONTINUOUS_CONV_OFF ((uint32_t)0x00000000U) /*!< Conversion are not continuous */ | |||
| #define DFSDM_CONTINUOUS_CONV_ON ((uint32_t)0x00000001U) /*!< Conversion are continuous */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_AwdThreshold DFSDM analog watchdog threshold | |||
| * @{ | |||
| */ | |||
| #define DFSDM_AWD_HIGH_THRESHOLD ((uint32_t)0x00000000U) /*!< Analog watchdog high threshold */ | |||
| #define DFSDM_AWD_LOW_THRESHOLD ((uint32_t)0x00000001U) /*!< Analog watchdog low threshold */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #if defined(STM32F413xx) || defined(STM32F423xx) | |||
| /** @defgroup HAL_MCHDLY_CLOCK HAL MCHDLY Clock enable | |||
| * @{ | |||
| */ | |||
| #define HAL_MCHDLY_CLOCK_DFSDM2 SYSCFG_MCHDLYCR_MCHDLY2EN | |||
| #define HAL_MCHDLY_CLOCK_DFSDM1 SYSCFG_MCHDLYCR_MCHDLY1EN | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_DFSDM_CLOCKIN_SOURCE HAL DFSDM Clock In Source Selection | |||
| * @{ | |||
| */ | |||
| #define HAL_DFSDM2_CKIN_PAD 0x00040000U | |||
| #define HAL_DFSDM2_CKIN_DM SYSCFG_MCHDLYCR_DFSDM2CFG | |||
| #define HAL_DFSDM1_CKIN_PAD 0x00000000U | |||
| #define HAL_DFSDM1_CKIN_DM SYSCFG_MCHDLYCR_DFSDM1CFG | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_DFSDM_CLOCKOUT_SOURCE HAL DFSDM Clock Source Selection | |||
| * @{ | |||
| */ | |||
| #define HAL_DFSDM2_CKOUT_DFSDM2 0x10000000U | |||
| #define HAL_DFSDM2_CKOUT_M27 SYSCFG_MCHDLYCR_DFSDM2CKOSEL | |||
| #define HAL_DFSDM1_CKOUT_DFSDM1 0x00000000U | |||
| #define HAL_DFSDM1_CKOUT_M27 SYSCFG_MCHDLYCR_DFSDM1CKOSEL | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_DFSDM_DATAIN0_SOURCE HAL DFSDM Source Selection For DATAIN0 | |||
| * @{ | |||
| */ | |||
| #define HAL_DATAIN0_DFSDM2_PAD 0x10000000U | |||
| #define HAL_DATAIN0_DFSDM2_DATAIN1 SYSCFG_MCHDLYCR_DFSDM2D0SEL | |||
| #define HAL_DATAIN0_DFSDM1_PAD 0x00000000U | |||
| #define HAL_DATAIN0_DFSDM1_DATAIN1 SYSCFG_MCHDLYCR_DFSDM1D0SEL | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_DFSDM_DATAIN2_SOURCE HAL DFSDM Source Selection For DATAIN2 | |||
| * @{ | |||
| */ | |||
| #define HAL_DATAIN2_DFSDM2_PAD 0x10000000U | |||
| #define HAL_DATAIN2_DFSDM2_DATAIN3 SYSCFG_MCHDLYCR_DFSDM2D2SEL | |||
| #define HAL_DATAIN2_DFSDM1_PAD 0x00000000U | |||
| #define HAL_DATAIN2_DFSDM1_DATAIN3 SYSCFG_MCHDLYCR_DFSDM1D2SEL | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_DFSDM_DATAIN4_SOURCE HAL DFSDM Source Selection For DATAIN4 | |||
| * @{ | |||
| */ | |||
| #define HAL_DATAIN4_DFSDM2_PAD 0x00000000U | |||
| #define HAL_DATAIN4_DFSDM2_DATAIN5 SYSCFG_MCHDLYCR_DFSDM2D4SEL | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_DFSDM_DATAIN6_SOURCE HAL DFSDM Source Selection For DATAIN6 | |||
| * @{ | |||
| */ | |||
| #define HAL_DATAIN6_DFSDM2_PAD 0x00000000U | |||
| #define HAL_DATAIN6_DFSDM2_DATAIN7 SYSCFG_MCHDLYCR_DFSDM2D6SEL | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_DFSDM1_CLKIN_SOURCE HAL DFSDM1 Source Selection For CLKIN | |||
| * @{ | |||
| */ | |||
| #define HAL_DFSDM1_CLKIN0_TIM4OC2 0x01000000U | |||
| #define HAL_DFSDM1_CLKIN2_TIM4OC2 SYSCFG_MCHDLYCR_DFSDM1CK02SEL | |||
| #define HAL_DFSDM1_CLKIN1_TIM4OC1 0x02000000U | |||
| #define HAL_DFSDM1_CLKIN3_TIM4OC1 SYSCFG_MCHDLYCR_DFSDM1CK13SEL | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_DFSDM2_CLKIN_SOURCE HAL DFSDM2 Source Selection For CLKIN | |||
| * @{ | |||
| */ | |||
| #define HAL_DFSDM2_CLKIN0_TIM3OC4 0x04000000U | |||
| #define HAL_DFSDM2_CLKIN4_TIM3OC4 SYSCFG_MCHDLYCR_DFSDM2CK04SEL | |||
| #define HAL_DFSDM2_CLKIN1_TIM3OC3 0x08000000U | |||
| #define HAL_DFSDM2_CLKIN5_TIM3OC3 SYSCFG_MCHDLYCR_DFSDM2CK15SEL | |||
| #define HAL_DFSDM2_CLKIN2_TIM3OC2 0x10000000U | |||
| #define HAL_DFSDM2_CLKIN6_TIM3OC2 SYSCFG_MCHDLYCR_DFSDM2CK26SEL | |||
| #define HAL_DFSDM2_CLKIN3_TIM3OC1 0x00000000U | |||
| #define HAL_DFSDM2_CLKIN7_TIM3OC1 SYSCFG_MCHDLYCR_DFSDM2CK37SEL | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* End of exported constants -------------------------------------------------*/ | |||
| /* Exported macros -----------------------------------------------------------*/ | |||
| /** @defgroup DFSDM_Exported_Macros DFSDM Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset DFSDM channel handle state. | |||
| * @param __HANDLE__: DFSDM channel handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DFSDM_CHANNEL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DFSDM_CHANNEL_STATE_RESET) | |||
| /** @brief Reset DFSDM filter handle state. | |||
| * @param __HANDLE__: DFSDM filter handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DFSDM_FILTER_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DFSDM_FILTER_STATE_RESET) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* End of exported macros ----------------------------------------------------*/ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup DFSDM_Exported_Functions DFSDM Exported Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup DFSDM_Exported_Functions_Group1_Channel Channel initialization and de-initialization functions | |||
| * @{ | |||
| */ | |||
| /* Channel initialization and de-initialization functions *********************/ | |||
| HAL_StatusTypeDef HAL_DFSDM_ChannelInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel); | |||
| HAL_StatusTypeDef HAL_DFSDM_ChannelDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel); | |||
| void HAL_DFSDM_ChannelMspInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel); | |||
| void HAL_DFSDM_ChannelMspDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup DFSDM_Exported_Functions_Group2_Channel Channel operation functions | |||
| * @{ | |||
| */ | |||
| /* Channel operation functions ************************************************/ | |||
| HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStart(DFSDM_Channel_HandleTypeDef *hdfsdm_channel); | |||
| HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStart_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel); | |||
| HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStop(DFSDM_Channel_HandleTypeDef *hdfsdm_channel); | |||
| HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStop_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel); | |||
| HAL_StatusTypeDef HAL_DFSDM_ChannelScdStart(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Threshold, uint32_t BreakSignal); | |||
| HAL_StatusTypeDef HAL_DFSDM_ChannelScdStart_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Threshold, uint32_t BreakSignal); | |||
| HAL_StatusTypeDef HAL_DFSDM_ChannelScdStop(DFSDM_Channel_HandleTypeDef *hdfsdm_channel); | |||
| HAL_StatusTypeDef HAL_DFSDM_ChannelScdStop_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel); | |||
| int16_t HAL_DFSDM_ChannelGetAwdValue(DFSDM_Channel_HandleTypeDef *hdfsdm_channel); | |||
| HAL_StatusTypeDef HAL_DFSDM_ChannelModifyOffset(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, int32_t Offset); | |||
| HAL_StatusTypeDef HAL_DFSDM_ChannelPollForCkab(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_DFSDM_ChannelPollForScd(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Timeout); | |||
| void HAL_DFSDM_ChannelCkabCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel); | |||
| void HAL_DFSDM_ChannelScdCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_Exported_Functions_Group3_Channel Channel state function | |||
| * @{ | |||
| */ | |||
| /* Channel state function *****************************************************/ | |||
| HAL_DFSDM_Channel_StateTypeDef HAL_DFSDM_ChannelGetState(DFSDM_Channel_HandleTypeDef *hdfsdm_channel); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup DFSDM_Exported_Functions_Group1_Filter Filter initialization and de-initialization functions | |||
| * @{ | |||
| */ | |||
| /* Filter initialization and de-initialization functions *********************/ | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterDeInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| void HAL_DFSDM_FilterMspInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| void HAL_DFSDM_FilterMspDeInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup DFSDM_Exported_Functions_Group2_Filter Filter control functions | |||
| * @{ | |||
| */ | |||
| /* Filter control functions *********************/ | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterConfigRegChannel(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, | |||
| uint32_t Channel, | |||
| uint32_t ContinuousMode); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterConfigInjChannel(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, | |||
| uint32_t Channel); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup DFSDM_Exported_Functions_Group3_Filter Filter operation functions | |||
| * @{ | |||
| */ | |||
| /* Filter operation functions *********************/ | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int32_t *pData, uint32_t Length); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterRegularMsbStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int16_t *pData, uint32_t Length); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int32_t *pData, uint32_t Length); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterInjectedMsbStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int16_t *pData, uint32_t Length); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterAwdStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, | |||
| DFSDM_Filter_AwdParamTypeDef* awdParam); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterAwdStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterExdStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterExdStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| int32_t HAL_DFSDM_FilterGetRegularValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t* Channel); | |||
| int32_t HAL_DFSDM_FilterGetInjectedValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t* Channel); | |||
| int32_t HAL_DFSDM_FilterGetExdMaxValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t* Channel); | |||
| int32_t HAL_DFSDM_FilterGetExdMinValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t* Channel); | |||
| uint32_t HAL_DFSDM_FilterGetConvTimeValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| void HAL_DFSDM_IRQHandler(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterPollForRegConversion(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_DFSDM_FilterPollForInjConversion(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Timeout); | |||
| void HAL_DFSDM_FilterRegConvCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| void HAL_DFSDM_FilterRegConvHalfCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| void HAL_DFSDM_FilterInjConvCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| void HAL_DFSDM_FilterInjConvHalfCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| void HAL_DFSDM_FilterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel, uint32_t Threshold); | |||
| void HAL_DFSDM_FilterErrorCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_Exported_Functions_Group4_Filter Filter state functions | |||
| * @{ | |||
| */ | |||
| /* Filter state functions *****************************************************/ | |||
| HAL_DFSDM_Filter_StateTypeDef HAL_DFSDM_FilterGetState(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| uint32_t HAL_DFSDM_FilterGetError(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DFSDM_Exported_Functions_Group5_Filter MultiChannel operation functions | |||
| * @{ | |||
| */ | |||
| #if defined(SYSCFG_MCHDLYCR_BSCKSEL) | |||
| void HAL_DFSDM_BitstreamClock_Start(void); | |||
| void HAL_DFSDM_BitstreamClock_Stop(void); | |||
| void HAL_DFSDM_DisableDelayClock(uint32_t MCHDLY); | |||
| void HAL_DFSDM_EnableDelayClock(uint32_t MCHDLY); | |||
| void HAL_DFSDM_ClockIn_SourceSelection(uint32_t source); | |||
| void HAL_DFSDM_ClockOut_SourceSelection(uint32_t source); | |||
| void HAL_DFSDM_DataIn0_SourceSelection(uint32_t source); | |||
| void HAL_DFSDM_DataIn2_SourceSelection(uint32_t source); | |||
| void HAL_DFSDM_DataIn4_SourceSelection(uint32_t source); | |||
| void HAL_DFSDM_DataIn6_SourceSelection(uint32_t source); | |||
| void HAL_DFSDM_BitStreamClkDistribution_Config(uint32_t source); | |||
| #endif /* SYSCFG_MCHDLYCR_BSCKSEL */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* End of exported functions -------------------------------------------------*/ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup DFSDM_Private_Macros DFSDM Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_DFSDM_CHANNEL_OUTPUT_CLOCK(CLOCK) (((CLOCK) == DFSDM_CHANNEL_OUTPUT_CLOCK_SYSTEM) || \ | |||
| ((CLOCK) == DFSDM_CHANNEL_OUTPUT_CLOCK_AUDIO)) | |||
| #define IS_DFSDM_CHANNEL_OUTPUT_CLOCK_DIVIDER(DIVIDER) ((2U <= (DIVIDER)) && ((DIVIDER) <= 256U)) | |||
| #define IS_DFSDM_CHANNEL_INPUT(INPUT) (((INPUT) == DFSDM_CHANNEL_EXTERNAL_INPUTS) || \ | |||
| ((INPUT) == DFSDM_CHANNEL_INTERNAL_REGISTER)) | |||
| #define IS_DFSDM_CHANNEL_DATA_PACKING(MODE) (((MODE) == DFSDM_CHANNEL_STANDARD_MODE) || \ | |||
| ((MODE) == DFSDM_CHANNEL_INTERLEAVED_MODE) || \ | |||
| ((MODE) == DFSDM_CHANNEL_DUAL_MODE)) | |||
| #define IS_DFSDM_CHANNEL_INPUT_PINS(PINS) (((PINS) == DFSDM_CHANNEL_SAME_CHANNEL_PINS) || \ | |||
| ((PINS) == DFSDM_CHANNEL_FOLLOWING_CHANNEL_PINS)) | |||
| #define IS_DFSDM_CHANNEL_SERIAL_INTERFACE_TYPE(MODE) (((MODE) == DFSDM_CHANNEL_SPI_RISING) || \ | |||
| ((MODE) == DFSDM_CHANNEL_SPI_FALLING) || \ | |||
| ((MODE) == DFSDM_CHANNEL_MANCHESTER_RISING) || \ | |||
| ((MODE) == DFSDM_CHANNEL_MANCHESTER_FALLING)) | |||
| #define IS_DFSDM_CHANNEL_SPI_CLOCK(TYPE) (((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_EXTERNAL) || \ | |||
| ((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_INTERNAL) || \ | |||
| ((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_FALLING) || \ | |||
| ((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_RISING)) | |||
| #define IS_DFSDM_CHANNEL_FILTER_ORDER(ORDER) (((ORDER) == DFSDM_CHANNEL_FASTSINC_ORDER) || \ | |||
| ((ORDER) == DFSDM_CHANNEL_SINC1_ORDER) || \ | |||
| ((ORDER) == DFSDM_CHANNEL_SINC2_ORDER) || \ | |||
| ((ORDER) == DFSDM_CHANNEL_SINC3_ORDER)) | |||
| #define IS_DFSDM_CHANNEL_FILTER_OVS_RATIO(RATIO) ((1U <= (RATIO)) && ((RATIO) <= 32U)) | |||
| #define IS_DFSDM_CHANNEL_OFFSET(VALUE) ((-8388608 <= (VALUE)) && ((VALUE) <= 8388607)) | |||
| #define IS_DFSDM_CHANNEL_RIGHT_BIT_SHIFT(VALUE) ((VALUE) <= 0x1FU) | |||
| #define IS_DFSDM_CHANNEL_SCD_THRESHOLD(VALUE) ((VALUE) <= 0xFFU) | |||
| #define IS_DFSDM_FILTER_REG_TRIGGER(TRIG) (((TRIG) == DFSDM_FILTER_SW_TRIGGER) || \ | |||
| ((TRIG) == DFSDM_FILTER_SYNC_TRIGGER)) | |||
| #define IS_DFSDM_FILTER_INJ_TRIGGER(TRIG) (((TRIG) == DFSDM_FILTER_SW_TRIGGER) || \ | |||
| ((TRIG) == DFSDM_FILTER_SYNC_TRIGGER) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIGGER)) | |||
| #if defined (STM32F413xx) || defined (STM32F423xx) | |||
| #define IS_DFSDM_FILTER_EXT_TRIG(TRIG) (((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM3_TRGO) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM10_OC1) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM2_TRGO) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM4_TRGO) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM11_OC1) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM6_TRGO) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI11) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI15)) | |||
| #define IS_DFSDM_DELAY_CLOCK(CLOCK) (((CLOCK) == HAL_MCHDLY_CLOCK_DFSDM2) || \ | |||
| ((CLOCK) == HAL_MCHDLY_CLOCK_DFSDM1)) | |||
| #define IS_DFSDM_CLOCKIN_SELECTION(SELECTION) (((SELECTION) == HAL_DFSDM2_CKIN_PAD) || \ | |||
| ((SELECTION) == HAL_DFSDM2_CKIN_DM) || \ | |||
| ((SELECTION) == HAL_DFSDM1_CKIN_PAD) || \ | |||
| ((SELECTION) == HAL_DFSDM1_CKIN_DM)) | |||
| #define IS_DFSDM_CLOCKOUT_SELECTION(SELECTION) (((SELECTION) == HAL_DFSDM2_CKOUT_DFSDM2) || \ | |||
| ((SELECTION) == HAL_DFSDM2_CKOUT_M27) || \ | |||
| ((SELECTION) == HAL_DFSDM1_CKOUT_DFSDM1) || \ | |||
| ((SELECTION) == HAL_DFSDM1_CKOUT_M27)) | |||
| #define IS_DFSDM_DATAIN0_SRC_SELECTION(SELECTION) (((SELECTION) == HAL_DATAIN0_DFSDM2_PAD) || \ | |||
| ((SELECTION) == HAL_DATAIN0_DFSDM2_DATAIN1) || \ | |||
| ((SELECTION) == HAL_DATAIN0_DFSDM1_PAD) || \ | |||
| ((SELECTION) == HAL_DATAIN0_DFSDM1_DATAIN1)) | |||
| #define IS_DFSDM_DATAIN2_SRC_SELECTION(SELECTION) (((SELECTION) == HAL_DATAIN2_DFSDM2_PAD) || \ | |||
| ((SELECTION) == HAL_DATAIN2_DFSDM2_DATAIN3) || \ | |||
| ((SELECTION) == HAL_DATAIN2_DFSDM1_PAD) || \ | |||
| ((SELECTION) == HAL_DATAIN2_DFSDM1_DATAIN3)) | |||
| #define IS_DFSDM_DATAIN4_SRC_SELECTION(SELECTION) (((SELECTION) == HAL_DATAIN4_DFSDM2_PAD) || \ | |||
| ((SELECTION) == HAL_DATAIN4_DFSDM2_DATAIN5)) | |||
| #define IS_DFSDM_DATAIN6_SRC_SELECTION(SELECTION) (((SELECTION) == HAL_DATAIN6_DFSDM2_PAD) || \ | |||
| ((SELECTION) == HAL_DATAIN6_DFSDM2_DATAIN7)) | |||
| #define IS_DFSDM_BITSTREM_CLK_DISTRIBUTION(DISTRIBUTION) (((DISTRIBUTION) == HAL_DFSDM1_CLKIN0_TIM4OC2) || \ | |||
| ((DISTRIBUTION) == HAL_DFSDM1_CLKIN2_TIM4OC2) || \ | |||
| ((DISTRIBUTION) == HAL_DFSDM1_CLKIN1_TIM4OC1) || \ | |||
| ((DISTRIBUTION) == HAL_DFSDM1_CLKIN3_TIM4OC1) || \ | |||
| ((DISTRIBUTION) == HAL_DFSDM2_CLKIN0_TIM3OC4) || \ | |||
| ((DISTRIBUTION) == HAL_DFSDM2_CLKIN4_TIM3OC4) || \ | |||
| ((DISTRIBUTION) == HAL_DFSDM2_CLKIN1_TIM3OC3)|| \ | |||
| ((DISTRIBUTION) == HAL_DFSDM2_CLKIN5_TIM3OC3) || \ | |||
| ((DISTRIBUTION) == HAL_DFSDM2_CLKIN2_TIM3OC2) || \ | |||
| ((DISTRIBUTION) == HAL_DFSDM2_CLKIN6_TIM3OC2) || \ | |||
| ((DISTRIBUTION) == HAL_DFSDM2_CLKIN3_TIM3OC1)|| \ | |||
| ((DISTRIBUTION) == HAL_DFSDM2_CLKIN7_TIM3OC1)) | |||
| #else | |||
| #define IS_DFSDM_FILTER_EXT_TRIG(TRIG) (((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM3_TRGO) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM10_OC1) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM4_TRGO) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM6_TRGO) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI11) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI15)) | |||
| #endif | |||
| #define IS_DFSDM_FILTER_EXT_TRIG_EDGE(EDGE) (((EDGE) == DFSDM_FILTER_EXT_TRIG_RISING_EDGE) || \ | |||
| ((EDGE) == DFSDM_FILTER_EXT_TRIG_FALLING_EDGE) || \ | |||
| ((EDGE) == DFSDM_FILTER_EXT_TRIG_BOTH_EDGES)) | |||
| #define IS_DFSDM_FILTER_SINC_ORDER(ORDER) (((ORDER) == DFSDM_FILTER_FASTSINC_ORDER) || \ | |||
| ((ORDER) == DFSDM_FILTER_SINC1_ORDER) || \ | |||
| ((ORDER) == DFSDM_FILTER_SINC2_ORDER) || \ | |||
| ((ORDER) == DFSDM_FILTER_SINC3_ORDER) || \ | |||
| ((ORDER) == DFSDM_FILTER_SINC4_ORDER) || \ | |||
| ((ORDER) == DFSDM_FILTER_SINC5_ORDER)) | |||
| #define IS_DFSDM_FILTER_OVS_RATIO(RATIO) ((1U <= (RATIO)) && ((RATIO) <= 1024U)) | |||
| #define IS_DFSDM_FILTER_INTEGRATOR_OVS_RATIO(RATIO) ((1U <= (RATIO)) && ((RATIO) <= 256U)) | |||
| #define IS_DFSDM_FILTER_AWD_DATA_SOURCE(DATA) (((DATA) == DFSDM_FILTER_AWD_FILTER_DATA) || \ | |||
| ((DATA) == DFSDM_FILTER_AWD_CHANNEL_DATA)) | |||
| #define IS_DFSDM_FILTER_AWD_THRESHOLD(VALUE) ((-8388608 <= (VALUE)) && ((VALUE) <= 8388607)) | |||
| #define IS_DFSDM_BREAK_SIGNALS(VALUE) ((VALUE) <= 0x0FU) | |||
| #if defined(DFSDM2_Channel0) | |||
| #define IS_DFSDM_REGULAR_CHANNEL(CHANNEL) (((CHANNEL) == DFSDM_CHANNEL_0) || \ | |||
| ((CHANNEL) == DFSDM_CHANNEL_1) || \ | |||
| ((CHANNEL) == DFSDM_CHANNEL_2) || \ | |||
| ((CHANNEL) == DFSDM_CHANNEL_3) || \ | |||
| ((CHANNEL) == DFSDM_CHANNEL_4) || \ | |||
| ((CHANNEL) == DFSDM_CHANNEL_5) || \ | |||
| ((CHANNEL) == DFSDM_CHANNEL_6) || \ | |||
| ((CHANNEL) == DFSDM_CHANNEL_7)) | |||
| #define IS_DFSDM_INJECTED_CHANNEL(CHANNEL) (((CHANNEL) != 0) && ((CHANNEL) <= 0x000F00FFU)) | |||
| #else | |||
| #define IS_DFSDM_REGULAR_CHANNEL(CHANNEL) (((CHANNEL) == DFSDM_CHANNEL_0) || \ | |||
| ((CHANNEL) == DFSDM_CHANNEL_1) || \ | |||
| ((CHANNEL) == DFSDM_CHANNEL_2) || \ | |||
| ((CHANNEL) == DFSDM_CHANNEL_3)) | |||
| #define IS_DFSDM_INJECTED_CHANNEL(CHANNEL) (((CHANNEL) != 0U) && ((CHANNEL) <= 0x0003000FU)) | |||
| #endif | |||
| #define IS_DFSDM_CONTINUOUS_MODE(MODE) (((MODE) == DFSDM_CONTINUOUS_CONV_OFF) || \ | |||
| ((MODE) == DFSDM_CONTINUOUS_CONV_ON)) | |||
| #if defined(DFSDM2_Channel0) | |||
| #define IS_DFSDM1_CHANNEL_INSTANCE(INSTANCE) (((INSTANCE) == DFSDM1_Channel0) || \ | |||
| ((INSTANCE) == DFSDM1_Channel1) || \ | |||
| ((INSTANCE) == DFSDM1_Channel2) || \ | |||
| ((INSTANCE) == DFSDM1_Channel3)) | |||
| #define IS_DFSDM1_FILTER_INSTANCE(INSTANCE) (((INSTANCE) == DFSDM1_Filter0) || \ | |||
| ((INSTANCE) == DFSDM1_Filter1)) | |||
| #endif /* DFSDM2_Channel0 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* End of private macros -----------------------------------------------------*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_DFSDM_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_dma.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of DMA HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -225,6 +225,16 @@ typedef struct __DMA_HandleTypeDef | |||
| #define DMA_CHANNEL_5 ((uint32_t)0x0A000000U) /*!< DMA Channel 5 */ | |||
| #define DMA_CHANNEL_6 ((uint32_t)0x0C000000U) /*!< DMA Channel 6 */ | |||
| #define DMA_CHANNEL_7 ((uint32_t)0x0E000000U) /*!< DMA Channel 7 */ | |||
| #if defined (DMA_SxCR_CHSEL_3) | |||
| #define DMA_CHANNEL_8 ((uint32_t)0x10000000U) /*!< DMA Channel 8 */ | |||
| #define DMA_CHANNEL_9 ((uint32_t)0x12000000U) /*!< DMA Channel 9 */ | |||
| #define DMA_CHANNEL_10 ((uint32_t)0x14000000U) /*!< DMA Channel 10 */ | |||
| #define DMA_CHANNEL_11 ((uint32_t)0x16000000U) /*!< DMA Channel 11 */ | |||
| #define DMA_CHANNEL_12 ((uint32_t)0x18000000U) /*!< DMA Channel 12 */ | |||
| #define DMA_CHANNEL_13 ((uint32_t)0x1A000000U) /*!< DMA Channel 13 */ | |||
| #define DMA_CHANNEL_14 ((uint32_t)0x1C000000U) /*!< DMA Channel 14 */ | |||
| #define DMA_CHANNEL_15 ((uint32_t)0x1E000000U) /*!< DMA Channel 15 */ | |||
| #endif /* DMA_SxCR_CHSEL_3 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -708,6 +718,24 @@ uint32_t HAL_DMA_GetError(DMA_HandleTypeDef *hdma); | |||
| * @brief DMA private macros | |||
| * @{ | |||
| */ | |||
| #if defined (DMA_SxCR_CHSEL_3) | |||
| #define IS_DMA_CHANNEL(CHANNEL) (((CHANNEL) == DMA_CHANNEL_0) || \ | |||
| ((CHANNEL) == DMA_CHANNEL_1) || \ | |||
| ((CHANNEL) == DMA_CHANNEL_2) || \ | |||
| ((CHANNEL) == DMA_CHANNEL_3) || \ | |||
| ((CHANNEL) == DMA_CHANNEL_4) || \ | |||
| ((CHANNEL) == DMA_CHANNEL_5) || \ | |||
| ((CHANNEL) == DMA_CHANNEL_6) || \ | |||
| ((CHANNEL) == DMA_CHANNEL_7) || \ | |||
| ((CHANNEL) == DMA_CHANNEL_8) || \ | |||
| ((CHANNEL) == DMA_CHANNEL_9) || \ | |||
| ((CHANNEL) == DMA_CHANNEL_10)|| \ | |||
| ((CHANNEL) == DMA_CHANNEL_11)|| \ | |||
| ((CHANNEL) == DMA_CHANNEL_12)|| \ | |||
| ((CHANNEL) == DMA_CHANNEL_13)|| \ | |||
| ((CHANNEL) == DMA_CHANNEL_14)|| \ | |||
| ((CHANNEL) == DMA_CHANNEL_15)) | |||
| #else | |||
| #define IS_DMA_CHANNEL(CHANNEL) (((CHANNEL) == DMA_CHANNEL_0) || \ | |||
| ((CHANNEL) == DMA_CHANNEL_1) || \ | |||
| ((CHANNEL) == DMA_CHANNEL_2) || \ | |||
| @@ -716,6 +744,7 @@ uint32_t HAL_DMA_GetError(DMA_HandleTypeDef *hdma); | |||
| ((CHANNEL) == DMA_CHANNEL_5) || \ | |||
| ((CHANNEL) == DMA_CHANNEL_6) || \ | |||
| ((CHANNEL) == DMA_CHANNEL_7)) | |||
| #endif /* DMA_SxCR_CHSEL_3 */ | |||
| #define IS_DMA_DIRECTION(DIRECTION) (((DIRECTION) == DMA_PERIPH_TO_MEMORY ) || \ | |||
| ((DIRECTION) == DMA_MEMORY_TO_PERIPH) || \ | |||
| @@ -0,0 +1,577 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_dma2d.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of DMA2D HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_DMA2D_H | |||
| #define __STM32F4xx_HAL_DMA2D_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ | |||
| defined(STM32F469xx) || defined(STM32F479xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup DMA2D DMA2D | |||
| * @brief DMA2D HAL module driver | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup DMA2D_Exported_Types DMA2D Exported Types | |||
| * @{ | |||
| */ | |||
| #define MAX_DMA2D_LAYER 2U | |||
| /** | |||
| * @brief DMA2D color Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t Blue; /*!< Configures the blue value. | |||
| This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */ | |||
| uint32_t Green; /*!< Configures the green value. | |||
| This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */ | |||
| uint32_t Red; /*!< Configures the red value. | |||
| This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */ | |||
| } DMA2D_ColorTypeDef; | |||
| /** | |||
| * @brief DMA2D CLUT Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t *pCLUT; /*!< Configures the DMA2D CLUT memory address.*/ | |||
| uint32_t CLUTColorMode; /*!< Configures the DMA2D CLUT color mode. | |||
| This parameter can be one value of @ref DMA2D_CLUT_CM. */ | |||
| uint32_t Size; /*!< Configures the DMA2D CLUT size. | |||
| This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF.*/ | |||
| } DMA2D_CLUTCfgTypeDef; | |||
| /** | |||
| * @brief DMA2D Init structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t Mode; /*!< Configures the DMA2D transfer mode. | |||
| This parameter can be one value of @ref DMA2D_Mode. */ | |||
| uint32_t ColorMode; /*!< Configures the color format of the output image. | |||
| This parameter can be one value of @ref DMA2D_Output_Color_Mode. */ | |||
| uint32_t OutputOffset; /*!< Specifies the Offset value. | |||
| This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x3FFF. */ | |||
| } DMA2D_InitTypeDef; | |||
| /** | |||
| * @brief DMA2D Layer structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t InputOffset; /*!< Configures the DMA2D foreground or background offset. | |||
| This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x3FFF. */ | |||
| uint32_t InputColorMode; /*!< Configures the DMA2D foreground or background color mode. | |||
| This parameter can be one value of @ref DMA2D_Input_Color_Mode. */ | |||
| uint32_t AlphaMode; /*!< Configures the DMA2D foreground or background alpha mode. | |||
| This parameter can be one value of @ref DMA2D_Alpha_Mode. */ | |||
| uint32_t InputAlpha; /*!< Specifies the DMA2D foreground or background alpha value and color value in case of A8 or A4 color mode. | |||
| This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF except for the color modes detailed below. | |||
| @note In case of A8 or A4 color mode (ARGB), this parameter must be a number between | |||
| Min_Data = 0x00000000 and Max_Data = 0xFFFFFFFF where | |||
| - InputAlpha[24:31] is the alpha value ALPHA[0:7] | |||
| - InputAlpha[16:23] is the red value RED[0:7] | |||
| - InputAlpha[8:15] is the green value GREEN[0:7] | |||
| - InputAlpha[0:7] is the blue value BLUE[0:7]. */ | |||
| } DMA2D_LayerCfgTypeDef; | |||
| /** | |||
| * @brief HAL DMA2D State structures definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_DMA2D_STATE_RESET = 0x00U, /*!< DMA2D not yet initialized or disabled */ | |||
| HAL_DMA2D_STATE_READY = 0x01U, /*!< Peripheral Initialized and ready for use */ | |||
| HAL_DMA2D_STATE_BUSY = 0x02U, /*!< An internal process is ongoing */ | |||
| HAL_DMA2D_STATE_TIMEOUT = 0x03U, /*!< Timeout state */ | |||
| HAL_DMA2D_STATE_ERROR = 0x04U, /*!< DMA2D state error */ | |||
| HAL_DMA2D_STATE_SUSPEND = 0x05U /*!< DMA2D process is suspended */ | |||
| }HAL_DMA2D_StateTypeDef; | |||
| /** | |||
| * @brief DMA2D handle Structure definition | |||
| */ | |||
| typedef struct __DMA2D_HandleTypeDef | |||
| { | |||
| DMA2D_TypeDef *Instance; /*!< DMA2D register base address. */ | |||
| DMA2D_InitTypeDef Init; /*!< DMA2D communication parameters. */ | |||
| void (* XferCpltCallback)(struct __DMA2D_HandleTypeDef * hdma2d); /*!< DMA2D transfer complete callback. */ | |||
| void (* XferErrorCallback)(struct __DMA2D_HandleTypeDef * hdma2d); /*!< DMA2D transfer error callback. */ | |||
| DMA2D_LayerCfgTypeDef LayerCfg[MAX_DMA2D_LAYER]; /*!< DMA2D Layers parameters */ | |||
| HAL_LockTypeDef Lock; /*!< DMA2D lock. */ | |||
| __IO HAL_DMA2D_StateTypeDef State; /*!< DMA2D transfer state. */ | |||
| __IO uint32_t ErrorCode; /*!< DMA2D error code. */ | |||
| } DMA2D_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup DMA2D_Exported_Constants DMA2D Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup DMA2D_Error_Code DMA2D Error Code | |||
| * @{ | |||
| */ | |||
| #define HAL_DMA2D_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */ | |||
| #define HAL_DMA2D_ERROR_TE ((uint32_t)0x00000001U) /*!< Transfer error */ | |||
| #define HAL_DMA2D_ERROR_CE ((uint32_t)0x00000002U) /*!< Configuration error */ | |||
| #define HAL_DMA2D_ERROR_CAE ((uint32_t)0x00000004U) /*!< CLUT access error */ | |||
| #define HAL_DMA2D_ERROR_TIMEOUT ((uint32_t)0x00000020U) /*!< Timeout error */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DMA2D_Mode DMA2D Mode | |||
| * @{ | |||
| */ | |||
| #define DMA2D_M2M ((uint32_t)0x00000000U) /*!< DMA2D memory to memory transfer mode */ | |||
| #define DMA2D_M2M_PFC DMA2D_CR_MODE_0 /*!< DMA2D memory to memory with pixel format conversion transfer mode */ | |||
| #define DMA2D_M2M_BLEND DMA2D_CR_MODE_1 /*!< DMA2D memory to memory with blending transfer mode */ | |||
| #define DMA2D_R2M DMA2D_CR_MODE /*!< DMA2D register to memory transfer mode */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DMA2D_Output_Color_Mode DMA2D Output Color Mode | |||
| * @{ | |||
| */ | |||
| #define DMA2D_OUTPUT_ARGB8888 ((uint32_t)0x00000000U) /*!< ARGB8888 DMA2D color mode */ | |||
| #define DMA2D_OUTPUT_RGB888 DMA2D_OPFCCR_CM_0 /*!< RGB888 DMA2D color mode */ | |||
| #define DMA2D_OUTPUT_RGB565 DMA2D_OPFCCR_CM_1 /*!< RGB565 DMA2D color mode */ | |||
| #define DMA2D_OUTPUT_ARGB1555 (DMA2D_OPFCCR_CM_0|DMA2D_OPFCCR_CM_1) /*!< ARGB1555 DMA2D color mode */ | |||
| #define DMA2D_OUTPUT_ARGB4444 DMA2D_OPFCCR_CM_2 /*!< ARGB4444 DMA2D color mode */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DMA2D_Input_Color_Mode DMA2D Input Color Mode | |||
| * @{ | |||
| */ | |||
| #define DMA2D_INPUT_ARGB8888 ((uint32_t)0x00000000U) /*!< ARGB8888 color mode */ | |||
| #define DMA2D_INPUT_RGB888 ((uint32_t)0x00000001U) /*!< RGB888 color mode */ | |||
| #define DMA2D_INPUT_RGB565 ((uint32_t)0x00000002U) /*!< RGB565 color mode */ | |||
| #define DMA2D_INPUT_ARGB1555 ((uint32_t)0x00000003U) /*!< ARGB1555 color mode */ | |||
| #define DMA2D_INPUT_ARGB4444 ((uint32_t)0x00000004U) /*!< ARGB4444 color mode */ | |||
| #define DMA2D_INPUT_L8 ((uint32_t)0x00000005U) /*!< L8 color mode */ | |||
| #define DMA2D_INPUT_AL44 ((uint32_t)0x00000006U) /*!< AL44 color mode */ | |||
| #define DMA2D_INPUT_AL88 ((uint32_t)0x00000007U) /*!< AL88 color mode */ | |||
| #define DMA2D_INPUT_L4 ((uint32_t)0x00000008U) /*!< L4 color mode */ | |||
| #define DMA2D_INPUT_A8 ((uint32_t)0x00000009U) /*!< A8 color mode */ | |||
| #define DMA2D_INPUT_A4 ((uint32_t)0x0000000AU) /*!< A4 color mode */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DMA2D_Alpha_Mode DMA2D Alpha Mode | |||
| * @{ | |||
| */ | |||
| #define DMA2D_NO_MODIF_ALPHA ((uint32_t)0x00000000U) /*!< No modification of the alpha channel value */ | |||
| #define DMA2D_REPLACE_ALPHA ((uint32_t)0x00000001U) /*!< Replace original alpha channel value by programmed alpha value */ | |||
| #define DMA2D_COMBINE_ALPHA ((uint32_t)0x00000002U) /*!< Replace original alpha channel value by programmed alpha value | |||
| with original alpha channel value */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DMA2D_CLUT_CM DMA2D CLUT Color Mode | |||
| * @{ | |||
| */ | |||
| #define DMA2D_CCM_ARGB8888 ((uint32_t)0x00000000U) /*!< ARGB8888 DMA2D CLUT color mode */ | |||
| #define DMA2D_CCM_RGB888 ((uint32_t)0x00000001U) /*!< RGB888 DMA2D CLUT color mode */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DMA2D_Interrupts DMA2D Interrupts | |||
| * @{ | |||
| */ | |||
| #define DMA2D_IT_CE DMA2D_CR_CEIE /*!< Configuration Error Interrupt */ | |||
| #define DMA2D_IT_CTC DMA2D_CR_CTCIE /*!< CLUT Transfer Complete Interrupt */ | |||
| #define DMA2D_IT_CAE DMA2D_CR_CAEIE /*!< CLUT Access Error Interrupt */ | |||
| #define DMA2D_IT_TW DMA2D_CR_TWIE /*!< Transfer Watermark Interrupt */ | |||
| #define DMA2D_IT_TC DMA2D_CR_TCIE /*!< Transfer Complete Interrupt */ | |||
| #define DMA2D_IT_TE DMA2D_CR_TEIE /*!< Transfer Error Interrupt */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DMA2D_Flags DMA2D Flags | |||
| * @{ | |||
| */ | |||
| #define DMA2D_FLAG_CE DMA2D_ISR_CEIF /*!< Configuration Error Interrupt Flag */ | |||
| #define DMA2D_FLAG_CTC DMA2D_ISR_CTCIF /*!< CLUT Transfer Complete Interrupt Flag */ | |||
| #define DMA2D_FLAG_CAE DMA2D_ISR_CAEIF /*!< CLUT Access Error Interrupt Flag */ | |||
| #define DMA2D_FLAG_TW DMA2D_ISR_TWIF /*!< Transfer Watermark Interrupt Flag */ | |||
| #define DMA2D_FLAG_TC DMA2D_ISR_TCIF /*!< Transfer Complete Interrupt Flag */ | |||
| #define DMA2D_FLAG_TE DMA2D_ISR_TEIF /*!< Transfer Error Interrupt Flag */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DMA2D_Aliases DMA2D API Aliases | |||
| * @{ | |||
| */ | |||
| #define HAL_DMA2D_DisableCLUT HAL_DMA2D_CLUTLoading_Abort /*!< Aliased to HAL_DMA2D_CLUTLoading_Abort for compatibility with legacy code */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macros ------------------------------------------------------------*/ | |||
| /** @defgroup DMA2D_Exported_Macros DMA2D Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset DMA2D handle state | |||
| * @param __HANDLE__: specifies the DMA2D handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DMA2D_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DMA2D_STATE_RESET) | |||
| /** | |||
| * @brief Enable the DMA2D. | |||
| * @param __HANDLE__: DMA2D handle | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_DMA2D_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DMA2D_CR_START) | |||
| /* Interrupt & Flag management */ | |||
| /** | |||
| * @brief Get the DMA2D pending flags. | |||
| * @param __HANDLE__: DMA2D handle | |||
| * @param __FLAG__: flag to check. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg DMA2D_FLAG_CE: Configuration error flag | |||
| * @arg DMA2D_FLAG_CTC: CLUT transfer complete flag | |||
| * @arg DMA2D_FLAG_CAE: CLUT access error flag | |||
| * @arg DMA2D_FLAG_TW: Transfer Watermark flag | |||
| * @arg DMA2D_FLAG_TC: Transfer complete flag | |||
| * @arg DMA2D_FLAG_TE: Transfer error flag | |||
| * @retval The state of FLAG. | |||
| */ | |||
| #define __HAL_DMA2D_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR & (__FLAG__)) | |||
| /** | |||
| * @brief Clear the DMA2D pending flags. | |||
| * @param __HANDLE__: DMA2D handle | |||
| * @param __FLAG__: specifies the flag to clear. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg DMA2D_FLAG_CE: Configuration error flag | |||
| * @arg DMA2D_FLAG_CTC: CLUT transfer complete flag | |||
| * @arg DMA2D_FLAG_CAE: CLUT access error flag | |||
| * @arg DMA2D_FLAG_TW: Transfer Watermark flag | |||
| * @arg DMA2D_FLAG_TC: Transfer complete flag | |||
| * @arg DMA2D_FLAG_TE: Transfer error flag | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DMA2D_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->IFCR = (__FLAG__)) | |||
| /** | |||
| * @brief Enable the specified DMA2D interrupts. | |||
| * @param __HANDLE__: DMA2D handle | |||
| * @param __INTERRUPT__: specifies the DMA2D interrupt sources to be enabled. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg DMA2D_IT_CE: Configuration error interrupt mask | |||
| * @arg DMA2D_IT_CTC: CLUT transfer complete interrupt mask | |||
| * @arg DMA2D_IT_CAE: CLUT access error interrupt mask | |||
| * @arg DMA2D_IT_TW: Transfer Watermark interrupt mask | |||
| * @arg DMA2D_IT_TC: Transfer complete interrupt mask | |||
| * @arg DMA2D_IT_TE: Transfer error interrupt mask | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DMA2D_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__)) | |||
| /** | |||
| * @brief Disable the specified DMA2D interrupts. | |||
| * @param __HANDLE__: DMA2D handle | |||
| * @param __INTERRUPT__: specifies the DMA2D interrupt sources to be disabled. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg DMA2D_IT_CE: Configuration error interrupt mask | |||
| * @arg DMA2D_IT_CTC: CLUT transfer complete interrupt mask | |||
| * @arg DMA2D_IT_CAE: CLUT access error interrupt mask | |||
| * @arg DMA2D_IT_TW: Transfer Watermark interrupt mask | |||
| * @arg DMA2D_IT_TC: Transfer complete interrupt mask | |||
| * @arg DMA2D_IT_TE: Transfer error interrupt mask | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DMA2D_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__)) | |||
| /** | |||
| * @brief Check whether the specified DMA2D interrupt source is enabled or not. | |||
| * @param __HANDLE__: DMA2D handle | |||
| * @param __INTERRUPT__: specifies the DMA2D interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg DMA2D_IT_CE: Configuration error interrupt mask | |||
| * @arg DMA2D_IT_CTC: CLUT transfer complete interrupt mask | |||
| * @arg DMA2D_IT_CAE: CLUT access error interrupt mask | |||
| * @arg DMA2D_IT_TW: Transfer Watermark interrupt mask | |||
| * @arg DMA2D_IT_TC: Transfer complete interrupt mask | |||
| * @arg DMA2D_IT_TE: Transfer error interrupt mask | |||
| * @retval The state of INTERRUPT source. | |||
| */ | |||
| #define __HAL_DMA2D_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR & (__INTERRUPT__)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup DMA2D_Exported_Functions DMA2D Exported Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup DMA2D_Exported_Functions_Group1 Initialization and de-initialization functions | |||
| * @{ | |||
| */ | |||
| /* Initialization and de-initialization functions *******************************/ | |||
| HAL_StatusTypeDef HAL_DMA2D_Init(DMA2D_HandleTypeDef *hdma2d); | |||
| HAL_StatusTypeDef HAL_DMA2D_DeInit (DMA2D_HandleTypeDef *hdma2d); | |||
| void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef* hdma2d); | |||
| void HAL_DMA2D_MspDeInit(DMA2D_HandleTypeDef* hdma2d); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup DMA2D_Exported_Functions_Group2 IO operation functions | |||
| * @{ | |||
| */ | |||
| /* IO operation functions *******************************************************/ | |||
| HAL_StatusTypeDef HAL_DMA2D_Start(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height); | |||
| HAL_StatusTypeDef HAL_DMA2D_BlendingStart(DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Height); | |||
| HAL_StatusTypeDef HAL_DMA2D_Start_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height); | |||
| HAL_StatusTypeDef HAL_DMA2D_BlendingStart_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Height); | |||
| HAL_StatusTypeDef HAL_DMA2D_Suspend(DMA2D_HandleTypeDef *hdma2d); | |||
| HAL_StatusTypeDef HAL_DMA2D_Resume(DMA2D_HandleTypeDef *hdma2d); | |||
| HAL_StatusTypeDef HAL_DMA2D_Abort(DMA2D_HandleTypeDef *hdma2d); | |||
| HAL_StatusTypeDef HAL_DMA2D_EnableCLUT(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_DMA2D_CLUTLoad(DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_DMA2D_CLUTLoad_IT(DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Abort(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Suspend(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Resume(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_DMA2D_PollForTransfer(DMA2D_HandleTypeDef *hdma2d, uint32_t Timeout); | |||
| void HAL_DMA2D_IRQHandler(DMA2D_HandleTypeDef *hdma2d); | |||
| void HAL_DMA2D_LineEventCallback(DMA2D_HandleTypeDef *hdma2d); | |||
| void HAL_DMA2D_CLUTLoadingCpltCallback(DMA2D_HandleTypeDef *hdma2d); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup DMA2D_Exported_Functions_Group3 Peripheral Control functions | |||
| * @{ | |||
| */ | |||
| /* Peripheral Control functions *************************************************/ | |||
| HAL_StatusTypeDef HAL_DMA2D_ConfigLayer(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_DMA2D_ConfigCLUT(DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_DMA2D_ProgramLineEvent(DMA2D_HandleTypeDef *hdma2d, uint32_t Line); | |||
| HAL_StatusTypeDef HAL_DMA2D_EnableDeadTime(DMA2D_HandleTypeDef *hdma2d); | |||
| HAL_StatusTypeDef HAL_DMA2D_DisableDeadTime(DMA2D_HandleTypeDef *hdma2d); | |||
| HAL_StatusTypeDef HAL_DMA2D_ConfigDeadTime(DMA2D_HandleTypeDef *hdma2d, uint8_t DeadTime); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup DMA2D_Exported_Functions_Group4 Peripheral State and Error functions | |||
| * @{ | |||
| */ | |||
| /* Peripheral State functions ***************************************************/ | |||
| HAL_DMA2D_StateTypeDef HAL_DMA2D_GetState(DMA2D_HandleTypeDef *hdma2d); | |||
| uint32_t HAL_DMA2D_GetError(DMA2D_HandleTypeDef *hdma2d); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @addtogroup DMA2D_Private_Constants DMA2D Private Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup DMA2D_Maximum_Line_WaterMark DMA2D Maximum Line Watermark | |||
| * @{ | |||
| */ | |||
| #define DMA2D_LINE_WATERMARK_MAX DMA2D_LWR_LW /*!< DMA2D maximum line watermark */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DMA2D_Color_Value DMA2D Color Value | |||
| * @{ | |||
| */ | |||
| #define DMA2D_COLOR_VALUE ((uint32_t)0x000000FFU) /*!< Color value mask */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DMA2D_Max_Layer DMA2D Maximum Number of Layers | |||
| * @{ | |||
| */ | |||
| #define DMA2D_MAX_LAYER 2U /*!< DMA2D maximum number of layers */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DMA2D_Offset DMA2D Offset | |||
| * @{ | |||
| */ | |||
| #define DMA2D_OFFSET DMA2D_FGOR_LO /*!< Line Offset */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DMA2D_Size DMA2D Size | |||
| * @{ | |||
| */ | |||
| #define DMA2D_PIXEL (DMA2D_NLR_PL >> 16U) /*!< DMA2D number of pixels per line */ | |||
| #define DMA2D_LINE DMA2D_NLR_NL /*!< DMA2D number of lines */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DMA2D_CLUT_Size DMA2D CLUT Size | |||
| * @{ | |||
| */ | |||
| #define DMA2D_CLUT_SIZE (DMA2D_FGPFCCR_CS >> 8U) /*!< DMA2D CLUT size */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup DMA2D_Private_Macros DMA2D Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_DMA2D_LAYER(LAYER) ((LAYER) <= DMA2D_MAX_LAYER) | |||
| #define IS_DMA2D_MODE(MODE) (((MODE) == DMA2D_M2M) || ((MODE) == DMA2D_M2M_PFC) || \ | |||
| ((MODE) == DMA2D_M2M_BLEND) || ((MODE) == DMA2D_R2M)) | |||
| #define IS_DMA2D_CMODE(MODE_ARGB) (((MODE_ARGB) == DMA2D_OUTPUT_ARGB8888) || ((MODE_ARGB) == DMA2D_OUTPUT_RGB888) || \ | |||
| ((MODE_ARGB) == DMA2D_OUTPUT_RGB565) || ((MODE_ARGB) == DMA2D_OUTPUT_ARGB1555) || \ | |||
| ((MODE_ARGB) == DMA2D_OUTPUT_ARGB4444)) | |||
| #define IS_DMA2D_COLOR(COLOR) ((COLOR) <= DMA2D_COLOR_VALUE) | |||
| #define IS_DMA2D_LINE(LINE) ((LINE) <= DMA2D_LINE) | |||
| #define IS_DMA2D_PIXEL(PIXEL) ((PIXEL) <= DMA2D_PIXEL) | |||
| #define IS_DMA2D_OFFSET(OOFFSET) ((OOFFSET) <= DMA2D_OFFSET) | |||
| #define IS_DMA2D_INPUT_COLOR_MODE(INPUT_CM) (((INPUT_CM) == DMA2D_INPUT_ARGB8888) || ((INPUT_CM) == DMA2D_INPUT_RGB888) || \ | |||
| ((INPUT_CM) == DMA2D_INPUT_RGB565) || ((INPUT_CM) == DMA2D_INPUT_ARGB1555) || \ | |||
| ((INPUT_CM) == DMA2D_INPUT_ARGB4444) || ((INPUT_CM) == DMA2D_INPUT_L8) || \ | |||
| ((INPUT_CM) == DMA2D_INPUT_AL44) || ((INPUT_CM) == DMA2D_INPUT_AL88) || \ | |||
| ((INPUT_CM) == DMA2D_INPUT_L4) || ((INPUT_CM) == DMA2D_INPUT_A8) || \ | |||
| ((INPUT_CM) == DMA2D_INPUT_A4)) | |||
| #define IS_DMA2D_ALPHA_MODE(AlphaMode) (((AlphaMode) == DMA2D_NO_MODIF_ALPHA) || \ | |||
| ((AlphaMode) == DMA2D_REPLACE_ALPHA) || \ | |||
| ((AlphaMode) == DMA2D_COMBINE_ALPHA)) | |||
| #define IS_DMA2D_CLUT_CM(CLUT_CM) (((CLUT_CM) == DMA2D_CCM_ARGB8888) || ((CLUT_CM) == DMA2D_CCM_RGB888)) | |||
| #define IS_DMA2D_CLUT_SIZE(CLUT_SIZE) ((CLUT_SIZE) <= DMA2D_CLUT_SIZE) | |||
| #define IS_DMA2D_LINEWATERMARK(LineWatermark) ((LineWatermark) <= DMA2D_LINE_WATERMARK_MAX) | |||
| #define IS_DMA2D_IT(IT) (((IT) == DMA2D_IT_CTC) || ((IT) == DMA2D_IT_CAE) || \ | |||
| ((IT) == DMA2D_IT_TW) || ((IT) == DMA2D_IT_TC) || \ | |||
| ((IT) == DMA2D_IT_TE) || ((IT) == DMA2D_IT_CE)) | |||
| #define IS_DMA2D_GET_FLAG(FLAG) (((FLAG) == DMA2D_FLAG_CTC) || ((FLAG) == DMA2D_FLAG_CAE) || \ | |||
| ((FLAG) == DMA2D_FLAG_TW) || ((FLAG) == DMA2D_FLAG_TC) || \ | |||
| ((FLAG) == DMA2D_FLAG_TE) || ((FLAG) == DMA2D_FLAG_CE)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_DMA2D_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_dma_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of DMA HAL extension module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_flash.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of FLASH HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -287,7 +287,7 @@ typedef struct | |||
| * @arg FLASH_FLAG_BSY : FLASH Busy flag | |||
| * @retval The new state of __FLAG__ (SET or RESET). | |||
| */ | |||
| #define __HAL_FLASH_GET_FLAG(__FLAG__) ((FLASH->SR & (__FLAG__))==(__FLAG__)) | |||
| #define __HAL_FLASH_GET_FLAG(__FLAG__) ((FLASH->SR & (__FLAG__))) | |||
| /** | |||
| * @brief Clear the specified FLASH flag. | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_flash_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of FLASH HAL Extension module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -115,7 +115,7 @@ typedef struct | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ | |||
| defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ | |||
| defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ | |||
| defined(STM32F412Cx) | |||
| defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| typedef struct | |||
| { | |||
| uint32_t OptionType; /*!< Option byte to be configured for extension. | |||
| @@ -125,11 +125,11 @@ typedef struct | |||
| This parameter can be a value of @ref FLASHEx_PCROP_State */ | |||
| #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| uint16_t Sectors; /*!< specifies the sector(s) set for PCROP. | |||
| This parameter can be a value of @ref FLASHEx_Option_Bytes_PC_ReadWrite_Protection */ | |||
| #endif /* STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx ||\ | |||
| STM32F412Cx */ | |||
| STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) | |||
| uint32_t Banks; /*!< Select banks for PCROP activation/deactivation of all sectors. | |||
| @@ -146,7 +146,8 @@ typedef struct | |||
| #endif /*STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ | |||
| }FLASH_AdvOBProgramInitTypeDef; | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || | |||
| STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -251,7 +252,7 @@ typedef struct | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ | |||
| defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ | |||
| defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ | |||
| defined(STM32F412Cx) | |||
| defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /** @defgroup FLASHEx_PCROP_State FLASH PCROP State | |||
| * @{ | |||
| */ | |||
| @@ -262,8 +263,7 @@ typedef struct | |||
| */ | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\ | |||
| STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ | |||
| STM32F412Vx) || defined(STM32F412Rx) ||\ | |||
| STM32F412Cx */ | |||
| STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| /** @defgroup FLASHEx_Advanced_Option_Type FLASH Advanced Option Type | |||
| * @{ | |||
| @@ -276,9 +276,11 @@ typedef struct | |||
| #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ | |||
| defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ | |||
| defined(STM32F423xx) | |||
| #define OPTIONBYTE_PCROP ((uint32_t)0x01U) /*!<PCROP option byte configuration */ | |||
| #endif /* STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| #endif /* STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || | |||
| STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -308,11 +310,11 @@ typedef struct | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ | |||
| /*--------------------------------------------------------------------------------------------------------------*/ | |||
| /*-------------------------- STM32F40xxx/STM32F41xxx/STM32F401xx/STM32F411xx -----------------------------------*/ | |||
| /*-------------------------- STM32F40xxx/STM32F41xxx/STM32F401xx/STM32F411xx/STM32F423xx -----------------------*/ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ | |||
| defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\ | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define FLASH_LATENCY_0 FLASH_ACR_LATENCY_0WS /*!< FLASH Zero Latency cycle */ | |||
| #define FLASH_LATENCY_1 FLASH_ACR_LATENCY_1WS /*!< FLASH One Latency cycle */ | |||
| @@ -322,7 +324,8 @@ typedef struct | |||
| #define FLASH_LATENCY_5 FLASH_ACR_LATENCY_5WS /*!< FLASH Five Latency cycles */ | |||
| #define FLASH_LATENCY_6 FLASH_ACR_LATENCY_6WS /*!< FLASH Six Latency cycles */ | |||
| #define FLASH_LATENCY_7 FLASH_ACR_LATENCY_7WS /*!< FLASH Seven Latency cycles */ | |||
| #endif /* STM32F40xxx || STM32F41xxx || STM32F401xx || STM32F410xx || STM32F411xE || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| #endif /* STM32F40xxx || STM32F41xxx || STM32F401xx || STM32F410xx || STM32F411xE || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || | |||
| STM32F413xx || STM32F423xx */ | |||
| /*--------------------------------------------------------------------------------------------------------------*/ | |||
| /** | |||
| @@ -343,9 +346,11 @@ typedef struct | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ | |||
| defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ | |||
| defined(STM32F423xx) | |||
| #define FLASH_BANK_1 ((uint32_t)1U) /*!< Bank 1 */ | |||
| #endif /* STM32F40xxx || STM32F41xxx || STM32F401xx || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| #endif /* STM32F40xxx || STM32F41xxx || STM32F401xx || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx | |||
| STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -361,9 +366,11 @@ typedef struct | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ | |||
| defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ | |||
| defined(STM32F423xx) | |||
| #define FLASH_MER_BIT (FLASH_CR_MER) /*!< only 1 MER Bit */ | |||
| #endif /* STM32F40xxx || STM32F41xxx || STM32F401xx || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| #endif /* STM32F40xxx || STM32F41xxx || STM32F401xx || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx | |||
| STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -401,6 +408,27 @@ typedef struct | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */ | |||
| /*-----------------------------------------------------------------------------------------------------*/ | |||
| /*-------------------------------------- STM32F413xx/STM32F423xx --------------------------------------*/ | |||
| #if defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define FLASH_SECTOR_0 ((uint32_t)0U) /*!< Sector Number 0 */ | |||
| #define FLASH_SECTOR_1 ((uint32_t)1U) /*!< Sector Number 1 */ | |||
| #define FLASH_SECTOR_2 ((uint32_t)2U) /*!< Sector Number 2 */ | |||
| #define FLASH_SECTOR_3 ((uint32_t)3U) /*!< Sector Number 3 */ | |||
| #define FLASH_SECTOR_4 ((uint32_t)4U) /*!< Sector Number 4 */ | |||
| #define FLASH_SECTOR_5 ((uint32_t)5U) /*!< Sector Number 5 */ | |||
| #define FLASH_SECTOR_6 ((uint32_t)6U) /*!< Sector Number 6 */ | |||
| #define FLASH_SECTOR_7 ((uint32_t)7U) /*!< Sector Number 7 */ | |||
| #define FLASH_SECTOR_8 ((uint32_t)8U) /*!< Sector Number 8 */ | |||
| #define FLASH_SECTOR_9 ((uint32_t)9U) /*!< Sector Number 9 */ | |||
| #define FLASH_SECTOR_10 ((uint32_t)10U) /*!< Sector Number 10 */ | |||
| #define FLASH_SECTOR_11 ((uint32_t)11U) /*!< Sector Number 11 */ | |||
| #define FLASH_SECTOR_12 ((uint32_t)12U) /*!< Sector Number 12 */ | |||
| #define FLASH_SECTOR_13 ((uint32_t)13U) /*!< Sector Number 13 */ | |||
| #define FLASH_SECTOR_14 ((uint32_t)14U) /*!< Sector Number 14 */ | |||
| #define FLASH_SECTOR_15 ((uint32_t)15U) /*!< Sector Number 15 */ | |||
| #endif /* STM32F413xx || STM32F423xx */ | |||
| /*-----------------------------------------------------------------------------------------------------*/ | |||
| /*--------------------------------------- STM32F40xxx/STM32F41xxx -------------------------------------*/ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| @@ -491,6 +519,28 @@ typedef struct | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */ | |||
| /*-----------------------------------------------------------------------------------------------------*/ | |||
| /*--------------------------------------- STM32F413xx/STM32F423xx -------------------------------------*/ | |||
| #if defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define OB_WRP_SECTOR_0 ((uint32_t)0x00000001U) /*!< Write protection of Sector0 */ | |||
| #define OB_WRP_SECTOR_1 ((uint32_t)0x00000002U) /*!< Write protection of Sector1 */ | |||
| #define OB_WRP_SECTOR_2 ((uint32_t)0x00000004U) /*!< Write protection of Sector2 */ | |||
| #define OB_WRP_SECTOR_3 ((uint32_t)0x00000008U) /*!< Write protection of Sector3 */ | |||
| #define OB_WRP_SECTOR_4 ((uint32_t)0x00000010U) /*!< Write protection of Sector4 */ | |||
| #define OB_WRP_SECTOR_5 ((uint32_t)0x00000020U) /*!< Write protection of Sector5 */ | |||
| #define OB_WRP_SECTOR_6 ((uint32_t)0x00000040U) /*!< Write protection of Sector6 */ | |||
| #define OB_WRP_SECTOR_7 ((uint32_t)0x00000080U) /*!< Write protection of Sector7 */ | |||
| #define OB_WRP_SECTOR_8 ((uint32_t)0x00000100U) /*!< Write protection of Sector8 */ | |||
| #define OB_WRP_SECTOR_9 ((uint32_t)0x00000200U) /*!< Write protection of Sector9 */ | |||
| #define OB_WRP_SECTOR_10 ((uint32_t)0x00000400U) /*!< Write protection of Sector10 */ | |||
| #define OB_WRP_SECTOR_11 ((uint32_t)0x00000800U) /*!< Write protection of Sector11 */ | |||
| #define OB_WRP_SECTOR_12 ((uint32_t)0x00001000U) /*!< Write protection of Sector12 */ | |||
| #define OB_WRP_SECTOR_13 ((uint32_t)0x00002000U) /*!< Write protection of Sector13 */ | |||
| #define OB_WRP_SECTOR_14 ((uint32_t)0x00004000U) /*!< Write protection of Sector14 */ | |||
| #define OB_WRP_SECTOR_15 ((uint32_t)0x00004000U) /*!< Write protection of Sector15 */ | |||
| #define OB_WRP_SECTOR_All ((uint32_t)0x00007FFFU) /*!< Write protection of all Sectors */ | |||
| #endif /* STM32F413xx || STM32F423xx */ | |||
| /*-----------------------------------------------------------------------------------------------------*/ | |||
| /*--------------------------------------- STM32F40xxx/STM32F41xxx -------------------------------------*/ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| @@ -584,6 +634,28 @@ typedef struct | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx|| STM32F439xx || STM32F469xx || STM32F479xx */ | |||
| /*-----------------------------------------------------------------------------------------------------*/ | |||
| /*------------------------------------- STM32F413xx/STM32F423xx ---------------------------------------*/ | |||
| #if defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define OB_PCROP_SECTOR_0 ((uint32_t)0x00000001U) /*!< PC Read/Write protection of Sector0 */ | |||
| #define OB_PCROP_SECTOR_1 ((uint32_t)0x00000002U) /*!< PC Read/Write protection of Sector1 */ | |||
| #define OB_PCROP_SECTOR_2 ((uint32_t)0x00000004U) /*!< PC Read/Write protection of Sector2 */ | |||
| #define OB_PCROP_SECTOR_3 ((uint32_t)0x00000008U) /*!< PC Read/Write protection of Sector3 */ | |||
| #define OB_PCROP_SECTOR_4 ((uint32_t)0x00000010U) /*!< PC Read/Write protection of Sector4 */ | |||
| #define OB_PCROP_SECTOR_5 ((uint32_t)0x00000020U) /*!< PC Read/Write protection of Sector5 */ | |||
| #define OB_PCROP_SECTOR_6 ((uint32_t)0x00000040U) /*!< PC Read/Write protection of Sector6 */ | |||
| #define OB_PCROP_SECTOR_7 ((uint32_t)0x00000080U) /*!< PC Read/Write protection of Sector7 */ | |||
| #define OB_PCROP_SECTOR_8 ((uint32_t)0x00000100U) /*!< PC Read/Write protection of Sector8 */ | |||
| #define OB_PCROP_SECTOR_9 ((uint32_t)0x00000200U) /*!< PC Read/Write protection of Sector9 */ | |||
| #define OB_PCROP_SECTOR_10 ((uint32_t)0x00000400U) /*!< PC Read/Write protection of Sector10 */ | |||
| #define OB_PCROP_SECTOR_11 ((uint32_t)0x00000800U) /*!< PC Read/Write protection of Sector11 */ | |||
| #define OB_PCROP_SECTOR_12 ((uint32_t)0x00001000U) /*!< PC Read/Write protection of Sector12 */ | |||
| #define OB_PCROP_SECTOR_13 ((uint32_t)0x00002000U) /*!< PC Read/Write protection of Sector13 */ | |||
| #define OB_PCROP_SECTOR_14 ((uint32_t)0x00004000U) /*!< PC Read/Write protection of Sector14 */ | |||
| #define OB_PCROP_SECTOR_15 ((uint32_t)0x00004000U) /*!< PC Read/Write protection of Sector15 */ | |||
| #define OB_PCROP_SECTOR_All ((uint32_t)0x00007FFFU) /*!< PC Read/Write protection of all Sectors */ | |||
| #endif /* STM32F413xx || STM32F423xx */ | |||
| /*-----------------------------------------------------------------------------------------------------*/ | |||
| /*--------------------------------------------- STM32F401xC -------------------------------------------*/ | |||
| #if defined(STM32F401xC) | |||
| #define OB_PCROP_SECTOR_0 ((uint32_t)0x00000001U) /*!< PC Read/Write protection of Sector0 */ | |||
| @@ -645,12 +717,12 @@ typedef struct | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ | |||
| defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ | |||
| defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ | |||
| defined(STM32F412Cx) | |||
| defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define OB_PCROP_DESELECTED ((uint8_t)0x00U) /*!< Disabled PcROP, nWPRi bits used for Write Protection on sector i */ | |||
| #define OB_PCROP_SELECTED ((uint8_t)0x80U) /*!< Enable PcROP, nWPRi bits used for PCRoP Protection on sector i */ | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\ | |||
| STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ | |||
| STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -679,14 +751,14 @@ void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit); | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ | |||
| defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ | |||
| defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ | |||
| defined(STM32F412Cx) | |||
| defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| HAL_StatusTypeDef HAL_FLASHEx_AdvOBProgram (FLASH_AdvOBProgramInitTypeDef *pAdvOBInit); | |||
| void HAL_FLASHEx_AdvOBGetConfig(FLASH_AdvOBProgramInitTypeDef *pAdvOBInit); | |||
| HAL_StatusTypeDef HAL_FLASHEx_OB_SelectPCROP(void); | |||
| HAL_StatusTypeDef HAL_FLASHEx_OB_DeSelectPCROP(void); | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\ | |||
| STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ | |||
| STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ | |||
| defined(STM32F469xx) || defined(STM32F479xx) | |||
| @@ -710,6 +782,11 @@ uint16_t HAL_FLASHEx_OB_GetBank2WRP(void); | |||
| #define FLASH_SECTOR_TOTAL 24U | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ | |||
| /*-------------------------------------- STM32F413xx/STM32F423xx ---------------------------------------*/ | |||
| #if defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define FLASH_SECTOR_TOTAL 16U | |||
| #endif /* STM32F413xx || STM32F423xx */ | |||
| /*--------------------------------------- STM32F40xxx/STM32F41xxx -------------------------------------*/ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| @@ -781,12 +858,12 @@ uint16_t HAL_FLASHEx_OB_GetBank2WRP(void); | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ | |||
| defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ | |||
| defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ | |||
| defined(STM32F412Cx) | |||
| defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define IS_PCROPSTATE(VALUE)(((VALUE) == OB_PCROP_STATE_DISABLE) || \ | |||
| ((VALUE) == OB_PCROP_STATE_ENABLE)) | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\ | |||
| STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ | |||
| STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ | |||
| defined(STM32F469xx) || defined(STM32F479xx) | |||
| @@ -796,10 +873,11 @@ uint16_t HAL_FLASHEx_OB_GetBank2WRP(void); | |||
| #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ | |||
| defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ | |||
| defined(STM32F423xx) | |||
| #define IS_OBEX(VALUE)(((VALUE) == OPTIONBYTE_PCROP)) | |||
| #endif /* STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx ||\ | |||
| STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ | |||
| defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) | |||
| @@ -824,7 +902,7 @@ uint16_t HAL_FLASHEx_OB_GetBank2WRP(void); | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ | |||
| defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\ | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_LATENCY_0) || \ | |||
| ((LATENCY) == FLASH_LATENCY_1) || \ | |||
| ((LATENCY) == FLASH_LATENCY_2) || \ | |||
| @@ -834,7 +912,7 @@ uint16_t HAL_FLASHEx_OB_GetBank2WRP(void); | |||
| ((LATENCY) == FLASH_LATENCY_6) || \ | |||
| ((LATENCY) == FLASH_LATENCY_7)) | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F412Zx || STM32F412Vx ||\ | |||
| STM32F412Rx || STM32F412Cx */ | |||
| STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) | |||
| #define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1) || \ | |||
| @@ -845,10 +923,11 @@ uint16_t HAL_FLASHEx_OB_GetBank2WRP(void); | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ | |||
| defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ | |||
| defined(STM32F423xx) | |||
| #define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1)) | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F401xC || STM32F401xE || STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx ||\ | |||
| STM32F412Rx || STM32F412Cx */ | |||
| STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) | |||
| #define IS_FLASH_SECTOR(SECTOR) ( ((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\ | |||
| @@ -865,6 +944,17 @@ uint16_t HAL_FLASHEx_OB_GetBank2WRP(void); | |||
| ((SECTOR) == FLASH_SECTOR_22) || ((SECTOR) == FLASH_SECTOR_23)) | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ | |||
| #if defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define IS_FLASH_SECTOR(SECTOR) ( ((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\ | |||
| ((SECTOR) == FLASH_SECTOR_2) || ((SECTOR) == FLASH_SECTOR_3) ||\ | |||
| ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\ | |||
| ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7) ||\ | |||
| ((SECTOR) == FLASH_SECTOR_8) || ((SECTOR) == FLASH_SECTOR_9) ||\ | |||
| ((SECTOR) == FLASH_SECTOR_10) || ((SECTOR) == FLASH_SECTOR_11) ||\ | |||
| ((SECTOR) == FLASH_SECTOR_12) || ((SECTOR) == FLASH_SECTOR_13) ||\ | |||
| ((SECTOR) == FLASH_SECTOR_14) || ((SECTOR) == FLASH_SECTOR_15)) | |||
| #endif /* STM32F413xx || STM32F423xx */ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| #define IS_FLASH_SECTOR(SECTOR) (((SECTOR) == FLASH_SECTOR_0) || ((SECTOR) == FLASH_SECTOR_1) ||\ | |||
| @@ -901,6 +991,10 @@ uint16_t HAL_FLASHEx_OB_GetBank2WRP(void); | |||
| #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & (uint32_t)0xFF000000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ | |||
| #if defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & (uint32_t)0xFFFF8000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) | |||
| #endif /* STM32F413xx || STM32F423xx */ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) | |||
| #define IS_OB_WRP_SECTOR(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */ | |||
| @@ -922,6 +1016,10 @@ uint16_t HAL_FLASHEx_OB_GetBank2WRP(void); | |||
| #define IS_OB_PCROP(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ | |||
| #if defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define IS_OB_PCROP(SECTOR)((((SECTOR) & (uint32_t)0xFFFF8000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) | |||
| #endif /* STM32F413xx || STM32F423xx */ | |||
| #if defined(STM32F401xC) | |||
| #define IS_OB_PCROP(SECTOR)((((SECTOR) & (uint32_t)0xFFFFF000U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) | |||
| #endif /* STM32F401xC */ | |||
| @@ -944,11 +1042,11 @@ uint16_t HAL_FLASHEx_OB_GetBank2WRP(void); | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Tx) || defined(STM32F410Cx) ||\ | |||
| defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) ||\ | |||
| defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ | |||
| defined(STM32F412Cx) | |||
| defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define IS_OB_PCROP_SELECT(PCROP) (((PCROP) == OB_PCROP_SELECTED) || ((PCROP) == OB_PCROP_DESELECTED)) | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F401xC || STM32F401xE ||\ | |||
| STM32F410xx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ | |||
| STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_flash_ramfunc.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of FLASH RAMFUNC driver. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -0,0 +1,718 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_fmpi2c.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of FMPI2C HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_FMPI2C_H | |||
| #define __STM32F4xx_HAL_FMPI2C_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup FMPI2C | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup FMPI2C_Exported_Types FMPI2C Exported Types | |||
| * @{ | |||
| */ | |||
| /** @defgroup FMPI2C_Configuration_Structure_definition FMPI2C Configuration Structure definition | |||
| * @brief FMPI2C Configuration Structure definition | |||
| * @{ | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t Timing; /*!< Specifies the FMPI2C_TIMINGR_register value. | |||
| This parameter calculated by referring to FMPI2C initialization | |||
| section in Reference manual */ | |||
| uint32_t OwnAddress1; /*!< Specifies the first device own address. | |||
| This parameter can be a 7-bit or 10-bit address. */ | |||
| uint32_t AddressingMode; /*!< Specifies if 7-bit or 10-bit addressing mode is selected. | |||
| This parameter can be a value of @ref FMPI2C_ADDRESSING_MODE */ | |||
| uint32_t DualAddressMode; /*!< Specifies if dual addressing mode is selected. | |||
| This parameter can be a value of @ref FMPI2C_DUAL_ADDRESSING_MODE */ | |||
| uint32_t OwnAddress2; /*!< Specifies the second device own address if dual addressing mode is selected | |||
| This parameter can be a 7-bit address. */ | |||
| uint32_t OwnAddress2Masks; /*!< Specifies the acknowledge mask address second device own address if dual addressing mode is selected | |||
| This parameter can be a value of @ref FMPI2C_OWN_ADDRESS2_MASKS */ | |||
| uint32_t GeneralCallMode; /*!< Specifies if general call mode is selected. | |||
| This parameter can be a value of @ref FMPI2C_GENERAL_CALL_ADDRESSING_MODE */ | |||
| uint32_t NoStretchMode; /*!< Specifies if nostretch mode is selected. | |||
| This parameter can be a value of @ref FMPI2C_NOSTRETCH_MODE */ | |||
| }FMPI2C_InitTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_state_structure_definition HAL state structure definition | |||
| * @brief HAL State structure definition | |||
| * @note HAL FMPI2C State value coding follow below described bitmap : | |||
| * b7-b6 Error information | |||
| * 00 : No Error | |||
| * 01 : Abort (Abort user request on going) | |||
| * 10 : Timeout | |||
| * 11 : Error | |||
| * b5 IP initilisation status | |||
| * 0 : Reset (IP not initialized) | |||
| * 1 : Init done (IP initialized and ready to use. HAL FMPI2C Init function called) | |||
| * b4 (not used) | |||
| * x : Should be set to 0 | |||
| * b3 | |||
| * 0 : Ready or Busy (No Listen mode ongoing) | |||
| * 1 : Listen (IP in Address Listen Mode) | |||
| * b2 Intrinsic process state | |||
| * 0 : Ready | |||
| * 1 : Busy (IP busy with some configuration or internal operations) | |||
| * b1 Rx state | |||
| * 0 : Ready (no Rx operation ongoing) | |||
| * 1 : Busy (Rx operation ongoing) | |||
| * b0 Tx state | |||
| * 0 : Ready (no Tx operation ongoing) | |||
| * 1 : Busy (Tx operation ongoing) | |||
| * @{ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_FMPI2C_STATE_RESET = 0x00U, /*!< Peripheral is not yet Initialized */ | |||
| HAL_FMPI2C_STATE_READY = 0x20U, /*!< Peripheral Initialized and ready for use */ | |||
| HAL_FMPI2C_STATE_BUSY = 0x24U, /*!< An internal process is ongoing */ | |||
| HAL_FMPI2C_STATE_BUSY_TX = 0x21U, /*!< Data Transmission process is ongoing */ | |||
| HAL_FMPI2C_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing */ | |||
| HAL_FMPI2C_STATE_LISTEN = 0x28U, /*!< Address Listen Mode is ongoing */ | |||
| HAL_FMPI2C_STATE_BUSY_TX_LISTEN = 0x29U, /*!< Address Listen Mode and Data Transmission | |||
| process is ongoing */ | |||
| HAL_FMPI2C_STATE_BUSY_RX_LISTEN = 0x2AU, /*!< Address Listen Mode and Data Reception | |||
| process is ongoing */ | |||
| HAL_FMPI2C_STATE_ABORT = 0x60U, /*!< Abort user request ongoing */ | |||
| HAL_FMPI2C_STATE_TIMEOUT = 0xA0U, /*!< Timeout state */ | |||
| HAL_FMPI2C_STATE_ERROR = 0xE0U /*!< Error */ | |||
| }HAL_FMPI2C_StateTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_mode_structure_definition HAL mode structure definition | |||
| * @brief HAL Mode structure definition | |||
| * @note HAL FMPI2C Mode value coding follow below described bitmap : | |||
| * b7 (not used) | |||
| * x : Should be set to 0 | |||
| * b6 | |||
| * 0 : None | |||
| * 1 : Memory (HAL FMPI2C communication is in Memory Mode) | |||
| * b5 | |||
| * 0 : None | |||
| * 1 : Slave (HAL FMPI2C communication is in Slave Mode) | |||
| * b4 | |||
| * 0 : None | |||
| * 1 : Master (HAL FMPI2C communication is in Master Mode) | |||
| * b3-b2-b1-b0 (not used) | |||
| * xxxx : Should be set to 0000 | |||
| * @{ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_FMPI2C_MODE_NONE = 0x00U, /*!< No FMPI2C communication on going */ | |||
| HAL_FMPI2C_MODE_MASTER = 0x10U, /*!< FMPI2C communication is in Master Mode */ | |||
| HAL_FMPI2C_MODE_SLAVE = 0x20U, /*!< FMPI2C communication is in Slave Mode */ | |||
| HAL_FMPI2C_MODE_MEM = 0x40U /*!< FMPI2C communication is in Memory Mode */ | |||
| }HAL_FMPI2C_ModeTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FMPI2C_Error_Code_definition FMPI2C Error Code definition | |||
| * @brief FMPI2C Error Code definition | |||
| * @{ | |||
| */ | |||
| #define HAL_FMPI2C_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */ | |||
| #define HAL_FMPI2C_ERROR_BERR ((uint32_t)0x00000001U) /*!< BERR error */ | |||
| #define HAL_FMPI2C_ERROR_ARLO ((uint32_t)0x00000002U) /*!< ARLO error */ | |||
| #define HAL_FMPI2C_ERROR_AF ((uint32_t)0x00000004U) /*!< ACKF error */ | |||
| #define HAL_FMPI2C_ERROR_OVR ((uint32_t)0x00000008U) /*!< OVR error */ | |||
| #define HAL_FMPI2C_ERROR_DMA ((uint32_t)0x00000010U) /*!< DMA transfer error */ | |||
| #define HAL_FMPI2C_ERROR_TIMEOUT ((uint32_t)0x00000020U) /*!< Timeout error */ | |||
| #define HAL_FMPI2C_ERROR_SIZE ((uint32_t)0x00000040U) /*!< Size Management error */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FMPI2C_handle_Structure_definition FMPI2C handle Structure definition | |||
| * @brief FMPI2C handle Structure definition | |||
| * @{ | |||
| */ | |||
| typedef struct __FMPI2C_HandleTypeDef | |||
| { | |||
| FMPI2C_TypeDef *Instance; /*!< FMPI2C registers base address */ | |||
| FMPI2C_InitTypeDef Init; /*!< FMPI2C communication parameters */ | |||
| uint8_t *pBuffPtr; /*!< Pointer to FMPI2C transfer buffer */ | |||
| uint16_t XferSize; /*!< FMPI2C transfer size */ | |||
| __IO uint16_t XferCount; /*!< FMPI2C transfer counter */ | |||
| __IO uint32_t XferOptions; /*!< FMPI2C sequantial transfer options, this parameter can | |||
| be a value of @ref FMPI2C_XFEROPTIONS */ | |||
| __IO uint32_t PreviousState; /*!< FMPI2C communication Previous state */ | |||
| HAL_StatusTypeDef (*XferISR)(struct __FMPI2C_HandleTypeDef *hfmpi2c, uint32_t ITFlags, uint32_t ITSources); /*!< FMPI2C transfer IRQ handler function pointer */ | |||
| DMA_HandleTypeDef *hdmatx; /*!< FMPI2C Tx DMA handle parameters */ | |||
| DMA_HandleTypeDef *hdmarx; /*!< FMPI2C Rx DMA handle parameters */ | |||
| HAL_LockTypeDef Lock; /*!< FMPI2C locking object */ | |||
| __IO HAL_FMPI2C_StateTypeDef State; /*!< FMPI2C communication state */ | |||
| __IO HAL_FMPI2C_ModeTypeDef Mode; /*!< FMPI2C communication mode */ | |||
| __IO uint32_t ErrorCode; /*!< FMPI2C Error code */ | |||
| __IO uint32_t AddrEventCount; /*!< FMPI2C Address Event counter */ | |||
| }FMPI2C_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup FMPI2C_Exported_Constants FMPI2C Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup FMPI2C_XFEROPTIONS FMPI2C Sequential Transfer Options | |||
| * @{ | |||
| */ | |||
| #define FMPI2C_FIRST_FRAME ((uint32_t)FMPI2C_SOFTEND_MODE) | |||
| #define FMPI2C_NEXT_FRAME ((uint32_t)(FMPI2C_RELOAD_MODE | FMPI2C_SOFTEND_MODE)) | |||
| #define FMPI2C_FIRST_AND_LAST_FRAME ((uint32_t)FMPI2C_AUTOEND_MODE) | |||
| #define FMPI2C_LAST_FRAME ((uint32_t)FMPI2C_AUTOEND_MODE) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FMPI2C_ADDRESSING_MODE FMPI2C Addressing Mode | |||
| * @{ | |||
| */ | |||
| #define FMPI2C_ADDRESSINGMODE_7BIT ((uint32_t)0x00000001U) | |||
| #define FMPI2C_ADDRESSINGMODE_10BIT ((uint32_t)0x00000002U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FMPI2C_DUAL_ADDRESSING_MODE FMPI2C Dual Addressing Mode | |||
| * @{ | |||
| */ | |||
| #define FMPI2C_DUALADDRESS_DISABLE ((uint32_t)0x00000000U) | |||
| #define FMPI2C_DUALADDRESS_ENABLE FMPI2C_OAR2_OA2EN | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FMPI2C_OWN_ADDRESS2_MASKS FMPI2C Own Address2 Masks | |||
| * @{ | |||
| */ | |||
| #define FMPI2C_OA2_NOMASK ((uint8_t)0x00U) | |||
| #define FMPI2C_OA2_MASK01 ((uint8_t)0x01U) | |||
| #define FMPI2C_OA2_MASK02 ((uint8_t)0x02U) | |||
| #define FMPI2C_OA2_MASK03 ((uint8_t)0x03U) | |||
| #define FMPI2C_OA2_MASK04 ((uint8_t)0x04U) | |||
| #define FMPI2C_OA2_MASK05 ((uint8_t)0x05U) | |||
| #define FMPI2C_OA2_MASK06 ((uint8_t)0x06U) | |||
| #define FMPI2C_OA2_MASK07 ((uint8_t)0x07U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FMPI2C_GENERAL_CALL_ADDRESSING_MODE FMPI2C General Call Addressing Mode | |||
| * @{ | |||
| */ | |||
| #define FMPI2C_GENERALCALL_DISABLE ((uint32_t)0x00000000U) | |||
| #define FMPI2C_GENERALCALL_ENABLE FMPI2C_CR1_GCEN | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FMPI2C_NOSTRETCH_MODE FMPI2C No-Stretch Mode | |||
| * @{ | |||
| */ | |||
| #define FMPI2C_NOSTRETCH_DISABLE ((uint32_t)0x00000000U) | |||
| #define FMPI2C_NOSTRETCH_ENABLE FMPI2C_CR1_NOSTRETCH | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FMPI2C_MEMORY_ADDRESS_SIZE FMPI2C Memory Address Size | |||
| * @{ | |||
| */ | |||
| #define FMPI2C_MEMADD_SIZE_8BIT ((uint32_t)0x00000001U) | |||
| #define FMPI2C_MEMADD_SIZE_16BIT ((uint32_t)0x00000002U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FMPI2C_XferDirection FMPI2C Transfer Direction | |||
| * @{ | |||
| */ | |||
| #define FMPI2C_DIRECTION_RECEIVE ((uint32_t)0x00000000U) | |||
| #define FMPI2C_DIRECTION_TRANSMIT ((uint32_t)0x00000001U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FMPI2C_RELOAD_END_MODE FMPI2C Reload End Mode | |||
| * @{ | |||
| */ | |||
| #define FMPI2C_RELOAD_MODE FMPI2C_CR2_RELOAD | |||
| #define FMPI2C_AUTOEND_MODE FMPI2C_CR2_AUTOEND | |||
| #define FMPI2C_SOFTEND_MODE ((uint32_t)0x00000000U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FMPI2C_START_STOP_MODE FMPI2C Start or Stop Mode | |||
| * @{ | |||
| */ | |||
| #define FMPI2C_NO_STARTSTOP ((uint32_t)0x00000000U) | |||
| #define FMPI2C_GENERATE_STOP FMPI2C_CR2_STOP | |||
| #define FMPI2C_GENERATE_START_READ (uint32_t)(FMPI2C_CR2_START | FMPI2C_CR2_RD_WRN) | |||
| #define FMPI2C_GENERATE_START_WRITE FMPI2C_CR2_START | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FMPI2C_Interrupt_configuration_definition FMPI2C Interrupt configuration definition | |||
| * @brief FMPI2C Interrupt definition | |||
| * Elements values convention: 0xXXXXXXXX | |||
| * - XXXXXXXX : Interrupt control mask | |||
| * @{ | |||
| */ | |||
| #define FMPI2C_IT_ERRI FMPI2C_CR1_ERRIE | |||
| #define FMPI2C_IT_TCI FMPI2C_CR1_TCIE | |||
| #define FMPI2C_IT_STOPI FMPI2C_CR1_STOPIE | |||
| #define FMPI2C_IT_NACKI FMPI2C_CR1_NACKIE | |||
| #define FMPI2C_IT_ADDRI FMPI2C_CR1_ADDRIE | |||
| #define FMPI2C_IT_RXI FMPI2C_CR1_RXIE | |||
| #define FMPI2C_IT_TXI FMPI2C_CR1_TXIE | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FMPI2C_Flag_definition FMPI2C Flag definition | |||
| * @{ | |||
| */ | |||
| #define FMPI2C_FLAG_TXE FMPI2C_ISR_TXE | |||
| #define FMPI2C_FLAG_TXIS FMPI2C_ISR_TXIS | |||
| #define FMPI2C_FLAG_RXNE FMPI2C_ISR_RXNE | |||
| #define FMPI2C_FLAG_ADDR FMPI2C_ISR_ADDR | |||
| #define FMPI2C_FLAG_AF FMPI2C_ISR_NACKF | |||
| #define FMPI2C_FLAG_STOPF FMPI2C_ISR_STOPF | |||
| #define FMPI2C_FLAG_TC FMPI2C_ISR_TC | |||
| #define FMPI2C_FLAG_TCR FMPI2C_ISR_TCR | |||
| #define FMPI2C_FLAG_BERR FMPI2C_ISR_BERR | |||
| #define FMPI2C_FLAG_ARLO FMPI2C_ISR_ARLO | |||
| #define FMPI2C_FLAG_OVR FMPI2C_ISR_OVR | |||
| #define FMPI2C_FLAG_PECERR FMPI2C_ISR_PECERR | |||
| #define FMPI2C_FLAG_TIMEOUT FMPI2C_ISR_TIMEOUT | |||
| #define FMPI2C_FLAG_ALERT FMPI2C_ISR_ALERT | |||
| #define FMPI2C_FLAG_BUSY FMPI2C_ISR_BUSY | |||
| #define FMPI2C_FLAG_DIR FMPI2C_ISR_DIR | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macros -----------------------------------------------------------*/ | |||
| /** @defgroup FMPI2C_Exported_Macros FMPI2C Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset FMPI2C handle state. | |||
| * @param __HANDLE__ specifies the FMPI2C Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_FMPI2C_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_FMPI2C_STATE_RESET) | |||
| /** @brief Enable the specified FMPI2C interrupt. | |||
| * @param __HANDLE__ specifies the FMPI2C Handle. | |||
| * @param __INTERRUPT__ specifies the interrupt source to enable. | |||
| * This parameter can be one of the following values: | |||
| * @arg @ref FMPI2C_IT_ERRI Errors interrupt enable | |||
| * @arg @ref FMPI2C_IT_TCI Transfer complete interrupt enable | |||
| * @arg @ref FMPI2C_IT_STOPI STOP detection interrupt enable | |||
| * @arg @ref FMPI2C_IT_NACKI NACK received interrupt enable | |||
| * @arg @ref FMPI2C_IT_ADDRI Address match interrupt enable | |||
| * @arg @ref FMPI2C_IT_RXI RX interrupt enable | |||
| * @arg @ref FMPI2C_IT_TXI TX interrupt enable | |||
| * | |||
| * @retval None | |||
| */ | |||
| #define __HAL_FMPI2C_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR1 |= (__INTERRUPT__)) | |||
| /** @brief Disable the specified FMPI2C interrupt. | |||
| * @param __HANDLE__ specifies the FMPI2C Handle. | |||
| * @param __INTERRUPT__ specifies the interrupt source to disable. | |||
| * This parameter can be one of the following values: | |||
| * @arg @ref FMPI2C_IT_ERRI Errors interrupt enable | |||
| * @arg @ref FMPI2C_IT_TCI Transfer complete interrupt enable | |||
| * @arg @ref FMPI2C_IT_STOPI STOP detection interrupt enable | |||
| * @arg @ref FMPI2C_IT_NACKI NACK received interrupt enable | |||
| * @arg @ref FMPI2C_IT_ADDRI Address match interrupt enable | |||
| * @arg @ref FMPI2C_IT_RXI RX interrupt enable | |||
| * @arg @ref FMPI2C_IT_TXI TX interrupt enable | |||
| * | |||
| * @retval None | |||
| */ | |||
| #define __HAL_FMPI2C_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR1 &= (~(__INTERRUPT__))) | |||
| /** @brief Check whether the specified FMPI2C interrupt source is enabled or not. | |||
| * @param __HANDLE__ specifies the FMPI2C Handle. | |||
| * @param __INTERRUPT__ specifies the FMPI2C interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg @ref FMPI2C_IT_ERRI Errors interrupt enable | |||
| * @arg @ref FMPI2C_IT_TCI Transfer complete interrupt enable | |||
| * @arg @ref FMPI2C_IT_STOPI STOP detection interrupt enable | |||
| * @arg @ref FMPI2C_IT_NACKI NACK received interrupt enable | |||
| * @arg @ref FMPI2C_IT_ADDRI Address match interrupt enable | |||
| * @arg @ref FMPI2C_IT_RXI RX interrupt enable | |||
| * @arg @ref FMPI2C_IT_TXI TX interrupt enable | |||
| * | |||
| * @retval The new state of __INTERRUPT__ (SET or RESET). | |||
| */ | |||
| #define __HAL_FMPI2C_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR1 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) | |||
| /** @brief Check whether the specified FMPI2C flag is set or not. | |||
| * @param __HANDLE__ specifies the FMPI2C Handle. | |||
| * @param __FLAG__ specifies the flag to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg @ref FMPI2C_FLAG_TXE Transmit data register empty | |||
| * @arg @ref FMPI2C_FLAG_TXIS Transmit interrupt status | |||
| * @arg @ref FMPI2C_FLAG_RXNE Receive data register not empty | |||
| * @arg @ref FMPI2C_FLAG_ADDR Address matched (slave mode) | |||
| * @arg @ref FMPI2C_FLAG_AF Acknowledge failure received flag | |||
| * @arg @ref FMPI2C_FLAG_STOPF STOP detection flag | |||
| * @arg @ref FMPI2C_FLAG_TC Transfer complete (master mode) | |||
| * @arg @ref FMPI2C_FLAG_TCR Transfer complete reload | |||
| * @arg @ref FMPI2C_FLAG_BERR Bus error | |||
| * @arg @ref FMPI2C_FLAG_ARLO Arbitration lost | |||
| * @arg @ref FMPI2C_FLAG_OVR Overrun/Underrun | |||
| * @arg @ref FMPI2C_FLAG_PECERR PEC error in reception | |||
| * @arg @ref FMPI2C_FLAG_TIMEOUT Timeout or Tlow detection flag | |||
| * @arg @ref FMPI2C_FLAG_ALERT SMBus alert | |||
| * @arg @ref FMPI2C_FLAG_BUSY Bus busy | |||
| * @arg @ref FMPI2C_FLAG_DIR Transfer direction (slave mode) | |||
| * | |||
| * @retval The new state of __FLAG__ (SET or RESET). | |||
| */ | |||
| #define __HAL_FMPI2C_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) == (__FLAG__)) ? SET : RESET) | |||
| /** @brief Clear the FMPI2C pending flags which are cleared by writing 1 in a specific bit. | |||
| * @param __HANDLE__ specifies the FMPI2C Handle. | |||
| * @param __FLAG__ specifies the flag to clear. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg @ref FMPI2C_FLAG_TXE Transmit data register empty | |||
| * @arg @ref FMPI2C_FLAG_ADDR Address matched (slave mode) | |||
| * @arg @ref FMPI2C_FLAG_AF Acknowledge failure received flag | |||
| * @arg @ref FMPI2C_FLAG_STOPF STOP detection flag | |||
| * @arg @ref FMPI2C_FLAG_BERR Bus error | |||
| * @arg @ref FMPI2C_FLAG_ARLO Arbitration lost | |||
| * @arg @ref FMPI2C_FLAG_OVR Overrun/Underrun | |||
| * @arg @ref FMPI2C_FLAG_PECERR PEC error in reception | |||
| * @arg @ref FMPI2C_FLAG_TIMEOUT Timeout or Tlow detection flag | |||
| * @arg @ref FMPI2C_FLAG_ALERT SMBus alert | |||
| * | |||
| * @retval None | |||
| */ | |||
| #define __HAL_FMPI2C_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__FLAG__) == FMPI2C_FLAG_TXE) ? ((__HANDLE__)->Instance->ISR |= (__FLAG__)) \ | |||
| : ((__HANDLE__)->Instance->ICR = (__FLAG__))) | |||
| /** @brief Enable the specified FMPI2C peripheral. | |||
| * @param __HANDLE__ specifies the FMPI2C Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_FMPI2C_ENABLE(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR1, FMPI2C_CR1_PE)) | |||
| /** @brief Disable the specified FMPI2C peripheral. | |||
| * @param __HANDLE__ specifies the FMPI2C Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_FMPI2C_DISABLE(__HANDLE__) (CLEAR_BIT((__HANDLE__)->Instance->CR1, FMPI2C_CR1_PE)) | |||
| /** @brief Generate a Non-Acknowledge FMPI2C peripheral in Slave mode. | |||
| * @param __HANDLE__: specifies the FMPI2C Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_FMPI2C_GENERATE_NACK(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR2, FMPI2C_CR2_NACK)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Include FMPI2C HAL Extended module */ | |||
| #include "stm32f4xx_hal_fmpi2c_ex.h" | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup FMPI2C_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup FMPI2C_Exported_Functions_Group1 Initialization and de-initialization functions | |||
| * @{ | |||
| */ | |||
| /* Initialization and de-initialization functions******************************/ | |||
| HAL_StatusTypeDef HAL_FMPI2C_Init(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| HAL_StatusTypeDef HAL_FMPI2C_DeInit (FMPI2C_HandleTypeDef *hfmpi2c); | |||
| void HAL_FMPI2C_MspInit(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| void HAL_FMPI2C_MspDeInit(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup FMPI2C_Exported_Functions_Group2 Input and Output operation functions | |||
| * @{ | |||
| */ | |||
| /* IO operation functions ****************************************************/ | |||
| /******* Blocking mode: Polling */ | |||
| HAL_StatusTypeDef HAL_FMPI2C_Master_Transmit(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Master_Receive(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Slave_Transmit(FMPI2C_HandleTypeDef *hfmpi2c, uint8_t *pData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Slave_Receive(FMPI2C_HandleTypeDef *hfmpi2c, uint8_t *pData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Mem_Write(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Mem_Read(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_FMPI2C_IsDeviceReady(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint32_t Trials, uint32_t Timeout); | |||
| /******* Non-Blocking mode: Interrupt */ | |||
| HAL_StatusTypeDef HAL_FMPI2C_Master_Transmit_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Master_Receive_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Slave_Transmit_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Slave_Receive_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Mem_Write_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Mem_Read_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Master_Sequential_Transmit_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Master_Sequential_Receive_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Slave_Sequential_Transmit_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Slave_Sequential_Receive_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions); | |||
| HAL_StatusTypeDef HAL_FMPI2C_EnableListen_IT(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| HAL_StatusTypeDef HAL_FMPI2C_DisableListen_IT(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Master_Abort_IT(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress); | |||
| /******* Non-Blocking mode: DMA */ | |||
| HAL_StatusTypeDef HAL_FMPI2C_Master_Transmit_DMA(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Master_Receive_DMA(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Slave_Transmit_DMA(FMPI2C_HandleTypeDef *hfmpi2c, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Slave_Receive_DMA(FMPI2C_HandleTypeDef *hfmpi2c, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Mem_Write_DMA(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_FMPI2C_Mem_Read_DMA(FMPI2C_HandleTypeDef *hfmpi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup FMPI2C_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks | |||
| * @{ | |||
| */ | |||
| /******* FMPI2C IRQHandler and Callbacks used in non blocking modes (Interrupt and DMA) */ | |||
| void HAL_FMPI2C_EV_IRQHandler(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| void HAL_FMPI2C_ER_IRQHandler(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| void HAL_FMPI2C_MasterTxCpltCallback(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| void HAL_FMPI2C_MasterRxCpltCallback(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| void HAL_FMPI2C_SlaveTxCpltCallback(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| void HAL_FMPI2C_SlaveRxCpltCallback(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| void HAL_FMPI2C_AddrCallback(FMPI2C_HandleTypeDef *hfmpi2c, uint8_t TransferDirection, uint16_t AddrMatchCode); | |||
| void HAL_FMPI2C_ListenCpltCallback(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| void HAL_FMPI2C_MemTxCpltCallback(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| void HAL_FMPI2C_MemRxCpltCallback(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| void HAL_FMPI2C_ErrorCallback(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| void HAL_FMPI2C_AbortCpltCallback(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup FMPI2C_Exported_Functions_Group3 Peripheral State, Mode and Error functions | |||
| * @{ | |||
| */ | |||
| /* Peripheral State, Mode and Error functions *********************************/ | |||
| HAL_FMPI2C_StateTypeDef HAL_FMPI2C_GetState(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| HAL_FMPI2C_ModeTypeDef HAL_FMPI2C_GetMode(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| uint32_t HAL_FMPI2C_GetError(FMPI2C_HandleTypeDef *hfmpi2c); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup FMPI2C_Private_Constants FMPI2C Private Constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup FMPI2C_Private_Macro FMPI2C Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_FMPI2C_ADDRESSING_MODE(MODE) (((MODE) == FMPI2C_ADDRESSINGMODE_7BIT) || \ | |||
| ((MODE) == FMPI2C_ADDRESSINGMODE_10BIT)) | |||
| #define IS_FMPI2C_DUAL_ADDRESS(ADDRESS) (((ADDRESS) == FMPI2C_DUALADDRESS_DISABLE) || \ | |||
| ((ADDRESS) == FMPI2C_DUALADDRESS_ENABLE)) | |||
| #define IS_FMPI2C_OWN_ADDRESS2_MASK(MASK) (((MASK) == FMPI2C_OA2_NOMASK) || \ | |||
| ((MASK) == FMPI2C_OA2_MASK01) || \ | |||
| ((MASK) == FMPI2C_OA2_MASK02) || \ | |||
| ((MASK) == FMPI2C_OA2_MASK03) || \ | |||
| ((MASK) == FMPI2C_OA2_MASK04) || \ | |||
| ((MASK) == FMPI2C_OA2_MASK05) || \ | |||
| ((MASK) == FMPI2C_OA2_MASK06) || \ | |||
| ((MASK) == FMPI2C_OA2_MASK07)) | |||
| #define IS_FMPI2C_GENERAL_CALL(CALL) (((CALL) == FMPI2C_GENERALCALL_DISABLE) || \ | |||
| ((CALL) == FMPI2C_GENERALCALL_ENABLE)) | |||
| #define IS_FMPI2C_NO_STRETCH(STRETCH) (((STRETCH) == FMPI2C_NOSTRETCH_DISABLE) || \ | |||
| ((STRETCH) == FMPI2C_NOSTRETCH_ENABLE)) | |||
| #define IS_FMPI2C_MEMADD_SIZE(SIZE) (((SIZE) == FMPI2C_MEMADD_SIZE_8BIT) || \ | |||
| ((SIZE) == FMPI2C_MEMADD_SIZE_16BIT)) | |||
| #define IS_TRANSFER_MODE(MODE) (((MODE) == FMPI2C_RELOAD_MODE) || \ | |||
| ((MODE) == FMPI2C_AUTOEND_MODE) || \ | |||
| ((MODE) == FMPI2C_SOFTEND_MODE)) | |||
| #define IS_TRANSFER_REQUEST(REQUEST) (((REQUEST) == FMPI2C_GENERATE_STOP) || \ | |||
| ((REQUEST) == FMPI2C_GENERATE_START_READ) || \ | |||
| ((REQUEST) == FMPI2C_GENERATE_START_WRITE) || \ | |||
| ((REQUEST) == FMPI2C_NO_STARTSTOP)) | |||
| #define IS_FMPI2C_TRANSFER_OPTIONS_REQUEST(REQUEST) (((REQUEST) == FMPI2C_FIRST_FRAME) || \ | |||
| ((REQUEST) == FMPI2C_NEXT_FRAME) || \ | |||
| ((REQUEST) == FMPI2C_FIRST_AND_LAST_FRAME) || \ | |||
| ((REQUEST) == FMPI2C_LAST_FRAME)) | |||
| #define FMPI2C_RESET_CR2(__HANDLE__) ((__HANDLE__)->Instance->CR2 &= (uint32_t)~((uint32_t)(FMPI2C_CR2_SADD | FMPI2C_CR2_HEAD10R | FMPI2C_CR2_NBYTES | FMPI2C_CR2_RELOAD | FMPI2C_CR2_RD_WRN))) | |||
| #define FMPI2C_GET_ADDR_MATCH(__HANDLE__) (((__HANDLE__)->Instance->ISR & FMPI2C_ISR_ADDCODE) >> 16) | |||
| #define FMPI2C_GET_DIR(__HANDLE__) (((__HANDLE__)->Instance->ISR & FMPI2C_ISR_DIR) >> 16) | |||
| #define FMPI2C_GET_STOP_MODE(__HANDLE__) ((__HANDLE__)->Instance->CR2 & FMPI2C_CR2_AUTOEND) | |||
| #define FMPI2C_GET_OWN_ADDRESS1(__HANDLE__) ((__HANDLE__)->Instance->OAR1 & FMPI2C_OAR1_OA1) | |||
| #define FMPI2C_GET_OWN_ADDRESS2(__HANDLE__) ((__HANDLE__)->Instance->OAR2 & FMPI2C_OAR2_OA2) | |||
| #define IS_FMPI2C_OWN_ADDRESS1(ADDRESS1) ((ADDRESS1) <= (uint32_t)0x000003FFU) | |||
| #define IS_FMPI2C_OWN_ADDRESS2(ADDRESS2) ((ADDRESS2) <= (uint16_t)0x00FFU) | |||
| #define FMPI2C_MEM_ADD_MSB(__ADDRESS__) ((uint8_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0xFF00U))) >> 8U))) | |||
| #define FMPI2C_MEM_ADD_LSB(__ADDRESS__) ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)(0x00FFU)))) | |||
| #define FMPI2C_GENERATE_START(__ADDMODE__,__ADDRESS__) (((__ADDMODE__) == FMPI2C_ADDRESSINGMODE_7BIT) ? (uint32_t)((((uint32_t)(__ADDRESS__) & (FMPI2C_CR2_SADD)) | (FMPI2C_CR2_START) | (FMPI2C_CR2_AUTOEND)) & (~FMPI2C_CR2_RD_WRN)) : \ | |||
| (uint32_t)((((uint32_t)(__ADDRESS__) & (FMPI2C_CR2_SADD)) | (FMPI2C_CR2_ADD10) | (FMPI2C_CR2_START)) & (~FMPI2C_CR2_RD_WRN))) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private Functions ---------------------------------------------------------*/ | |||
| /** @defgroup FMPI2C_Private_Functions FMPI2C Private Functions | |||
| * @{ | |||
| */ | |||
| /* Private functions are defined in stm32f4xx_hal_fmpi2c.c file */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F410xx || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_FMPI2C_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,163 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_fmpi2c_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of FMPI2C HAL Extended module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_FMPI2C_EX_H | |||
| #define __STM32F4xx_HAL_FMPI2C_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup FMPI2CEx | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup FMPI2CEx_Exported_Constants FMPI2C Extended Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup FMPI2CEx_Analog_Filter FMPI2C Extended Analog Filter | |||
| * @{ | |||
| */ | |||
| #define FMPI2C_ANALOGFILTER_ENABLE ((uint32_t)0x00000000U) | |||
| #define FMPI2C_ANALOGFILTER_DISABLE FMPI2C_CR1_ANFOFF | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FMPI2CEx_FastModePlus FMPI2C Extended Fast Mode Plus | |||
| * @{ | |||
| */ | |||
| #define FMPI2C_FASTMODEPLUS_SCL SYSCFG_CFGR_FMPI2C1_SCL /*!< Enable Fast Mode Plus on FMPI2C1 SCL pins */ | |||
| #define FMPI2C_FASTMODEPLUS_SDA SYSCFG_CFGR_FMPI2C1_SDA /*!< Enable Fast Mode Plus on FMPI2C1 SDA pins */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup FMPI2CEx_Exported_Functions FMPI2C Extended Exported Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup FMPI2CEx_Exported_Functions_Group1 Extended features functions | |||
| * @brief Extended features functions | |||
| * @{ | |||
| */ | |||
| /* Peripheral Control functions ************************************************/ | |||
| HAL_StatusTypeDef HAL_FMPI2CEx_ConfigAnalogFilter(FMPI2C_HandleTypeDef *hfmpi2c, uint32_t AnalogFilter); | |||
| HAL_StatusTypeDef HAL_FMPI2CEx_ConfigDigitalFilter(FMPI2C_HandleTypeDef *hfmpi2c, uint32_t DigitalFilter); | |||
| void HAL_FMPI2CEx_EnableFastModePlus(uint32_t ConfigFastModePlus); | |||
| void HAL_FMPI2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus); | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup FMPI2CEx_Private_Constants FMPI2C Extended Private Constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup FMPI2CEx_Private_Macro FMPI2C Extended Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_FMPI2C_ANALOG_FILTER(FILTER) (((FILTER) == FMPI2C_ANALOGFILTER_ENABLE) || \ | |||
| ((FILTER) == FMPI2C_ANALOGFILTER_DISABLE)) | |||
| #define IS_FMPI2C_DIGITAL_FILTER(FILTER) ((FILTER) <= 0x0000000FU) | |||
| #define IS_FMPI2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & (FMPI2C_FASTMODEPLUS_SCL)) == FMPI2C_FASTMODEPLUS_SCL) || \ | |||
| (((__CONFIG__) & (FMPI2C_FASTMODEPLUS_SDA)) == FMPI2C_FASTMODEPLUS_SDA)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private Functions ---------------------------------------------------------*/ | |||
| /** @defgroup FMPI2CEx_Private_Functions FMPI2C Extended Private Functions | |||
| * @{ | |||
| */ | |||
| /* Private functions are defined in stm32f4xx_hal_fmpi2c_ex.c file */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F410xx || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_FMPI2C_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_gpio.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of GPIO HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_gpio_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of GPIO HAL Extension module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -696,6 +696,141 @@ | |||
| */ | |||
| #define GPIO_AF15_EVENTOUT ((uint8_t)0x0FU) /* EVENTOUT Alternate Function mapping */ | |||
| #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| /*----------------------------------------------------------------------------*/ | |||
| /*--------------- STM32F413xx/STM32F423xx-------------------------------------*/ | |||
| #if defined(STM32F413xx) || defined(STM32F423xx) | |||
| /** | |||
| * @brief AF 0 selection | |||
| */ | |||
| #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00U) /* RTC_50Hz Alternate Function mapping */ | |||
| #define GPIO_AF0_MCO ((uint8_t)0x00U) /* MCO (MCO1 and MCO2) Alternate Function mapping */ | |||
| #define GPIO_AF0_SWJ ((uint8_t)0x00U) /* SWJ (SWD and JTAG) Alternate Function mapping */ | |||
| #define GPIO_AF0_TRACE ((uint8_t)0x00U) /* TRACE Alternate Function mapping */ | |||
| /** | |||
| * @brief AF 1 selection | |||
| */ | |||
| #define GPIO_AF1_TIM1 ((uint8_t)0x01U) /* TIM1 Alternate Function mapping */ | |||
| #define GPIO_AF1_TIM2 ((uint8_t)0x01U) /* TIM2 Alternate Function mapping */ | |||
| #define GPIO_AF1_LPTIM1 ((uint8_t)0x01U) /* LPTIM1 Alternate Function mapping */ | |||
| /** | |||
| * @brief AF 2 selection | |||
| */ | |||
| #define GPIO_AF2_TIM3 ((uint8_t)0x02U) /* TIM3 Alternate Function mapping */ | |||
| #define GPIO_AF2_TIM4 ((uint8_t)0x02U) /* TIM4 Alternate Function mapping */ | |||
| #define GPIO_AF2_TIM5 ((uint8_t)0x02U) /* TIM5 Alternate Function mapping */ | |||
| /** | |||
| * @brief AF 3 selection | |||
| */ | |||
| #define GPIO_AF3_TIM8 ((uint8_t)0x03U) /* TIM8 Alternate Function mapping */ | |||
| #define GPIO_AF3_TIM9 ((uint8_t)0x03U) /* TIM9 Alternate Function mapping */ | |||
| #define GPIO_AF3_TIM10 ((uint8_t)0x03U) /* TIM10 Alternate Function mapping */ | |||
| #define GPIO_AF3_TIM11 ((uint8_t)0x03U) /* TIM11 Alternate Function mapping */ | |||
| #define GPIO_AF3_DFSDM2 ((uint8_t)0x03U) /* DFSDM2 Alternate Function mapping */ | |||
| /** | |||
| * @brief AF 4 selection | |||
| */ | |||
| #define GPIO_AF4_I2C1 ((uint8_t)0x04U) /* I2C1 Alternate Function mapping */ | |||
| #define GPIO_AF4_I2C2 ((uint8_t)0x04U) /* I2C2 Alternate Function mapping */ | |||
| #define GPIO_AF4_I2C3 ((uint8_t)0x04U) /* I2C3 Alternate Function mapping */ | |||
| #define GPIO_AF4_FMPI2C1 ((uint8_t)0x04U) /* FMPI2C1 Alternate Function mapping */ | |||
| /** | |||
| * @brief AF 5 selection | |||
| */ | |||
| #define GPIO_AF5_SPI1 ((uint8_t)0x05U) /* SPI1/I2S1 Alternate Function mapping */ | |||
| #define GPIO_AF5_SPI2 ((uint8_t)0x05U) /* SPI2/I2S2 Alternate Function mapping */ | |||
| #define GPIO_AF5_SPI3 ((uint8_t)0x05U) /* SPI3/I2S3 Alternate Function mapping */ | |||
| #define GPIO_AF5_SPI4 ((uint8_t)0x05U) /* SPI4/I2S4 Alternate Function mapping */ | |||
| #define GPIO_AF5_I2S3ext ((uint8_t)0x05U) /* I2S3ext_SD Alternate Function mapping */ | |||
| /** | |||
| * @brief AF 6 selection | |||
| */ | |||
| #define GPIO_AF6_SPI2 ((uint8_t)0x06U) /* I2S2 Alternate Function mapping */ | |||
| #define GPIO_AF6_SPI3 ((uint8_t)0x06U) /* SPI3/I2S3 Alternate Function mapping */ | |||
| #define GPIO_AF6_SPI4 ((uint8_t)0x06U) /* SPI4/I2S4 Alternate Function mapping */ | |||
| #define GPIO_AF6_SPI5 ((uint8_t)0x06U) /* SPI5/I2S5 Alternate Function mapping */ | |||
| #define GPIO_AF6_I2S2ext ((uint8_t)0x06U) /* I2S2ext_SD Alternate Function mapping */ | |||
| #define GPIO_AF6_DFSDM1 ((uint8_t)0x06U) /* DFSDM1 Alternate Function mapping */ | |||
| #define GPIO_AF6_DFSDM2 ((uint8_t)0x06U) /* DFSDM2 Alternate Function mapping */ | |||
| /** | |||
| * @brief AF 7 selection | |||
| */ | |||
| #define GPIO_AF7_SPI3 ((uint8_t)0x07U) /* SPI3/I2S3 Alternate Function mapping */ | |||
| #define GPIO_AF7_SAI1 ((uint8_t)0x07U) /* SAI1 Alternate Function mapping */ | |||
| #define GPIO_AF7_USART1 ((uint8_t)0x07U) /* USART1 Alternate Function mapping */ | |||
| #define GPIO_AF7_USART2 ((uint8_t)0x07U) /* USART2 Alternate Function mapping */ | |||
| #define GPIO_AF7_USART3 ((uint8_t)0x07U) /* USART3 Alternate Function mapping */ | |||
| #define GPIO_AF7_I2S3ext ((uint8_t)0x07U) /* I2S3ext_SD Alternate Function mapping */ | |||
| #define GPIO_AF7_DFSDM2 ((uint8_t)0x07U) /* DFSDM2 Alternate Function mapping */ | |||
| /** | |||
| * @brief AF 8 selection | |||
| */ | |||
| #define GPIO_AF8_USART6 ((uint8_t)0x08U) /* USART6 Alternate Function mapping */ | |||
| #define GPIO_AF8_USART3 ((uint8_t)0x08U) /* USART3 Alternate Function mapping */ | |||
| #define GPIO_AF8_UART4 ((uint8_t)0x08U) /* UART4 Alternate Function mapping */ | |||
| #define GPIO_AF8_UART5 ((uint8_t)0x08U) /* UART5 Alternate Function mapping */ | |||
| #define GPIO_AF8_UART7 ((uint8_t)0x08U) /* UART8 Alternate Function mapping */ | |||
| #define GPIO_AF8_UART8 ((uint8_t)0x08U) /* UART8 Alternate Function mapping */ | |||
| #define GPIO_AF8_DFSDM1 ((uint8_t)0x08U) /* DFSDM1 Alternate Function mapping */ | |||
| #define GPIO_AF8_CAN1 ((uint8_t)0x08U) /* CAN1 Alternate Function mapping */ | |||
| /** | |||
| * @brief AF 9 selection | |||
| */ | |||
| #define GPIO_AF9_TIM12 ((uint8_t)0x09U) /* TIM12 Alternate Function mapping */ | |||
| #define GPIO_AF9_TIM13 ((uint8_t)0x09U) /* TIM13 Alternate Function mapping */ | |||
| #define GPIO_AF9_TIM14 ((uint8_t)0x09U) /* TIM14 Alternate Function mapping */ | |||
| #define GPIO_AF9_I2C2 ((uint8_t)0x09U) /* I2C2 Alternate Function mapping */ | |||
| #define GPIO_AF9_I2C3 ((uint8_t)0x09U) /* I2C3 Alternate Function mapping */ | |||
| #define GPIO_AF9_FMPI2C1 ((uint8_t)0x09U) /* FMPI2C1 Alternate Function mapping */ | |||
| #define GPIO_AF9_CAN1 ((uint8_t)0x09U) /* CAN1 Alternate Function mapping */ | |||
| #define GPIO_AF9_CAN2 ((uint8_t)0x09U) /* CAN1 Alternate Function mapping */ | |||
| #define GPIO_AF9_QSPI ((uint8_t)0x09U) /* QSPI Alternate Function mapping */ | |||
| /** | |||
| * @brief AF 10 selection | |||
| */ | |||
| #define GPIO_AF10_SAI1 ((uint8_t)0x0AU) /* SAI1 Alternate Function mapping */ | |||
| #define GPIO_AF10_OTG_FS ((uint8_t)0x0AU) /* OTG_FS Alternate Function mapping */ | |||
| #define GPIO_AF10_DFSDM1 ((uint8_t)0x0AU) /* DFSDM1 Alternate Function mapping */ | |||
| #define GPIO_AF10_DFSDM2 ((uint8_t)0x0AU) /* DFSDM2 Alternate Function mapping */ | |||
| #define GPIO_AF10_QSPI ((uint8_t)0x0AU) /* QSPI Alternate Function mapping */ | |||
| #define GPIO_AF10_FSMC ((uint8_t)0x0AU) /* FSMC Alternate Function mapping */ | |||
| /** | |||
| * @brief AF 11 selection | |||
| */ | |||
| #define GPIO_AF11_UART4 ((uint8_t)0x0BU) /* UART4 Alternate Function mapping */ | |||
| #define GPIO_AF11_UART5 ((uint8_t)0x0BU) /* UART5 Alternate Function mapping */ | |||
| #define GPIO_AF11_UART9 ((uint8_t)0x0BU) /* UART9 Alternate Function mapping */ | |||
| #define GPIO_AF11_UART10 ((uint8_t)0x0BU) /* UART10 Alternate Function mapping */ | |||
| #define GPIO_AF11_CAN3 ((uint8_t)0x0BU) /* CAN3 Alternate Function mapping */ | |||
| /** | |||
| * @brief AF 12 selection | |||
| */ | |||
| #define GPIO_AF12_SDIO ((uint8_t)0x0CU) /* SDIO Alternate Function mapping */ | |||
| #define GPIO_AF12_FSMC ((uint8_t)0x0CU) /* FMC Alternate Function mapping */ | |||
| /** | |||
| * @brief AF 14 selection | |||
| */ | |||
| #define GPIO_AF14_RNG ((uint8_t)0x0EU) /* RNG Alternate Function mapping */ | |||
| /** | |||
| * @brief AF 15 selection | |||
| */ | |||
| #define GPIO_AF15_EVENTOUT ((uint8_t)0x0FU) /* EVENTOUT Alternate Function mapping */ | |||
| #endif /* STM32F413xx || STM32F423xx */ | |||
| /*---------------------------------------- STM32F411xx------------------------*/ | |||
| #if defined(STM32F411xE) | |||
| /** | |||
| @@ -1185,7 +1320,7 @@ | |||
| ((__GPIOx__) == (GPIOE))? 4U : 7U) | |||
| #endif /* STM32F401xC || STM32F401xE || STM32F411xE */ | |||
| #if defined(STM32F446xx) || defined(STM32F412Zx) ||defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| #if defined(STM32F446xx) || defined(STM32F412Zx) ||defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define GPIO_GET_INDEX(__GPIOx__) (uint8_t)(((__GPIOx__) == (GPIOA))? 0U :\ | |||
| ((__GPIOx__) == (GPIOB))? 1U :\ | |||
| ((__GPIOx__) == (GPIOC))? 2U :\ | |||
| @@ -1193,7 +1328,7 @@ | |||
| ((__GPIOx__) == (GPIOE))? 4U :\ | |||
| ((__GPIOx__) == (GPIOF))? 5U :\ | |||
| ((__GPIOx__) == (GPIOG))? 6U : 7U) | |||
| #endif /* STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| #endif /* STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| @@ -1416,6 +1551,12 @@ | |||
| #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| /*----------------------------------------------------------------------------*/ | |||
| /*------------------STM32F413xx/STM32F423xx-----------------------------------*/ | |||
| #if defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define IS_GPIO_AF(AF) (((AF) < 16U) && ((AF) != 13U)) | |||
| #endif /* STM32F413xx || STM32F423xx */ | |||
| /*----------------------------------------------------------------------------*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -0,0 +1,451 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_hash.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of HASH HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_HASH_H | |||
| #define __STM32F4xx_HAL_HASH_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #if defined(STM32F415xx) || defined(STM32F417xx) || defined(STM32F437xx) || defined(STM32F439xx) || defined(STM32F479xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup HASH | |||
| * @brief HASH HAL module driver | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup HASH_Exported_Types HASH Exported Types | |||
| * @{ | |||
| */ | |||
| /** @defgroup HASH_Exported_Types_Group1 HASH Configuration Structure definition | |||
| * @{ | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t DataType; /*!< 32-bit data, 16-bit data, 8-bit data or 1-bit string. | |||
| This parameter can be a value of @ref HASH_Data_Type */ | |||
| uint32_t KeySize; /*!< The key size is used only in HMAC operation */ | |||
| uint8_t* pKey; /*!< The key is used only in HMAC operation */ | |||
| }HASH_InitTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HASH_Exported_Types_Group2 HASH State structures definition | |||
| * @{ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_HASH_STATE_RESET = 0x00U, /*!< HASH not yet initialized or disabled */ | |||
| HAL_HASH_STATE_READY = 0x01U, /*!< HASH initialized and ready for use */ | |||
| HAL_HASH_STATE_BUSY = 0x02U, /*!< HASH internal process is ongoing */ | |||
| HAL_HASH_STATE_TIMEOUT = 0x03U, /*!< HASH timeout state */ | |||
| HAL_HASH_STATE_ERROR = 0x04U /*!< HASH error state */ | |||
| }HAL_HASH_StateTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HASH_Exported_Types_Group3 HASH phase structures definition | |||
| * @{ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_HASH_PHASE_READY = 0x01U, /*!< HASH peripheral is ready for initialization */ | |||
| HAL_HASH_PHASE_PROCESS = 0x02U /*!< HASH peripheral is in processing phase */ | |||
| }HAL_HASH_PhaseTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HASH_Exported_Types_Group4 HASH Handle structures definition | |||
| * @{ | |||
| */ | |||
| typedef struct | |||
| { | |||
| HASH_InitTypeDef Init; /*!< HASH required parameters */ | |||
| uint8_t *pHashInBuffPtr; /*!< Pointer to input buffer */ | |||
| uint8_t *pHashOutBuffPtr; /*!< Pointer to input buffer */ | |||
| __IO uint32_t HashBuffSize; /*!< Size of buffer to be processed */ | |||
| __IO uint32_t HashInCount; /*!< Counter of inputed data */ | |||
| __IO uint32_t HashITCounter; /*!< Counter of issued interrupts */ | |||
| HAL_StatusTypeDef Status; /*!< HASH peripheral status */ | |||
| HAL_HASH_PhaseTypeDef Phase; /*!< HASH peripheral phase */ | |||
| DMA_HandleTypeDef *hdmain; /*!< HASH In DMA handle parameters */ | |||
| HAL_LockTypeDef Lock; /*!< HASH locking object */ | |||
| __IO HAL_HASH_StateTypeDef State; /*!< HASH peripheral state */ | |||
| } HASH_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup HASH_Exported_Constants HASH Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup HASH_Exported_Constants_Group1 HASH Algorithm Selection | |||
| * @{ | |||
| */ | |||
| #define HASH_ALGOSELECTION_SHA1 ((uint32_t)0x00000000U) /*!< HASH function is SHA1 */ | |||
| #define HASH_ALGOSELECTION_SHA224 HASH_CR_ALGO_1 /*!< HASH function is SHA224 */ | |||
| #define HASH_ALGOSELECTION_SHA256 HASH_CR_ALGO /*!< HASH function is SHA256 */ | |||
| #define HASH_ALGOSELECTION_MD5 HASH_CR_ALGO_0 /*!< HASH function is MD5 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HASH_Exported_Constants_Group2 HASH Algorithm Mode | |||
| * @{ | |||
| */ | |||
| #define HASH_ALGOMODE_HASH ((uint32_t)0x00000000U) /*!< Algorithm is HASH */ | |||
| #define HASH_ALGOMODE_HMAC HASH_CR_MODE /*!< Algorithm is HMAC */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HASH_Data_Type HASH Data Type | |||
| * @{ | |||
| */ | |||
| #define HASH_DATATYPE_32B ((uint32_t)0x00000000U) /*!< 32-bit data. No swapping */ | |||
| #define HASH_DATATYPE_16B HASH_CR_DATATYPE_0 /*!< 16-bit data. Each half word is swapped */ | |||
| #define HASH_DATATYPE_8B HASH_CR_DATATYPE_1 /*!< 8-bit data. All bytes are swapped */ | |||
| #define HASH_DATATYPE_1B HASH_CR_DATATYPE /*!< 1-bit data. In the word all bits are swapped */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HASH_Exported_Constants_Group4 HASH HMAC Long key | |||
| * @brief HASH HMAC Long key used only for HMAC mode | |||
| * @{ | |||
| */ | |||
| #define HASH_HMAC_KEYTYPE_SHORTKEY ((uint32_t)0x00000000U) /*!< HMAC Key is <= 64 bytes */ | |||
| #define HASH_HMAC_KEYTYPE_LONGKEY HASH_CR_LKEY /*!< HMAC Key is > 64 bytes */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HASH_Exported_Constants_Group5 HASH Flags definition | |||
| * @{ | |||
| */ | |||
| #define HASH_FLAG_DINIS HASH_SR_DINIS /*!< 16 locations are free in the DIN : A new block can be entered into the input buffer */ | |||
| #define HASH_FLAG_DCIS HASH_SR_DCIS /*!< Digest calculation complete */ | |||
| #define HASH_FLAG_DMAS HASH_SR_DMAS /*!< DMA interface is enabled (DMAE=1) or a transfer is ongoing */ | |||
| #define HASH_FLAG_BUSY HASH_SR_BUSY /*!< The hash core is Busy : processing a block of data */ | |||
| #define HASH_FLAG_DINNE HASH_CR_DINNE /*!< DIN not empty : The input buffer contains at least one word of data */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HASH_Exported_Constants_Group6 HASH Interrupts definition | |||
| * @{ | |||
| */ | |||
| #define HASH_IT_DINI HASH_IMR_DINIE /*!< A new block can be entered into the input buffer (DIN) */ | |||
| #define HASH_IT_DCI HASH_IMR_DCIE /*!< Digest calculation complete */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup HASH_Exported_Macros HASH Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset HASH handle state | |||
| * @param __HANDLE__: specifies the HASH handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_HASH_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_HASH_STATE_RESET) | |||
| /** @brief Check whether the specified HASH flag is set or not. | |||
| * @param __FLAG__: specifies the flag to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg HASH_FLAG_DINIS: A new block can be entered into the input buffer. | |||
| * @arg HASH_FLAG_DCIS: Digest calculation complete | |||
| * @arg HASH_FLAG_DMAS: DMA interface is enabled (DMAE=1) or a transfer is ongoing | |||
| * @arg HASH_FLAG_BUSY: The hash core is Busy : processing a block of data | |||
| * @arg HASH_FLAG_DINNE: DIN not empty : The input buffer contains at least one word of data | |||
| * @retval The new state of __FLAG__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_HASH_GET_FLAG(__FLAG__) (((__FLAG__) > 8U) ? ((HASH->CR & (__FLAG__)) == (__FLAG__)) :\ | |||
| ((HASH->SR & (__FLAG__)) == (__FLAG__))) | |||
| /** | |||
| * @brief Enable the multiple DMA mode. | |||
| * This feature is available only in STM32F429x and STM32F439x devices. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_HASH_SET_MDMAT() HASH->CR |= HASH_CR_MDMAT | |||
| /** | |||
| * @brief Disable the multiple DMA mode. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_HASH_RESET_MDMAT() HASH->CR &= (uint32_t)(~HASH_CR_MDMAT) | |||
| /** | |||
| * @brief Start the digest computation | |||
| * @retval None | |||
| */ | |||
| #define __HAL_HASH_START_DIGEST() HASH->STR |= HASH_STR_DCAL | |||
| /** | |||
| * @brief Set the number of valid bits in last word written in Data register | |||
| * @param SIZE: size in byte of last data written in Data register. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_HASH_SET_NBVALIDBITS(SIZE) do{HASH->STR &= ~(HASH_STR_NBLW);\ | |||
| HASH->STR |= 8U * ((SIZE) % 4U);\ | |||
| }while(0) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Include HASH HAL Extension module */ | |||
| #include "stm32f4xx_hal_hash_ex.h" | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @defgroup HASH_Exported_Functions HASH Exported Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup HASH_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_HASH_Init(HASH_HandleTypeDef *hhash); | |||
| HAL_StatusTypeDef HAL_HASH_DeInit(HASH_HandleTypeDef *hhash); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup HASH_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_HASH_SHA1_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_HASH_MD5_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_HASH_MD5_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| HAL_StatusTypeDef HAL_HASH_SHA1_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup HASH_Exported_Functions_Group3 | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_HMAC_SHA1_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_HMAC_MD5_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup HASH_Exported_Functions_Group4 | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_HASH_SHA1_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer); | |||
| HAL_StatusTypeDef HAL_HASH_MD5_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup HASH_Exported_Functions_Group5 | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_HASH_SHA1_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| HAL_StatusTypeDef HAL_HASH_SHA1_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_HASH_MD5_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| HAL_StatusTypeDef HAL_HASH_MD5_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup HASH_Exported_Functions_Group6 | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_HMAC_SHA1_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| HAL_StatusTypeDef HAL_HMAC_MD5_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup HASH_Exported_Functions_Group7 | |||
| * @{ | |||
| */ | |||
| void HAL_HASH_IRQHandler(HASH_HandleTypeDef *hhash); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup HASH_Exported_Functions_Group8 | |||
| * @{ | |||
| */ | |||
| HAL_HASH_StateTypeDef HAL_HASH_GetState(HASH_HandleTypeDef *hhash); | |||
| void HAL_HASH_MspInit(HASH_HandleTypeDef *hhash); | |||
| void HAL_HASH_MspDeInit(HASH_HandleTypeDef *hhash); | |||
| void HAL_HASH_InCpltCallback(HASH_HandleTypeDef *hhash); | |||
| void HAL_HASH_DgstCpltCallback(HASH_HandleTypeDef *hhash); | |||
| void HAL_HASH_ErrorCallback(HASH_HandleTypeDef *hhash); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /** @defgroup HASH_Private_Types HASH Private Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /** @defgroup HASH_Private_Variables HASH Private Variables | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup HASH_Private_Constants HASH Private Constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup HASH_Private_Macros HASH Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_HASH_ALGOSELECTION(__ALGOSELECTION__) (((__ALGOSELECTION__) == HASH_ALGOSELECTION_SHA1) || \ | |||
| ((__ALGOSELECTION__) == HASH_ALGOSELECTION_SHA224) || \ | |||
| ((__ALGOSELECTION__) == HASH_ALGOSELECTION_SHA256) || \ | |||
| ((__ALGOSELECTION__) == HASH_ALGOSELECTION_MD5)) | |||
| #define IS_HASH_ALGOMODE(__ALGOMODE__) (((__ALGOMODE__) == HASH_ALGOMODE_HASH) || \ | |||
| ((__ALGOMODE__) == HASH_ALGOMODE_HMAC)) | |||
| #define IS_HASH_DATATYPE(__DATATYPE__) (((__DATATYPE__) == HASH_DATATYPE_32B)|| \ | |||
| ((__DATATYPE__) == HASH_DATATYPE_16B)|| \ | |||
| ((__DATATYPE__) == HASH_DATATYPE_8B) || \ | |||
| ((__DATATYPE__) == HASH_DATATYPE_1B)) | |||
| #define IS_HASH_HMAC_KEYTYPE(__KEYTYPE__) (((__KEYTYPE__) == HASH_HMAC_KEYTYPE_SHORTKEY) || \ | |||
| ((__KEYTYPE__) == HASH_HMAC_KEYTYPE_LONGKEY)) | |||
| #define IS_HASH_SHA1_BUFFER_SIZE(__SIZE__) ((((__SIZE__)%4) != 0U)? 0U: 1U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup HASH_Private_Functions HASH Private Functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F415xx || STM32F417xx || STM32F437xx || STM32F439xx || STM32F479xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_HASH_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,200 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_hash_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of HASH HAL Extension module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_HASH_EX_H | |||
| #define __STM32F4xx_HAL_HASH_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #if defined(STM32F437xx) || defined(STM32F439xx) || defined(STM32F479xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup HASHEx | |||
| * @brief HASHEx HAL Extension module driver | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @defgroup HASHEx_Exported_Functions HASHEx Exported Functions | |||
| * @{ | |||
| */ | |||
| /** @defgroup HASHEx_Exported_Functions_Group1 HASHEx processing using polling functions | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_HASHEx_SHA224_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_HASHEx_SHA256_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_HASHEx_SHA224_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| HAL_StatusTypeDef HAL_HASHEx_SHA256_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HASHEx_Exported_Functions_Group2 HMAC processing using polling functions | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_HMACEx_SHA224_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_HMACEx_SHA256_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HASHEx_Exported_Functions_Group3 HASHEx processing using functions | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_HASHEx_SHA224_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer); | |||
| HAL_StatusTypeDef HAL_HASHEx_SHA256_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HASHEx_Exported_Functions_Group4 HASHEx processing using DMA | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_HASHEx_SHA224_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| HAL_StatusTypeDef HAL_HASHEx_SHA224_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_HASHEx_SHA256_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| HAL_StatusTypeDef HAL_HASHEx_SHA256_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HASHEx_Exported_Functions_Group5 HMAC processing using DMA | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_HMACEx_SHA224_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| HAL_StatusTypeDef HAL_HMACEx_SHA256_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HASHEx_Exported_Functions_Group6 HASHEx processing functions | |||
| * @{ | |||
| */ | |||
| void HAL_HASHEx_IRQHandler(HASH_HandleTypeDef *hhash); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /** @defgroup HASHEx_Private_Types HASHEx Private Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /** @defgroup HASHEx_Private_Variables HASHEx Private Variables | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup HASHEx_Private_Constants HASHEx Private Constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup HASHEx_Private_Macros HASHEx Private Macros | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup HASHEx_Private_Functions HASHEx Private Functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F437xx || STM32F439xx || STM32F479xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_HASH_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,262 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_hcd.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of HCD HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_HCD_H | |||
| #define __STM32F4xx_HAL_HCD_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ | |||
| defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \ | |||
| defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_ll_usb.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup HCD | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup HCD_Exported_Types HCD Exported Types | |||
| * @{ | |||
| */ | |||
| /** @defgroup HCD_Exported_Types_Group1 HCD State Structure definition | |||
| * @{ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_HCD_STATE_RESET = 0x00U, | |||
| HAL_HCD_STATE_READY = 0x01U, | |||
| HAL_HCD_STATE_ERROR = 0x02U, | |||
| HAL_HCD_STATE_BUSY = 0x03U, | |||
| HAL_HCD_STATE_TIMEOUT = 0x04U | |||
| } HCD_StateTypeDef; | |||
| typedef USB_OTG_GlobalTypeDef HCD_TypeDef; | |||
| typedef USB_OTG_CfgTypeDef HCD_InitTypeDef; | |||
| typedef USB_OTG_HCTypeDef HCD_HCTypeDef ; | |||
| typedef USB_OTG_URBStateTypeDef HCD_URBStateTypeDef ; | |||
| typedef USB_OTG_HCStateTypeDef HCD_HCStateTypeDef ; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HCD_Exported_Types_Group2 HCD Handle Structure definition | |||
| * @{ | |||
| */ | |||
| typedef struct | |||
| { | |||
| HCD_TypeDef *Instance; /*!< Register base address */ | |||
| HCD_InitTypeDef Init; /*!< HCD required parameters */ | |||
| HCD_HCTypeDef hc[15]; /*!< Host channels parameters */ | |||
| HAL_LockTypeDef Lock; /*!< HCD peripheral status */ | |||
| __IO HCD_StateTypeDef State; /*!< HCD communication state */ | |||
| void *pData; /*!< Pointer Stack Handler */ | |||
| } HCD_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup HCD_Exported_Constants HCD Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup HCD_Speed HCD Speed | |||
| * @{ | |||
| */ | |||
| #define HCD_SPEED_HIGH 0U | |||
| #define HCD_SPEED_LOW 2U | |||
| #define HCD_SPEED_FULL 3U | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HCD_PHY_Module HCD PHY Module | |||
| * @{ | |||
| */ | |||
| #define HCD_PHY_ULPI 1U | |||
| #define HCD_PHY_EMBEDDED 2U | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup HCD_Exported_Macros HCD Exported Macros | |||
| * @brief macros to handle interrupts and specific clock configurations | |||
| * @{ | |||
| */ | |||
| #define __HAL_HCD_ENABLE(__HANDLE__) USB_EnableGlobalInt ((__HANDLE__)->Instance) | |||
| #define __HAL_HCD_DISABLE(__HANDLE__) USB_DisableGlobalInt ((__HANDLE__)->Instance) | |||
| #define __HAL_HCD_GET_FLAG(__HANDLE__, __INTERRUPT__) ((USB_ReadInterrupts((__HANDLE__)->Instance) & (__INTERRUPT__)) == (__INTERRUPT__)) | |||
| #define __HAL_HCD_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->GINTSTS) = (__INTERRUPT__)) | |||
| #define __HAL_HCD_IS_INVALID_INTERRUPT(__HANDLE__) (USB_ReadInterrupts((__HANDLE__)->Instance) == 0U) | |||
| #define __HAL_HCD_CLEAR_HC_INT(chnum, __INTERRUPT__) (USBx_HC(chnum)->HCINT = (__INTERRUPT__)) | |||
| #define __HAL_HCD_MASK_HALT_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK &= ~USB_OTG_HCINTMSK_CHHM) | |||
| #define __HAL_HCD_UNMASK_HALT_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK |= USB_OTG_HCINTMSK_CHHM) | |||
| #define __HAL_HCD_MASK_ACK_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK &= ~USB_OTG_HCINTMSK_ACKM) | |||
| #define __HAL_HCD_UNMASK_ACK_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK |= USB_OTG_HCINTMSK_ACKM) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup HCD_Exported_Functions HCD Exported Functions | |||
| * @{ | |||
| */ | |||
| /* Initialization/de-initialization functions ********************************/ | |||
| /** @addtogroup HCD_Exported_Functions_Group1 Initialization and de-initialization functions | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_HCD_Init(HCD_HandleTypeDef *hhcd); | |||
| HAL_StatusTypeDef HAL_HCD_DeInit(HCD_HandleTypeDef *hhcd); | |||
| HAL_StatusTypeDef HAL_HCD_HC_Init(HCD_HandleTypeDef *hhcd, | |||
| uint8_t ch_num, | |||
| uint8_t epnum, | |||
| uint8_t dev_address, | |||
| uint8_t speed, | |||
| uint8_t ep_type, | |||
| uint16_t mps); | |||
| HAL_StatusTypeDef HAL_HCD_HC_Halt(HCD_HandleTypeDef *hhcd, uint8_t ch_num); | |||
| void HAL_HCD_MspInit(HCD_HandleTypeDef *hhcd); | |||
| void HAL_HCD_MspDeInit(HCD_HandleTypeDef *hhcd); | |||
| /** | |||
| * @} | |||
| */ | |||
| /* I/O operation functions ***************************************************/ | |||
| /** @addtogroup HCD_Exported_Functions_Group2 Input and Output operation functions | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_HCD_HC_SubmitRequest(HCD_HandleTypeDef *hhcd, | |||
| uint8_t pipe, | |||
| uint8_t direction, | |||
| uint8_t ep_type, | |||
| uint8_t token, | |||
| uint8_t* pbuff, | |||
| uint16_t length, | |||
| uint8_t do_ping); | |||
| /* Non-Blocking mode: Interrupt */ | |||
| void HAL_HCD_IRQHandler(HCD_HandleTypeDef *hhcd); | |||
| void HAL_HCD_SOF_Callback(HCD_HandleTypeDef *hhcd); | |||
| void HAL_HCD_Connect_Callback(HCD_HandleTypeDef *hhcd); | |||
| void HAL_HCD_Disconnect_Callback(HCD_HandleTypeDef *hhcd); | |||
| void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *hhcd, | |||
| uint8_t chnum, | |||
| HCD_URBStateTypeDef urb_state); | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Peripheral Control functions **********************************************/ | |||
| /** @addtogroup HCD_Exported_Functions_Group3 Peripheral Control functions | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_HCD_ResetPort(HCD_HandleTypeDef *hhcd); | |||
| HAL_StatusTypeDef HAL_HCD_Start(HCD_HandleTypeDef *hhcd); | |||
| HAL_StatusTypeDef HAL_HCD_Stop(HCD_HandleTypeDef *hhcd); | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Peripheral State functions ************************************************/ | |||
| /** @addtogroup HCD_Exported_Functions_Group4 Peripheral State functions | |||
| * @{ | |||
| */ | |||
| HCD_StateTypeDef HAL_HCD_GetState(HCD_HandleTypeDef *hhcd); | |||
| HCD_URBStateTypeDef HAL_HCD_HC_GetURBState(HCD_HandleTypeDef *hhcd, uint8_t chnum); | |||
| uint32_t HAL_HCD_HC_GetXferCount(HCD_HandleTypeDef *hhcd, uint8_t chnum); | |||
| HCD_HCStateTypeDef HAL_HCD_HC_GetState(HCD_HandleTypeDef *hhcd, uint8_t chnum); | |||
| uint32_t HAL_HCD_GetCurrentFrame(HCD_HandleTypeDef *hhcd); | |||
| uint32_t HAL_HCD_GetCurrentSpeed(HCD_HandleTypeDef *hhcd); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup HCD_Private_Macros HCD Private Macros | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || | |||
| STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Rx || | |||
| STM32F412Vx || STM32F412Cx || defined(STM32F413xx) || defined(STM32F423xx) */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_HCD_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_i2c.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of I2C HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_i2c_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of I2C HAL Extension module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -45,7 +45,7 @@ | |||
| #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) ||\ | |||
| defined(STM32F469xx) || defined(STM32F479xx) | |||
| defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| @@ -126,7 +126,8 @@ HAL_StatusTypeDef HAL_I2CEx_ConfigDigitalFilter(I2C_HandleTypeDef *hi2c, uint32_ | |||
| */ | |||
| #endif /* STM32F427xx || STM32F429xx || STM32F437xx || STM32F439xx || STM32F401xC ||\ | |||
| STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx */ | |||
| STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx ||\ | |||
| STM32F413xx || STM32F423xx */ | |||
| #ifdef __cplusplus | |||
| } | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_i2s.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of I2S HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_i2s_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of I2S HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -80,12 +80,13 @@ | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || | |||
| STM32F401xC || STM32F401xE || STM32F411xE || STM32F469xx || STM32F479xx */ | |||
| #if defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| #if defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\ | |||
| defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define I2S_CLOCK_PLL ((uint32_t)0x00000000U) | |||
| #define I2S_CLOCK_EXTERNAL ((uint32_t)0x00000001U) | |||
| #define I2S_CLOCK_PLLR ((uint32_t)0x00000002U) | |||
| #define I2S_CLOCK_PLLSRC ((uint32_t)0x00000003U) | |||
| #endif /* STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| #endif /* STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) | |||
| #define I2S_CLOCK_PLLSRC ((uint32_t)0x00000000U) | |||
| @@ -156,12 +157,13 @@ HAL_StatusTypeDef HAL_I2SEx_TransmitReceive_DMA(I2S_HandleTypeDef *hi2s, uint16_ | |||
| STM32F401xC || STM32F401xE || STM32F411xE || STM32F469xx || STM32F479xx */ | |||
| #if defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\ | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) || defined (STM32F413xx) ||\ | |||
| defined(STM32F423xx) | |||
| #define IS_I2S_CLOCKSOURCE(CLOCK) (((CLOCK) == I2S_CLOCK_EXTERNAL) ||\ | |||
| ((CLOCK) == I2S_CLOCK_PLL) ||\ | |||
| ((CLOCK) == I2S_CLOCK_PLLSRC) ||\ | |||
| ((CLOCK) == I2S_CLOCK_PLLR)) | |||
| #endif /* STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| #endif /* STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) | |||
| #define IS_I2S_CLOCKSOURCE(CLOCK) (((CLOCK) == I2S_CLOCK_EXTERNAL) ||\ | |||
| @@ -173,11 +175,12 @@ HAL_StatusTypeDef HAL_I2SEx_TransmitReceive_DMA(I2S_HandleTypeDef *hi2s, uint16_ | |||
| defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F410Cx) || defined(STM32F410Rx) || \ | |||
| defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || \ | |||
| defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || \ | |||
| defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define I2SxEXT(__INSTANCE__) ((__INSTANCE__) == (SPI2)? (SPI_TypeDef *)(I2S2ext_BASE): (SPI_TypeDef *)(I2S3ext_BASE)) | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || | |||
| STM32F401xC || STM32F401xE || STM32F410Cx || STM32F410Rx || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || | |||
| STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| @@ -0,0 +1,604 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_irda.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of IRDA HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_IRDA_H | |||
| #define __STM32F4xx_HAL_IRDA_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup IRDA | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup IRDA_Exported_Types IRDA Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief IRDA Init Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t BaudRate; /*!< This member configures the IRDA communication baud rate. | |||
| The baud rate is computed using the following formula: | |||
| - IntegerDivider = ((PCLKx) / (8 * (hirda->Init.BaudRate))) | |||
| - FractionalDivider = ((IntegerDivider - ((uint32_t) IntegerDivider)) * 8) + 0.5 */ | |||
| uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. | |||
| This parameter can be a value of @ref IRDA_Word_Length */ | |||
| uint32_t Parity; /*!< Specifies the parity mode. | |||
| This parameter can be a value of @ref IRDA_Parity | |||
| @note When parity is enabled, the computed parity is inserted | |||
| at the MSB position of the transmitted data (9th bit when | |||
| the word length is set to 9 data bits; 8th bit when the | |||
| word length is set to 8 data bits). */ | |||
| uint32_t Mode; /*!< Specifies wether the Receive or Transmit mode is enabled or disabled. | |||
| This parameter can be a value of @ref IRDA_Mode */ | |||
| uint8_t Prescaler; /*!< Specifies the Prescaler */ | |||
| uint32_t IrDAMode; /*!< Specifies the IrDA mode | |||
| This parameter can be a value of @ref IRDA_Low_Power */ | |||
| }IRDA_InitTypeDef; | |||
| /** | |||
| * @brief HAL IRDA State structures definition | |||
| * @note HAL IRDA State value is a combination of 2 different substates: gState and RxState. | |||
| * - gState contains IRDA state information related to global Handle management | |||
| * and also information related to Tx operations. | |||
| * gState value coding follow below described bitmap : | |||
| * b7-b6 Error information | |||
| * 00 : No Error | |||
| * 01 : (Not Used) | |||
| * 10 : Timeout | |||
| * 11 : Error | |||
| * b5 IP initilisation status | |||
| * 0 : Reset (IP not initialized) | |||
| * 1 : Init done (IP not initialized. HAL IRDA Init function already called) | |||
| * b4-b3 (not used) | |||
| * xx : Should be set to 00 | |||
| * b2 Intrinsic process state | |||
| * 0 : Ready | |||
| * 1 : Busy (IP busy with some configuration or internal operations) | |||
| * b1 (not used) | |||
| * x : Should be set to 0 | |||
| * b0 Tx state | |||
| * 0 : Ready (no Tx operation ongoing) | |||
| * 1 : Busy (Tx operation ongoing) | |||
| * - RxState contains information related to Rx operations. | |||
| * RxState value coding follow below described bitmap : | |||
| * b7-b6 (not used) | |||
| * xx : Should be set to 00 | |||
| * b5 IP initilisation status | |||
| * 0 : Reset (IP not initialized) | |||
| * 1 : Init done (IP not initialized) | |||
| * b4-b2 (not used) | |||
| * xxx : Should be set to 000 | |||
| * b1 Rx state | |||
| * 0 : Ready (no Rx operation ongoing) | |||
| * 1 : Busy (Rx operation ongoing) | |||
| * b0 (not used) | |||
| * x : Should be set to 0. | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_IRDA_STATE_RESET = 0x00U, /*!< Peripheral is not yet Initialized | |||
| Value is allowed for gState and RxState */ | |||
| HAL_IRDA_STATE_READY = 0x20U, /*!< Peripheral Initialized and ready for use | |||
| Value is allowed for gState and RxState */ | |||
| HAL_IRDA_STATE_BUSY = 0x24U, /*!< An internal process is ongoing | |||
| Value is allowed for gState only */ | |||
| HAL_IRDA_STATE_BUSY_TX = 0x21U, /*!< Data Transmission process is ongoing | |||
| Value is allowed for gState only */ | |||
| HAL_IRDA_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing | |||
| Value is allowed for RxState only */ | |||
| HAL_IRDA_STATE_BUSY_TX_RX = 0x23U, /*!< Data Transmission and Reception process is ongoing | |||
| Not to be used for neither gState nor RxState. | |||
| Value is result of combination (Or) between gState and RxState values */ | |||
| HAL_IRDA_STATE_TIMEOUT = 0xA0U, /*!< Timeout state | |||
| Value is allowed for gState only */ | |||
| HAL_IRDA_STATE_ERROR = 0xE0U /*!< Error | |||
| Value is allowed for gState only */ | |||
| }HAL_IRDA_StateTypeDef; | |||
| /** | |||
| * @brief IRDA handle Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| USART_TypeDef *Instance; /* USART registers base address */ | |||
| IRDA_InitTypeDef Init; /* IRDA communication parameters */ | |||
| uint8_t *pTxBuffPtr; /* Pointer to IRDA Tx transfer Buffer */ | |||
| uint16_t TxXferSize; /* IRDA Tx Transfer size */ | |||
| __IO uint16_t TxXferCount; /* IRDA Tx Transfer Counter */ | |||
| uint8_t *pRxBuffPtr; /* Pointer to IRDA Rx transfer Buffer */ | |||
| uint16_t RxXferSize; /* IRDA Rx Transfer size */ | |||
| __IO uint16_t RxXferCount; /* IRDA Rx Transfer Counter */ | |||
| DMA_HandleTypeDef *hdmatx; /* IRDA Tx DMA Handle parameters */ | |||
| DMA_HandleTypeDef *hdmarx; /* IRDA Rx DMA Handle parameters */ | |||
| HAL_LockTypeDef Lock; /* Locking object */ | |||
| __IO HAL_IRDA_StateTypeDef gState; /* IRDA state information related to global Handle management | |||
| and also related to Tx operations. | |||
| This parameter can be a value of @ref HAL_IRDA_StateTypeDef */ | |||
| __IO HAL_IRDA_StateTypeDef RxState; /* IRDA state information related to Rx operations. | |||
| This parameter can be a value of @ref HAL_IRDA_StateTypeDef */ | |||
| __IO uint32_t ErrorCode; /* IRDA Error code */ | |||
| }IRDA_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup IRDA_Exported_Constants IRDA Exported constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup IRDA_Error_Code IRDA Error Code | |||
| * @brief IRDA Error Code | |||
| * @{ | |||
| */ | |||
| #define HAL_IRDA_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */ | |||
| #define HAL_IRDA_ERROR_PE ((uint32_t)0x00000001U) /*!< Parity error */ | |||
| #define HAL_IRDA_ERROR_NE ((uint32_t)0x00000002U) /*!< Noise error */ | |||
| #define HAL_IRDA_ERROR_FE ((uint32_t)0x00000004U) /*!< Frame error */ | |||
| #define HAL_IRDA_ERROR_ORE ((uint32_t)0x00000008U) /*!< Overrun error */ | |||
| #define HAL_IRDA_ERROR_DMA ((uint32_t)0x00000010U) /*!< DMA transfer error */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup IRDA_Word_Length IRDA Word Length | |||
| * @{ | |||
| */ | |||
| #define IRDA_WORDLENGTH_8B ((uint32_t)0x00000000U) | |||
| #define IRDA_WORDLENGTH_9B ((uint32_t)USART_CR1_M) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup IRDA_Parity IRDA Parity | |||
| * @{ | |||
| */ | |||
| #define IRDA_PARITY_NONE ((uint32_t)0x00000000U) | |||
| #define IRDA_PARITY_EVEN ((uint32_t)USART_CR1_PCE) | |||
| #define IRDA_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup IRDA_Mode IRDA Transfer Mode | |||
| * @{ | |||
| */ | |||
| #define IRDA_MODE_RX ((uint32_t)USART_CR1_RE) | |||
| #define IRDA_MODE_TX ((uint32_t)USART_CR1_TE) | |||
| #define IRDA_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup IRDA_Low_Power IRDA Low Power | |||
| * @{ | |||
| */ | |||
| #define IRDA_POWERMODE_LOWPOWER ((uint32_t)USART_CR3_IRLP) | |||
| #define IRDA_POWERMODE_NORMAL ((uint32_t)0x00000000U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup IRDA_Flags IRDA Flags | |||
| * Elements values convention: 0xXXXX | |||
| * - 0xXXXX : Flag mask in the SR register | |||
| * @{ | |||
| */ | |||
| #define IRDA_FLAG_TXE ((uint32_t)0x00000080U) | |||
| #define IRDA_FLAG_TC ((uint32_t)0x00000040U) | |||
| #define IRDA_FLAG_RXNE ((uint32_t)0x00000020U) | |||
| #define IRDA_FLAG_IDLE ((uint32_t)0x00000010U) | |||
| #define IRDA_FLAG_ORE ((uint32_t)0x00000008U) | |||
| #define IRDA_FLAG_NE ((uint32_t)0x00000004U) | |||
| #define IRDA_FLAG_FE ((uint32_t)0x00000002U) | |||
| #define IRDA_FLAG_PE ((uint32_t)0x00000001U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup IRDA_Interrupt_definition IRDA Interrupt Definitions | |||
| * Elements values convention: 0xY000XXXX | |||
| * - XXXX : Interrupt mask in the XX register | |||
| * - Y : Interrupt source register (2bits) | |||
| * - 01: CR1 register | |||
| * - 10: CR2 register | |||
| * - 11: CR3 register | |||
| * @{ | |||
| */ | |||
| #define IRDA_IT_PE ((uint32_t)(IRDA_CR1_REG_INDEX << 28U | USART_CR1_PEIE)) | |||
| #define IRDA_IT_TXE ((uint32_t)(IRDA_CR1_REG_INDEX << 28U | USART_CR1_TXEIE)) | |||
| #define IRDA_IT_TC ((uint32_t)(IRDA_CR1_REG_INDEX << 28U | USART_CR1_TCIE)) | |||
| #define IRDA_IT_RXNE ((uint32_t)(IRDA_CR1_REG_INDEX << 28U | USART_CR1_RXNEIE)) | |||
| #define IRDA_IT_IDLE ((uint32_t)(IRDA_CR1_REG_INDEX << 28U | USART_CR1_IDLEIE)) | |||
| #define IRDA_IT_LBD ((uint32_t)(IRDA_CR2_REG_INDEX << 28U | USART_CR2_LBDIE)) | |||
| #define IRDA_IT_CTS ((uint32_t)(IRDA_CR3_REG_INDEX << 28U | USART_CR3_CTSIE)) | |||
| #define IRDA_IT_ERR ((uint32_t)(IRDA_CR3_REG_INDEX << 28U | USART_CR3_EIE)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup IRDA_Exported_Macros IRDA Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset IRDA handle gstate & RxState | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or | |||
| * UART peripheral. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_IRDA_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->gState = HAL_IRDA_STATE_RESET; \ | |||
| (__HANDLE__)->RxState = HAL_IRDA_STATE_RESET; \ | |||
| } while(0) | |||
| /** @brief Flushs the IRDA DR register | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or | |||
| * UART peripheral. | |||
| */ | |||
| #define __HAL_IRDA_FLUSH_DRREGISTER(__HANDLE__) ((__HANDLE__)->Instance->DR) | |||
| /** @brief Checks whether the specified IRDA flag is set or not. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or | |||
| * UART peripheral. | |||
| * @param __FLAG__: specifies the flag to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg IRDA_FLAG_TXE: Transmit data register empty flag | |||
| * @arg IRDA_FLAG_TC: Transmission Complete flag | |||
| * @arg IRDA_FLAG_RXNE: Receive data register not empty flag | |||
| * @arg IRDA_FLAG_IDLE: Idle Line detection flag | |||
| * @arg IRDA_FLAG_ORE: OverRun Error flag | |||
| * @arg IRDA_FLAG_NE: Noise Error flag | |||
| * @arg IRDA_FLAG_FE: Framing Error flag | |||
| * @arg IRDA_FLAG_PE: Parity Error flag | |||
| * @retval The new state of __FLAG__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_IRDA_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) | |||
| /** @brief Clears the specified IRDA pending flag. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or | |||
| * UART peripheral. | |||
| * @param __FLAG__: specifies the flag to check. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg IRDA_FLAG_TC: Transmission Complete flag. | |||
| * @arg IRDA_FLAG_RXNE: Receive data register not empty flag. | |||
| * | |||
| * @note PE (Parity error), FE (Framing error), NE (Noise error), ORE (OverRun | |||
| * error) and IDLE (Idle line detected) flags are cleared by software | |||
| * sequence: a read operation to USART_SR register followed by a read | |||
| * operation to USART_DR register. | |||
| * @note RXNE flag can be also cleared by a read to the USART_DR register. | |||
| * @note TC flag can be also cleared by software sequence: a read operation to | |||
| * USART_SR register followed by a write operation to USART_DR register. | |||
| * @note TXE flag is cleared only by a write to the USART_DR register. | |||
| * | |||
| * @retval None | |||
| */ | |||
| #define __HAL_IRDA_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__)) | |||
| /** @brief Clear the IRDA PE pending flag. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or | |||
| * UART peripheral. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_IRDA_CLEAR_PEFLAG(__HANDLE__) \ | |||
| do{ \ | |||
| __IO uint32_t tmpreg = 0x00U; \ | |||
| tmpreg = (__HANDLE__)->Instance->SR; \ | |||
| UNUSED(tmpreg); \ | |||
| } while(0) | |||
| /** @brief Clear the IRDA FE pending flag. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or | |||
| * UART peripheral. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_IRDA_CLEAR_FEFLAG(__HANDLE__) __HAL_IRDA_CLEAR_PEFLAG(__HANDLE__) | |||
| /** @brief Clear the IRDA NE pending flag. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or | |||
| * UART peripheral. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_IRDA_CLEAR_NEFLAG(__HANDLE__) __HAL_IRDA_CLEAR_PEFLAG(__HANDLE__) | |||
| /** @brief Clear the IRDA ORE pending flag. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or | |||
| * UART peripheral. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_IRDA_CLEAR_OREFLAG(__HANDLE__) __HAL_IRDA_CLEAR_PEFLAG(__HANDLE__) | |||
| /** @brief Clear the IRDA IDLE pending flag. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or | |||
| * UART peripheral. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_IRDA_CLEAR_IDLEFLAG(__HANDLE__) __HAL_IRDA_CLEAR_PEFLAG(__HANDLE__) | |||
| /** @brief Enables or disables the specified IRDA interrupt. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or | |||
| * UART peripheral. | |||
| * @param __INTERRUPT__: specifies the IRDA interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg IRDA_IT_TXE: Transmit Data Register empty interrupt | |||
| * @arg IRDA_IT_TC: Transmission complete interrupt | |||
| * @arg IRDA_IT_RXNE: Receive Data register not empty interrupt | |||
| * @arg IRDA_IT_IDLE: Idle line detection interrupt | |||
| * @arg IRDA_IT_PE: Parity Error interrupt | |||
| * @arg IRDA_IT_ERR: Error interrupt(Frame error, noise error, overrun error) | |||
| * @retval None | |||
| */ | |||
| #define __HAL_IRDA_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28U) == 1U)? ((__HANDLE__)->Instance->CR1 |= ((__INTERRUPT__) & IRDA_IT_MASK)): \ | |||
| (((__INTERRUPT__) >> 28U) == 2U)? ((__HANDLE__)->Instance->CR2 |= ((__INTERRUPT__) & IRDA_IT_MASK)): \ | |||
| ((__HANDLE__)->Instance->CR3 |= ((__INTERRUPT__) & IRDA_IT_MASK))) | |||
| #define __HAL_IRDA_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28U) == 1U)? ((__HANDLE__)->Instance->CR1 &= ~((__INTERRUPT__) & IRDA_IT_MASK)): \ | |||
| (((__INTERRUPT__) >> 28U) == 2U)? ((__HANDLE__)->Instance->CR2 &= ~((__INTERRUPT__) & IRDA_IT_MASK)): \ | |||
| ((__HANDLE__)->Instance->CR3 &= ~ ((__INTERRUPT__) & IRDA_IT_MASK))) | |||
| /** @brief Checks whether the specified IRDA interrupt has occurred or not. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or | |||
| * UART peripheral. | |||
| * @param __IT__: specifies the IRDA interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg IRDA_IT_TXE: Transmit Data Register empty interrupt | |||
| * @arg IRDA_IT_TC: Transmission complete interrupt | |||
| * @arg IRDA_IT_RXNE: Receive Data register not empty interrupt | |||
| * @arg IRDA_IT_IDLE: Idle line detection interrupt | |||
| * @arg USART_IT_ERR: Error interrupt | |||
| * @arg IRDA_IT_PE: Parity Error interrupt | |||
| * @retval The new state of __IT__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_IRDA_GET_IT_SOURCE(__HANDLE__, __IT__) (((((__IT__) >> 28U) == 1U)? (__HANDLE__)->Instance->CR1:(((((uint32_t)(__IT__)) >> 28U) == 2U)? \ | |||
| (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & (((uint32_t)(__IT__)) & IRDA_IT_MASK)) | |||
| /** @brief Macro to enable the IRDA's one bit sample method | |||
| * @param __HANDLE__: specifies the IRDA Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_IRDA_ONE_BIT_SAMPLE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT) | |||
| /** @brief Macro to disable the IRDA's one bit sample method | |||
| * @param __HANDLE__: specifies the IRDA Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_IRDA_ONE_BIT_SAMPLE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3 &= (uint16_t)~((uint16_t)USART_CR3_ONEBIT)) | |||
| /** @brief Enable UART/USART associated to IRDA Handle | |||
| * @param __HANDLE__: specifies the IRDA Handle. | |||
| * IRDA Handle selects the USARTx or UARTy peripheral | |||
| * (USART,UART availability and x,y values depending on device). | |||
| * @retval None | |||
| */ | |||
| #define __HAL_IRDA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE) | |||
| /** @brief Disable UART/USART associated to IRDA Handle | |||
| * @param __HANDLE__: specifies the IRDA Handle. | |||
| * IRDA Handle selects the USARTx or UARTy peripheral | |||
| * (USART,UART availability and x,y values depending on device). | |||
| * @retval None | |||
| */ | |||
| #define __HAL_IRDA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup IRDA_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup IRDA_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| /* Initialization/de-initialization functions **********************************/ | |||
| HAL_StatusTypeDef HAL_IRDA_Init(IRDA_HandleTypeDef *hirda); | |||
| HAL_StatusTypeDef HAL_IRDA_DeInit(IRDA_HandleTypeDef *hirda); | |||
| void HAL_IRDA_MspInit(IRDA_HandleTypeDef *hirda); | |||
| void HAL_IRDA_MspDeInit(IRDA_HandleTypeDef *hirda); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup IRDA_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| /* IO operation functions *******************************************************/ | |||
| HAL_StatusTypeDef HAL_IRDA_Transmit(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_IRDA_Receive(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_IRDA_Transmit_IT(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_IRDA_Receive_IT(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_IRDA_Transmit_DMA(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_IRDA_Receive_DMA(IRDA_HandleTypeDef *hirda, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_IRDA_DMAPause(IRDA_HandleTypeDef *hirda); | |||
| HAL_StatusTypeDef HAL_IRDA_DMAResume(IRDA_HandleTypeDef *hirda); | |||
| HAL_StatusTypeDef HAL_IRDA_DMAStop(IRDA_HandleTypeDef *hirda); | |||
| /* Transfer Abort functions */ | |||
| HAL_StatusTypeDef HAL_IRDA_Abort(IRDA_HandleTypeDef *hirda); | |||
| HAL_StatusTypeDef HAL_IRDA_AbortTransmit(IRDA_HandleTypeDef *hirda); | |||
| HAL_StatusTypeDef HAL_IRDA_AbortReceive(IRDA_HandleTypeDef *hirda); | |||
| HAL_StatusTypeDef HAL_IRDA_Abort_IT(IRDA_HandleTypeDef *hirda); | |||
| HAL_StatusTypeDef HAL_IRDA_AbortTransmit_IT(IRDA_HandleTypeDef *hirda); | |||
| HAL_StatusTypeDef HAL_IRDA_AbortReceive_IT(IRDA_HandleTypeDef *hirda); | |||
| void HAL_IRDA_IRQHandler(IRDA_HandleTypeDef *hirda); | |||
| void HAL_IRDA_TxCpltCallback(IRDA_HandleTypeDef *hirda); | |||
| void HAL_IRDA_RxCpltCallback(IRDA_HandleTypeDef *hirda); | |||
| void HAL_IRDA_TxHalfCpltCallback(IRDA_HandleTypeDef *hirda); | |||
| void HAL_IRDA_RxHalfCpltCallback(IRDA_HandleTypeDef *hirda); | |||
| void HAL_IRDA_ErrorCallback(IRDA_HandleTypeDef *hirda); | |||
| void HAL_IRDA_AbortCpltCallback(IRDA_HandleTypeDef *hirda); | |||
| void HAL_IRDA_AbortTransmitCpltCallback(IRDA_HandleTypeDef *hirda); | |||
| void HAL_IRDA_AbortReceiveCpltCallback(IRDA_HandleTypeDef *hirda); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup IRDA_Exported_Functions_Group3 | |||
| * @{ | |||
| */ | |||
| /* Peripheral State functions **************************************************/ | |||
| HAL_IRDA_StateTypeDef HAL_IRDA_GetState(IRDA_HandleTypeDef *hirda); | |||
| uint32_t HAL_IRDA_GetError(IRDA_HandleTypeDef *hirda); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup IRDA_Private_Constants IRDA Private Constants | |||
| * @{ | |||
| */ | |||
| /** @brief IRDA interruptions flag mask | |||
| * | |||
| */ | |||
| #define IRDA_IT_MASK ((uint32_t) USART_CR1_PEIE | USART_CR1_TXEIE | USART_CR1_TCIE | USART_CR1_RXNEIE | \ | |||
| USART_CR1_IDLEIE | USART_CR2_LBDIE | USART_CR3_CTSIE | USART_CR3_EIE ) | |||
| #define IRDA_CR1_REG_INDEX 1U | |||
| #define IRDA_CR2_REG_INDEX 2U | |||
| #define IRDA_CR3_REG_INDEX 3U | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros --------------------------------------------------------*/ | |||
| /** @defgroup IRDA_Private_Macros IRDA Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_IRDA_WORD_LENGTH(LENGTH) (((LENGTH) == IRDA_WORDLENGTH_8B) || \ | |||
| ((LENGTH) == IRDA_WORDLENGTH_9B)) | |||
| #define IS_IRDA_PARITY(PARITY) (((PARITY) == IRDA_PARITY_NONE) || \ | |||
| ((PARITY) == IRDA_PARITY_EVEN) || \ | |||
| ((PARITY) == IRDA_PARITY_ODD)) | |||
| #define IS_IRDA_MODE(MODE) ((((MODE) & (uint32_t)0x0000FFF3U) == 0x00U) && ((MODE) != (uint32_t)0x00000000U)) | |||
| #define IS_IRDA_POWERMODE(MODE) (((MODE) == IRDA_POWERMODE_LOWPOWER) || \ | |||
| ((MODE) == IRDA_POWERMODE_NORMAL)) | |||
| #define IS_IRDA_BAUDRATE(BAUDRATE) ((BAUDRATE) < 115201U) | |||
| #define IRDA_DIV(_PCLK_, _BAUD_) (((_PCLK_)*25U)/(4U*(_BAUD_))) | |||
| #define IRDA_DIVMANT(_PCLK_, _BAUD_) (IRDA_DIV((_PCLK_), (_BAUD_))/100U) | |||
| #define IRDA_DIVFRAQ(_PCLK_, _BAUD_) (((IRDA_DIV((_PCLK_), (_BAUD_)) - (IRDA_DIVMANT((_PCLK_), (_BAUD_)) * 100U)) * 16U + 50U) / 100U) | |||
| /* UART BRR = mantissa + overflow + fraction | |||
| = (UART DIVMANT << 4) + (UART DIVFRAQ & 0xF0) + (UART DIVFRAQ & 0x0FU) */ | |||
| #define IRDA_BRR(_PCLK_, _BAUD_) (((IRDA_DIVMANT((_PCLK_), (_BAUD_)) << 4U) + \ | |||
| (IRDA_DIVFRAQ((_PCLK_), (_BAUD_)) & 0xF0U)) + \ | |||
| (IRDA_DIVFRAQ((_PCLK_), (_BAUD_)) & 0x0FU)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup IRDA_Private_Functions IRDA Private Functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_IRDA_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,243 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_iwdg.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of IWDG HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_IWDG_H | |||
| #define __STM32F4xx_HAL_IWDG_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup IWDG | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup IWDG_Exported_Types IWDG Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief IWDG Init structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t Prescaler; /*!< Select the prescaler of the IWDG. | |||
| This parameter can be a value of @ref IWDG_Prescaler */ | |||
| uint32_t Reload; /*!< Specifies the IWDG down-counter reload value. | |||
| This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFF */ | |||
| } IWDG_InitTypeDef; | |||
| /** | |||
| * @brief IWDG Handle Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| IWDG_TypeDef *Instance; /*!< Register base address */ | |||
| IWDG_InitTypeDef Init; /*!< IWDG required parameters */ | |||
| }IWDG_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup IWDG_Exported_Constants IWDG Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup IWDG_Prescaler IWDG Prescaler | |||
| * @{ | |||
| */ | |||
| #define IWDG_PRESCALER_4 0x00000000U /*!< IWDG prescaler set to 4 */ | |||
| #define IWDG_PRESCALER_8 IWDG_PR_PR_0 /*!< IWDG prescaler set to 8 */ | |||
| #define IWDG_PRESCALER_16 IWDG_PR_PR_1 /*!< IWDG prescaler set to 16 */ | |||
| #define IWDG_PRESCALER_32 (IWDG_PR_PR_1 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 32 */ | |||
| #define IWDG_PRESCALER_64 IWDG_PR_PR_2 /*!< IWDG prescaler set to 64 */ | |||
| #define IWDG_PRESCALER_128 (IWDG_PR_PR_2 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 128 */ | |||
| #define IWDG_PRESCALER_256 (IWDG_PR_PR_2 | IWDG_PR_PR_1) /*!< IWDG prescaler set to 256 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macros -----------------------------------------------------------*/ | |||
| /** @defgroup IWDG_Exported_Macros IWDG Exported Macros | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief Enable the IWDG peripheral. | |||
| * @param __HANDLE__ IWDG handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_IWDG_START(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_ENABLE) | |||
| /** | |||
| * @brief Reload IWDG counter with value defined in the reload register | |||
| * (write access to IWDG_PR & IWDG_RLR registers disabled). | |||
| * @param __HANDLE__ IWDG handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_IWDG_RELOAD_COUNTER(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_RELOAD) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @defgroup IWDG_Exported_Functions IWDG Exported Functions | |||
| * @{ | |||
| */ | |||
| /** @defgroup IWDG_Exported_Functions_Group1 Initialization and Start functions | |||
| * @{ | |||
| */ | |||
| /* Initialization/Start functions ********************************************/ | |||
| HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup IWDG_Exported_Functions_Group2 IO operation functions | |||
| * @{ | |||
| */ | |||
| /* I/O operation functions ****************************************************/ | |||
| HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup IWDG_Private_Constants IWDG Private Constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief IWDG Key Register BitMask | |||
| */ | |||
| #define IWDG_KEY_RELOAD 0x0000AAAAU /*!< IWDG Reload Counter Enable */ | |||
| #define IWDG_KEY_ENABLE 0x0000CCCCU /*!< IWDG Peripheral Enable */ | |||
| #define IWDG_KEY_WRITE_ACCESS_ENABLE 0x00005555U /*!< IWDG KR Write Access Enable */ | |||
| #define IWDG_KEY_WRITE_ACCESS_DISABLE 0x00000000U /*!< IWDG KR Write Access Disable */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup IWDG_Private_Macros IWDG Private Macros | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief Enable write access to IWDG_PR and IWDG_RLR registers. | |||
| * @param __HANDLE__ IWDG handle | |||
| * @retval None | |||
| */ | |||
| #define IWDG_ENABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_ENABLE) | |||
| /** | |||
| * @brief Disable write access to IWDG_PR and IWDG_RLR registers. | |||
| * @param __HANDLE__ IWDG handle | |||
| * @retval None | |||
| */ | |||
| #define IWDG_DISABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_DISABLE) | |||
| /** | |||
| * @brief Check IWDG prescaler value. | |||
| * @param __PRESCALER__ IWDG prescaler value | |||
| * @retval None | |||
| */ | |||
| #define IS_IWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == IWDG_PRESCALER_4) || \ | |||
| ((__PRESCALER__) == IWDG_PRESCALER_8) || \ | |||
| ((__PRESCALER__) == IWDG_PRESCALER_16) || \ | |||
| ((__PRESCALER__) == IWDG_PRESCALER_32) || \ | |||
| ((__PRESCALER__) == IWDG_PRESCALER_64) || \ | |||
| ((__PRESCALER__) == IWDG_PRESCALER_128)|| \ | |||
| ((__PRESCALER__) == IWDG_PRESCALER_256)) | |||
| /** | |||
| * @brief Check IWDG reload value. | |||
| * @param __RELOAD__ IWDG reload value | |||
| * @retval None | |||
| */ | |||
| #define IS_IWDG_RELOAD(__RELOAD__) ((__RELOAD__) <= IWDG_RLR_RL) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_IWDG_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,763 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_lptim.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of LPTIM HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_LPTIM_H | |||
| #define __STM32F4xx_HAL_LPTIM_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @defgroup LPTIM LPTIM | |||
| * @brief LPTIM HAL module driver | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup LPTIM_Exported_Types LPTIM Exported Types | |||
| * @{ | |||
| */ | |||
| /** @defgroup LPTIM_WAKEUPTIMER_EXTILINE LPTIM WAKEUP Timer EXTI Line | |||
| * @{ | |||
| */ | |||
| #define LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT ((uint32_t)EXTI_IMR_MR23) /*!< External interrupt line 23 Connected to the LPTIM EXTI Line */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @brief LPTIM Clock configuration definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t Source; /*!< Selects the clock source. | |||
| This parameter can be a value of @ref LPTIM_Clock_Source */ | |||
| uint32_t Prescaler; /*!< Specifies the counter clock Prescaler. | |||
| This parameter can be a value of @ref LPTIM_Clock_Prescaler */ | |||
| }LPTIM_ClockConfigTypeDef; | |||
| /** | |||
| * @brief LPTIM Clock configuration definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t Polarity; /*!< Selects the polarity of the active edge for the counter unit | |||
| if the ULPTIM input is selected. | |||
| Note: This parameter is used only when Ultra low power clock source is used. | |||
| Note: If the polarity is configured on 'both edges', an auxiliary clock | |||
| (one of the Low power oscillator) must be active. | |||
| This parameter can be a value of @ref LPTIM_Clock_Polarity */ | |||
| uint32_t SampleTime; /*!< Selects the clock sampling time to configure the clock glitch filter. | |||
| Note: This parameter is used only when Ultra low power clock source is used. | |||
| This parameter can be a value of @ref LPTIM_Clock_Sample_Time */ | |||
| }LPTIM_ULPClockConfigTypeDef; | |||
| /** | |||
| * @brief LPTIM Trigger configuration definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t Source; /*!< Selects the Trigger source. | |||
| This parameter can be a value of @ref LPTIM_Trigger_Source */ | |||
| uint32_t ActiveEdge; /*!< Selects the Trigger active edge. | |||
| Note: This parameter is used only when an external trigger is used. | |||
| This parameter can be a value of @ref LPTIM_External_Trigger_Polarity */ | |||
| uint32_t SampleTime; /*!< Selects the trigger sampling time to configure the clock glitch filter. | |||
| Note: This parameter is used only when an external trigger is used. | |||
| This parameter can be a value of @ref LPTIM_Trigger_Sample_Time */ | |||
| }LPTIM_TriggerConfigTypeDef; | |||
| /** | |||
| * @brief LPTIM Initialization Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| LPTIM_ClockConfigTypeDef Clock; /*!< Specifies the clock parameters */ | |||
| LPTIM_ULPClockConfigTypeDef UltraLowPowerClock; /*!< Specifies the Ultra Low Power clock parameters */ | |||
| LPTIM_TriggerConfigTypeDef Trigger; /*!< Specifies the Trigger parameters */ | |||
| uint32_t OutputPolarity; /*!< Specifies the Output polarity. | |||
| This parameter can be a value of @ref LPTIM_Output_Polarity */ | |||
| uint32_t UpdateMode; /*!< Specifies whether the update of the autorelaod and the compare | |||
| values is done immediately or after the end of current period. | |||
| This parameter can be a value of @ref LPTIM_Updating_Mode */ | |||
| uint32_t CounterSource; /*!< Specifies whether the counter is incremented each internal event | |||
| or each external event. | |||
| This parameter can be a value of @ref LPTIM_Counter_Source */ | |||
| }LPTIM_InitTypeDef; | |||
| /** | |||
| * @brief HAL LPTIM State structure definition | |||
| */ | |||
| typedef enum __HAL_LPTIM_StateTypeDef | |||
| { | |||
| HAL_LPTIM_STATE_RESET = 0x00U, /*!< Peripheral not yet initialized or disabled */ | |||
| HAL_LPTIM_STATE_READY = 0x01U, /*!< Peripheral Initialized and ready for use */ | |||
| HAL_LPTIM_STATE_BUSY = 0x02U, /*!< An internal process is ongoing */ | |||
| HAL_LPTIM_STATE_TIMEOUT = 0x03U, /*!< Timeout state */ | |||
| HAL_LPTIM_STATE_ERROR = 0x04U /*!< Internal Process is ongoing */ | |||
| }HAL_LPTIM_StateTypeDef; | |||
| /** | |||
| * @brief LPTIM handle Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| LPTIM_TypeDef *Instance; /*!< Register base address */ | |||
| LPTIM_InitTypeDef Init; /*!< LPTIM required parameters */ | |||
| HAL_StatusTypeDef Status; /*!< LPTIM peripheral status */ | |||
| HAL_LockTypeDef Lock; /*!< LPTIM locking object */ | |||
| __IO HAL_LPTIM_StateTypeDef State; /*!< LPTIM peripheral state */ | |||
| }LPTIM_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup LPTIM_Exported_Constants LPTIM Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup LPTIM_Clock_Source LPTIM Clock Source | |||
| * @{ | |||
| */ | |||
| #define LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC ((uint32_t)0x00U) | |||
| #define LPTIM_CLOCKSOURCE_ULPTIM LPTIM_CFGR_CKSEL | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LPTIM_Clock_Prescaler LPTIM Clock Prescaler | |||
| * @{ | |||
| */ | |||
| #define LPTIM_PRESCALER_DIV1 ((uint32_t)0x00000000U) | |||
| #define LPTIM_PRESCALER_DIV2 LPTIM_CFGR_PRESC_0 | |||
| #define LPTIM_PRESCALER_DIV4 LPTIM_CFGR_PRESC_1 | |||
| #define LPTIM_PRESCALER_DIV8 ((uint32_t)(LPTIM_CFGR_PRESC_0 | LPTIM_CFGR_PRESC_1)) | |||
| #define LPTIM_PRESCALER_DIV16 LPTIM_CFGR_PRESC_2 | |||
| #define LPTIM_PRESCALER_DIV32 ((uint32_t)(LPTIM_CFGR_PRESC_0 | LPTIM_CFGR_PRESC_2)) | |||
| #define LPTIM_PRESCALER_DIV64 ((uint32_t)(LPTIM_CFGR_PRESC_1 | LPTIM_CFGR_PRESC_2)) | |||
| #define LPTIM_PRESCALER_DIV128 ((uint32_t)LPTIM_CFGR_PRESC) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LPTIM_Output_Polarity LPTIM Output Polarity | |||
| * @{ | |||
| */ | |||
| #define LPTIM_OUTPUTPOLARITY_HIGH ((uint32_t)0x00000000U) | |||
| #define LPTIM_OUTPUTPOLARITY_LOW (LPTIM_CFGR_WAVPOL) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LPTIM_Clock_Sample_Time LPTIM Clock Sample Time | |||
| * @{ | |||
| */ | |||
| #define LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION ((uint32_t)0x00000000U) | |||
| #define LPTIM_CLOCKSAMPLETIME_2TRANSITIONS LPTIM_CFGR_CKFLT_0 | |||
| #define LPTIM_CLOCKSAMPLETIME_4TRANSITIONS LPTIM_CFGR_CKFLT_1 | |||
| #define LPTIM_CLOCKSAMPLETIME_8TRANSITIONS LPTIM_CFGR_CKFLT | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LPTIM_Clock_Polarity LPTIM Clock Polarity | |||
| * @{ | |||
| */ | |||
| #define LPTIM_CLOCKPOLARITY_RISING ((uint32_t)0x00000000U) | |||
| #define LPTIM_CLOCKPOLARITY_FALLING LPTIM_CFGR_CKPOL_0 | |||
| #define LPTIM_CLOCKPOLARITY_RISING_FALLING LPTIM_CFGR_CKPOL_1 | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LPTIM_Trigger_Source LPTIM Trigger Source | |||
| * @{ | |||
| */ | |||
| #define LPTIM_TRIGSOURCE_SOFTWARE ((uint32_t)0x0000FFFFU) | |||
| #define LPTIM_TRIGSOURCE_0 ((uint32_t)0x00000000U) | |||
| #define LPTIM_TRIGSOURCE_1 ((uint32_t)LPTIM_CFGR_TRIGSEL_0) | |||
| #define LPTIM_TRIGSOURCE_2 LPTIM_CFGR_TRIGSEL_1 | |||
| #define LPTIM_TRIGSOURCE_3 ((uint32_t)LPTIM_CFGR_TRIGSEL_0 | LPTIM_CFGR_TRIGSEL_1) | |||
| #define LPTIM_TRIGSOURCE_4 LPTIM_CFGR_TRIGSEL_2 | |||
| #define LPTIM_TRIGSOURCE_5 ((uint32_t)LPTIM_CFGR_TRIGSEL_0 | LPTIM_CFGR_TRIGSEL_2) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LPTIM_External_Trigger_Polarity LPTIM External Trigger Polarity | |||
| * @{ | |||
| */ | |||
| #define LPTIM_ACTIVEEDGE_RISING LPTIM_CFGR_TRIGEN_0 | |||
| #define LPTIM_ACTIVEEDGE_FALLING LPTIM_CFGR_TRIGEN_1 | |||
| #define LPTIM_ACTIVEEDGE_RISING_FALLING LPTIM_CFGR_TRIGEN | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LPTIM_Trigger_Sample_Time LPTIM Trigger Sample Time | |||
| * @{ | |||
| */ | |||
| #define LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION ((uint32_t)0x00000000U) | |||
| #define LPTIM_TRIGSAMPLETIME_2TRANSITIONS LPTIM_CFGR_TRGFLT_0 | |||
| #define LPTIM_TRIGSAMPLETIME_4TRANSITIONS LPTIM_CFGR_TRGFLT_1 | |||
| #define LPTIM_TRIGSAMPLETIME_8TRANSITIONS LPTIM_CFGR_TRGFLT | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LPTIM_Updating_Mode LPTIM Updating Mode | |||
| * @{ | |||
| */ | |||
| #define LPTIM_UPDATE_IMMEDIATE ((uint32_t)0x00000000U) | |||
| #define LPTIM_UPDATE_ENDOFPERIOD LPTIM_CFGR_PRELOAD | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LPTIM_Counter_Source LPTIM Counter Source | |||
| * @{ | |||
| */ | |||
| #define LPTIM_COUNTERSOURCE_INTERNAL ((uint32_t)0x00000000U) | |||
| #define LPTIM_COUNTERSOURCE_EXTERNAL LPTIM_CFGR_COUNTMODE | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LPTIM_Flag_Definition LPTIM Flag Definition | |||
| * @{ | |||
| */ | |||
| #define LPTIM_FLAG_DOWN LPTIM_ISR_DOWN | |||
| #define LPTIM_FLAG_UP LPTIM_ISR_UP | |||
| #define LPTIM_FLAG_ARROK LPTIM_ISR_ARROK | |||
| #define LPTIM_FLAG_CMPOK LPTIM_ISR_CMPOK | |||
| #define LPTIM_FLAG_EXTTRIG LPTIM_ISR_EXTTRIG | |||
| #define LPTIM_FLAG_ARRM LPTIM_ISR_ARRM | |||
| #define LPTIM_FLAG_CMPM LPTIM_ISR_CMPM | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LPTIM_Interrupts_Definition LPTIM Interrupts Definition | |||
| * @{ | |||
| */ | |||
| #define LPTIM_IT_DOWN LPTIM_IER_DOWNIE | |||
| #define LPTIM_IT_UP LPTIM_IER_UPIE | |||
| #define LPTIM_IT_ARROK LPTIM_IER_ARROKIE | |||
| #define LPTIM_IT_CMPOK LPTIM_IER_CMPOKIE | |||
| #define LPTIM_IT_EXTTRIG LPTIM_IER_EXTTRIGIE | |||
| #define LPTIM_IT_ARRM LPTIM_IER_ARRMIE | |||
| #define LPTIM_IT_CMPM LPTIM_IER_CMPMIE | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LPTIM_Option Register Definition | |||
| * @{ | |||
| */ | |||
| #define LPTIM_OP_PAD_AF ((uint32_t)0x00000000U) | |||
| #define LPTIM_OP_PAD_PA4 LPTIM_OR_LPT_IN1_RMP_0 | |||
| #define LPTIM_OP_PAD_PB9 LPTIM_OR_LPT_IN1_RMP_1 | |||
| #define LPTIM_OP_TIM_DAC LPTIM_OR_LPT_IN1_RMP | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup LPTIM_Exported_Macros LPTIM Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset LPTIM handle state | |||
| * @param __HANDLE__: LPTIM handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LPTIM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_LPTIM_STATE_RESET) | |||
| /** | |||
| * @brief Enable/Disable the LPTIM peripheral. | |||
| * @param __HANDLE__: LPTIM handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LPTIM_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (LPTIM_CR_ENABLE)) | |||
| #define __HAL_LPTIM_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(LPTIM_CR_ENABLE)) | |||
| /** | |||
| * @brief Starts the LPTIM peripheral in Continuous or in single mode. | |||
| * @param __HANDLE__: DMA handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LPTIM_START_CONTINUOUS(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_CNTSTRT) | |||
| #define __HAL_LPTIM_START_SINGLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_SNGSTRT) | |||
| /** | |||
| * @brief Writes the passed parameter in the Autoreload register. | |||
| * @param __HANDLE__: LPTIM handle | |||
| * @param __VALUE__ : Autoreload value | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LPTIM_AUTORELOAD_SET(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->ARR = (__VALUE__)) | |||
| /** | |||
| * @brief Writes the passed parameter in the Compare register. | |||
| * @param __HANDLE__: LPTIM handle | |||
| * @param __VALUE__ : Compare value | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LPTIM_COMPARE_SET(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->CMP = (__VALUE__)) | |||
| /** | |||
| * @brief Checks whether the specified LPTIM flag is set or not. | |||
| * @param __HANDLE__: LPTIM handle | |||
| * @param __FLAG__ : LPTIM flag to check | |||
| * This parameter can be a value of: | |||
| * @arg LPTIM_FLAG_DOWN : Counter direction change up Flag. | |||
| * @arg LPTIM_FLAG_UP : Counter direction change down to up Flag. | |||
| * @arg LPTIM_FLAG_ARROK : Autoreload register update OK Flag. | |||
| * @arg LPTIM_FLAG_CMPOK : Compare register update OK Flag. | |||
| * @arg LPTIM_FLAG_EXTTRIG : External trigger edge event Flag. | |||
| * @arg LPTIM_FLAG_ARRM : Autoreload match Flag. | |||
| * @arg LPTIM_FLAG_CMPM : Compare match Flag. | |||
| * @retval The state of the specified flag (SET or RESET). | |||
| */ | |||
| #define __HAL_LPTIM_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR &(__FLAG__)) == (__FLAG__)) | |||
| /** | |||
| * @brief Clears the specified LPTIM flag. | |||
| * @param __HANDLE__: LPTIM handle. | |||
| * @param __FLAG__ : LPTIM flag to clear. | |||
| * This parameter can be a value of: | |||
| * @arg LPTIM_FLAG_DOWN : Counter direction change up Flag. | |||
| * @arg LPTIM_FLAG_UP : Counter direction change down to up Flag. | |||
| * @arg LPTIM_FLAG_ARROK : Autoreload register update OK Flag. | |||
| * @arg LPTIM_FLAG_CMPOK : Compare register update OK Flag. | |||
| * @arg LPTIM_FLAG_EXTTRIG : External trigger edge event Flag. | |||
| * @arg LPTIM_FLAG_ARRM : Autoreload match Flag. | |||
| * @arg LPTIM_FLAG_CMPM : Compare match Flag. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LPTIM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) | |||
| /** | |||
| * @brief Enable the specified LPTIM interrupt. | |||
| * @param __HANDLE__ : LPTIM handle. | |||
| * @param __INTERRUPT__ : LPTIM interrupt to set. | |||
| * This parameter can be a value of: | |||
| * @arg LPTIM_IT_DOWN : Counter direction change up Interrupt. | |||
| * @arg LPTIM_IT_UP : Counter direction change down to up Interrupt. | |||
| * @arg LPTIM_IT_ARROK : Autoreload register update OK Interrupt. | |||
| * @arg LPTIM_IT_CMPOK : Compare register update OK Interrupt. | |||
| * @arg LPTIM_IT_EXTTRIG : External trigger edge event Interrupt. | |||
| * @arg LPTIM_IT_ARRM : Autoreload match Interrupt. | |||
| * @arg LPTIM_IT_CMPM : Compare match Interrupt. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LPTIM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__)) | |||
| /** | |||
| * @brief Disable the specified LPTIM interrupt. | |||
| * @param __HANDLE__ : LPTIM handle. | |||
| * @param __INTERRUPT__ : LPTIM interrupt to set. | |||
| * This parameter can be a value of: | |||
| * @arg LPTIM_IT_DOWN : Counter direction change up Interrupt. | |||
| * @arg LPTIM_IT_UP : Counter direction change down to up Interrupt. | |||
| * @arg LPTIM_IT_ARROK : Autoreload register update OK Interrupt. | |||
| * @arg LPTIM_IT_CMPOK : Compare register update OK Interrupt. | |||
| * @arg LPTIM_IT_EXTTRIG : External trigger edge event Interrupt. | |||
| * @arg LPTIM_IT_ARRM : Autoreload match Interrupt. | |||
| * @arg LPTIM_IT_CMPM : Compare match Interrupt. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LPTIM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= (~(__INTERRUPT__))) | |||
| /** | |||
| * @brief Checks whether the specified LPTIM interrupt is set or not. | |||
| * @param __HANDLE__ : LPTIM handle. | |||
| * @param __INTERRUPT__ : LPTIM interrupt to check. | |||
| * This parameter can be a value of: | |||
| * @arg LPTIM_IT_DOWN : Counter direction change up Interrupt. | |||
| * @arg LPTIM_IT_UP : Counter direction change down to up Interrupt. | |||
| * @arg LPTIM_IT_ARROK : Autoreload register update OK Interrupt. | |||
| * @arg LPTIM_IT_CMPOK : Compare register update OK Interrupt. | |||
| * @arg LPTIM_IT_EXTTRIG : External trigger edge event Interrupt. | |||
| * @arg LPTIM_IT_ARRM : Autoreload match Interrupt. | |||
| * @arg LPTIM_IT_CMPM : Compare match Interrupt. | |||
| * @retval Interrupt status. | |||
| */ | |||
| #define __HAL_LPTIM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IER & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) | |||
| /** @brief LPTIM Option Register | |||
| * @param __HANDLE__: LPTIM handle | |||
| * @param __VALUE__: This parameter can be a value of : | |||
| * @arg LPTIM_OP_PAD_AF | |||
| * @arg LPTIM_OP_PAD_PA4 | |||
| * @arg LPTIM_OP_PAD_PB9 | |||
| * @arg LPTIM_OP_TIM_DAC | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LPTIM_OPTR_CONFIG(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->OR = (__VALUE__)) | |||
| /** | |||
| * @brief Enable interrupt on the LPTIM Wake-up Timer associated Exti line. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->IMR |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT) | |||
| /** | |||
| * @brief Disable interrupt on the LPTIM Wake-up Timer associated Exti line. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->IMR &= ~(LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)) | |||
| /** | |||
| * @brief Enable event on the LPTIM Wake-up Timer associated Exti line. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->EMR |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT) | |||
| /** | |||
| * @brief Disable event on the LPTIM Wake-up Timer associated Exti line. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)) | |||
| /** | |||
| * @brief Enable falling edge trigger on the LPTIM Wake-up Timer associated Exti line. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT) | |||
| /** | |||
| * @brief Disable falling edge trigger on the LPTIM Wake-up Timer associated Exti line. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)) | |||
| /** | |||
| * @brief Enable rising edge trigger on the LPTIM Wake-up Timer associated Exti line. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT) | |||
| /** | |||
| * @brief Disable rising edge trigger on the LPTIM Wake-up Timer associated Exti line. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)) | |||
| /** | |||
| * @brief Enable rising & falling edge trigger on the LPTIM Wake-up Timer associated Exti line. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_RISING_FALLING_EDGE() do{__HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE();\ | |||
| __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE();\ | |||
| }while(0) | |||
| /** | |||
| * @brief Disable rising & falling edge trigger on the LPTIM Wake-up Timer associated Exti line. | |||
| * This parameter can be: | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_RISING_FALLING_EDGE() do{__HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE();\ | |||
| __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE();\ | |||
| }while(0) | |||
| /** | |||
| * @brief Check whether the LPTIM Wake-up Timer associated Exti line interrupt flag is set or not. | |||
| * @retval Line Status. | |||
| */ | |||
| #define __HAL_LPTIM_WAKEUPTIMER_EXTI_GET_FLAG() (EXTI->PR & LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT) | |||
| /** | |||
| * @brief Clear the LPTIM Wake-up Timer associated Exti line flag. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LPTIM_WAKEUPTIMER_EXTI_CLEAR_FLAG() (EXTI->PR = LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT) | |||
| /** | |||
| * @brief Generate a Software interrupt on the LPTIM Wake-up Timer associated Exti line. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LPTIM_WAKEUPTIMER_EXTI_GENERATE_SWIT() (EXTI->SWIER |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @defgroup LPTIM_Exported_Functions LPTIM Exported Functions | |||
| * @{ | |||
| */ | |||
| /* Initialization/de-initialization functions ********************************/ | |||
| HAL_StatusTypeDef HAL_LPTIM_Init(LPTIM_HandleTypeDef *hlptim); | |||
| HAL_StatusTypeDef HAL_LPTIM_DeInit(LPTIM_HandleTypeDef *hlptim); | |||
| /* MSP functions *************************************************************/ | |||
| void HAL_LPTIM_MspInit(LPTIM_HandleTypeDef *hlptim); | |||
| void HAL_LPTIM_MspDeInit(LPTIM_HandleTypeDef *hlptim); | |||
| /* Start/Stop operation functions *********************************************/ | |||
| /* ################################# PWM Mode ################################*/ | |||
| /* Blocking mode: Polling */ | |||
| HAL_StatusTypeDef HAL_LPTIM_PWM_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse); | |||
| HAL_StatusTypeDef HAL_LPTIM_PWM_Stop(LPTIM_HandleTypeDef *hlptim); | |||
| /* Non-Blocking mode: Interrupt */ | |||
| HAL_StatusTypeDef HAL_LPTIM_PWM_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse); | |||
| HAL_StatusTypeDef HAL_LPTIM_PWM_Stop_IT(LPTIM_HandleTypeDef *hlptim); | |||
| /* ############################# One Pulse Mode ##############################*/ | |||
| /* Blocking mode: Polling */ | |||
| HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse); | |||
| HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop(LPTIM_HandleTypeDef *hlptim); | |||
| /* Non-Blocking mode: Interrupt */ | |||
| HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse); | |||
| HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop_IT(LPTIM_HandleTypeDef *hlptim); | |||
| /* ############################## Set once Mode ##############################*/ | |||
| /* Blocking mode: Polling */ | |||
| HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse); | |||
| HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop(LPTIM_HandleTypeDef *hlptim); | |||
| /* Non-Blocking mode: Interrupt */ | |||
| HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse); | |||
| HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop_IT(LPTIM_HandleTypeDef *hlptim); | |||
| /* ############################### Encoder Mode ##############################*/ | |||
| /* Blocking mode: Polling */ | |||
| HAL_StatusTypeDef HAL_LPTIM_Encoder_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period); | |||
| HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop(LPTIM_HandleTypeDef *hlptim); | |||
| /* Non-Blocking mode: Interrupt */ | |||
| HAL_StatusTypeDef HAL_LPTIM_Encoder_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period); | |||
| HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop_IT(LPTIM_HandleTypeDef *hlptim); | |||
| /* ############################# Time out Mode ##############################*/ | |||
| /* Blocking mode: Polling */ | |||
| HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop(LPTIM_HandleTypeDef *hlptim); | |||
| /* Non-Blocking mode: Interrupt */ | |||
| HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop_IT(LPTIM_HandleTypeDef *hlptim); | |||
| /* ############################## Counter Mode ###############################*/ | |||
| /* Blocking mode: Polling */ | |||
| HAL_StatusTypeDef HAL_LPTIM_Counter_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period); | |||
| HAL_StatusTypeDef HAL_LPTIM_Counter_Stop(LPTIM_HandleTypeDef *hlptim); | |||
| /* Non-Blocking mode: Interrupt */ | |||
| HAL_StatusTypeDef HAL_LPTIM_Counter_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period); | |||
| HAL_StatusTypeDef HAL_LPTIM_Counter_Stop_IT(LPTIM_HandleTypeDef *hlptim); | |||
| /* Reading operation functions ************************************************/ | |||
| uint32_t HAL_LPTIM_ReadCounter(LPTIM_HandleTypeDef *hlptim); | |||
| uint32_t HAL_LPTIM_ReadAutoReload(LPTIM_HandleTypeDef *hlptim); | |||
| uint32_t HAL_LPTIM_ReadCompare(LPTIM_HandleTypeDef *hlptim); | |||
| /* LPTIM IRQ functions *******************************************************/ | |||
| void HAL_LPTIM_IRQHandler(LPTIM_HandleTypeDef *hlptim); | |||
| /* CallBack functions ********************************************************/ | |||
| void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim); | |||
| void HAL_LPTIM_AutoReloadMatchCallback(LPTIM_HandleTypeDef *hlptim); | |||
| void HAL_LPTIM_TriggerCallback(LPTIM_HandleTypeDef *hlptim); | |||
| void HAL_LPTIM_CompareWriteCallback(LPTIM_HandleTypeDef *hlptim); | |||
| void HAL_LPTIM_AutoReloadWriteCallback(LPTIM_HandleTypeDef *hlptim); | |||
| void HAL_LPTIM_DirectionUpCallback(LPTIM_HandleTypeDef *hlptim); | |||
| void HAL_LPTIM_DirectionDownCallback(LPTIM_HandleTypeDef *hlptim); | |||
| /* Peripheral State functions ************************************************/ | |||
| HAL_LPTIM_StateTypeDef HAL_LPTIM_GetState(LPTIM_HandleTypeDef *hlptim); | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /** @defgroup LPTIM_Private_Types LPTIM Private Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /** @defgroup LPTIM_Private_Variables LPTIM Private Variables | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup LPTIM_Private_Constants LPTIM Private Constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup LPTIM_Private_Macros LPTIM Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_LPTIM_CLOCK_SOURCE(__SOURCE__) (((__SOURCE__) == LPTIM_CLOCKSOURCE_ULPTIM) || \ | |||
| ((__SOURCE__) == LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC)) | |||
| #define IS_LPTIM_CLOCK_PRESCALER(__PRESCALER__) (((__PRESCALER__) == LPTIM_PRESCALER_DIV1 ) || \ | |||
| ((__PRESCALER__) == LPTIM_PRESCALER_DIV2 ) || \ | |||
| ((__PRESCALER__) == LPTIM_PRESCALER_DIV4 ) || \ | |||
| ((__PRESCALER__) == LPTIM_PRESCALER_DIV8 ) || \ | |||
| ((__PRESCALER__) == LPTIM_PRESCALER_DIV16 ) || \ | |||
| ((__PRESCALER__) == LPTIM_PRESCALER_DIV32 ) || \ | |||
| ((__PRESCALER__) == LPTIM_PRESCALER_DIV64 ) || \ | |||
| ((__PRESCALER__) == LPTIM_PRESCALER_DIV128)) | |||
| #define IS_LPTIM_CLOCK_PRESCALERDIV1(__PRESCALER__) ((__PRESCALER__) == LPTIM_PRESCALER_DIV1) | |||
| #define IS_LPTIM_OUTPUT_POLARITY(__POLARITY__) (((__POLARITY__) == LPTIM_OUTPUTPOLARITY_LOW ) || \ | |||
| ((__POLARITY__) == LPTIM_OUTPUTPOLARITY_HIGH)) | |||
| #define IS_LPTIM_CLOCK_SAMPLE_TIME(__SAMPLETIME__) (((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION) || \ | |||
| ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_2TRANSITIONS) || \ | |||
| ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_4TRANSITIONS) || \ | |||
| ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_8TRANSITIONS)) | |||
| #define IS_LPTIM_CLOCK_POLARITY(__POLARITY__) (((__POLARITY__) == LPTIM_CLOCKPOLARITY_RISING) || \ | |||
| ((__POLARITY__) == LPTIM_CLOCKPOLARITY_FALLING) || \ | |||
| ((__POLARITY__) == LPTIM_CLOCKPOLARITY_RISING_FALLING)) | |||
| #define IS_LPTIM_TRG_SOURCE(__TRIG__) (((__TRIG__) == LPTIM_TRIGSOURCE_SOFTWARE) || \ | |||
| ((__TRIG__) == LPTIM_TRIGSOURCE_0) || \ | |||
| ((__TRIG__) == LPTIM_TRIGSOURCE_1) || \ | |||
| ((__TRIG__) == LPTIM_TRIGSOURCE_2) || \ | |||
| ((__TRIG__) == LPTIM_TRIGSOURCE_3) || \ | |||
| ((__TRIG__) == LPTIM_TRIGSOURCE_4) || \ | |||
| ((__TRIG__) == LPTIM_TRIGSOURCE_5)) | |||
| #define IS_LPTIM_EXT_TRG_POLARITY(__POLAR__) (((__POLAR__) == LPTIM_ACTIVEEDGE_RISING ) || \ | |||
| ((__POLAR__) == LPTIM_ACTIVEEDGE_FALLING ) || \ | |||
| ((__POLAR__) == LPTIM_ACTIVEEDGE_RISING_FALLING )) | |||
| #define IS_LPTIM_TRIG_SAMPLE_TIME(__SAMPLETIME__) (((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION) || \ | |||
| ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_2TRANSITIONS ) || \ | |||
| ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_4TRANSITIONS ) || \ | |||
| ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_8TRANSITIONS )) | |||
| #define IS_LPTIM_UPDATE_MODE(__MODE__) (((__MODE__) == LPTIM_UPDATE_IMMEDIATE) || \ | |||
| ((__MODE__) == LPTIM_UPDATE_ENDOFPERIOD)) | |||
| #define IS_LPTIM_COUNTER_SOURCE(__SOURCE__) (((__SOURCE__) == LPTIM_COUNTERSOURCE_INTERNAL) || \ | |||
| ((__SOURCE__) == LPTIM_COUNTERSOURCE_EXTERNAL)) | |||
| #define IS_LPTIM_AUTORELOAD(__AUTORELOAD__) ((__AUTORELOAD__) <= 0x0000FFFFU) | |||
| #define IS_LPTIM_COMPARE(__COMPARE__) ((__COMPARE__) <= 0x0000FFFFU) | |||
| #define IS_LPTIM_PERIOD(PERIOD) ((PERIOD) <= 0x0000FFFFU) | |||
| #define IS_LPTIM_PULSE(PULSE) ((PULSE) <= 0x0000FFFFU) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup LPTIM_Private_Functions LPTIM Private Functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx || STM32F413xx || STM32F423xx */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_LPTIM_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,660 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_ltdc.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of LTDC HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_LTDC_H | |||
| #define __STM32F4xx_HAL_LTDC_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #if defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @defgroup LTDC LTDC | |||
| * @brief LTDC HAL module driver | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup LTDC_Exported_Types LTDC Exported Types | |||
| * @{ | |||
| */ | |||
| #define MAX_LAYER 2 | |||
| /** | |||
| * @brief LTDC color structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint8_t Blue; /*!< Configures the blue value. | |||
| This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */ | |||
| uint8_t Green; /*!< Configures the green value. | |||
| This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */ | |||
| uint8_t Red; /*!< Configures the red value. | |||
| This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */ | |||
| uint8_t Reserved; /*!< Reserved 0xFF */ | |||
| } LTDC_ColorTypeDef; | |||
| /** | |||
| * @brief LTDC Init structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t HSPolarity; /*!< configures the horizontal synchronization polarity. | |||
| This parameter can be one value of @ref LTDC_HS_POLARITY */ | |||
| uint32_t VSPolarity; /*!< configures the vertical synchronization polarity. | |||
| This parameter can be one value of @ref LTDC_VS_POLARITY */ | |||
| uint32_t DEPolarity; /*!< configures the data enable polarity. | |||
| This parameter can be one of value of @ref LTDC_DE_POLARITY */ | |||
| uint32_t PCPolarity; /*!< configures the pixel clock polarity. | |||
| This parameter can be one of value of @ref LTDC_PC_POLARITY */ | |||
| uint32_t HorizontalSync; /*!< configures the number of Horizontal synchronization width. | |||
| This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */ | |||
| uint32_t VerticalSync; /*!< configures the number of Vertical synchronization height. | |||
| This parameter must be a number between Min_Data = 0x000 and Max_Data = 0x7FF. */ | |||
| uint32_t AccumulatedHBP; /*!< configures the accumulated horizontal back porch width. | |||
| This parameter must be a number between Min_Data = LTDC_HorizontalSync and Max_Data = 0xFFF. */ | |||
| uint32_t AccumulatedVBP; /*!< configures the accumulated vertical back porch height. | |||
| This parameter must be a number between Min_Data = LTDC_VerticalSync and Max_Data = 0x7FF. */ | |||
| uint32_t AccumulatedActiveW; /*!< configures the accumulated active width. | |||
| This parameter must be a number between Min_Data = LTDC_AccumulatedHBP and Max_Data = 0xFFF. */ | |||
| uint32_t AccumulatedActiveH; /*!< configures the accumulated active height. | |||
| This parameter must be a number between Min_Data = LTDC_AccumulatedVBP and Max_Data = 0x7FF. */ | |||
| uint32_t TotalWidth; /*!< configures the total width. | |||
| This parameter must be a number between Min_Data = LTDC_AccumulatedActiveW and Max_Data = 0xFFF. */ | |||
| uint32_t TotalHeigh; /*!< configures the total height. | |||
| This parameter must be a number between Min_Data = LTDC_AccumulatedActiveH and Max_Data = 0x7FF. */ | |||
| LTDC_ColorTypeDef Backcolor; /*!< Configures the background color. */ | |||
| } LTDC_InitTypeDef; | |||
| /** | |||
| * @brief LTDC Layer structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t WindowX0; /*!< Configures the Window Horizontal Start Position. | |||
| This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */ | |||
| uint32_t WindowX1; /*!< Configures the Window Horizontal Stop Position. | |||
| This parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF. */ | |||
| uint32_t WindowY0; /*!< Configures the Window vertical Start Position. | |||
| This parameter must be a number between Min_Data = 0x000 and Max_Data = 0x7FF. */ | |||
| uint32_t WindowY1; /*!< Configures the Window vertical Stop Position. | |||
| This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x7FF. */ | |||
| uint32_t PixelFormat; /*!< Specifies the pixel format. | |||
| This parameter can be one of value of @ref LTDC_Pixelformat */ | |||
| uint32_t Alpha; /*!< Specifies the constant alpha used for blending. | |||
| This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */ | |||
| uint32_t Alpha0; /*!< Configures the default alpha value. | |||
| This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */ | |||
| uint32_t BlendingFactor1; /*!< Select the blending factor 1. | |||
| This parameter can be one of value of @ref LTDC_BlendingFactor1 */ | |||
| uint32_t BlendingFactor2; /*!< Select the blending factor 2. | |||
| This parameter can be one of value of @ref LTDC_BlendingFactor2 */ | |||
| uint32_t FBStartAdress; /*!< Configures the color frame buffer address */ | |||
| uint32_t ImageWidth; /*!< Configures the color frame buffer line length. | |||
| This parameter must be a number between Min_Data = 0x0000U and Max_Data = 0x1FFF. */ | |||
| uint32_t ImageHeight; /*!< Specifies the number of line in frame buffer. | |||
| This parameter must be a number between Min_Data = 0x000 and Max_Data = 0x7FF. */ | |||
| LTDC_ColorTypeDef Backcolor; /*!< Configures the layer background color. */ | |||
| } LTDC_LayerCfgTypeDef; | |||
| /** | |||
| * @brief HAL LTDC State structures definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_LTDC_STATE_RESET = 0x00U, /*!< LTDC not yet initialized or disabled */ | |||
| HAL_LTDC_STATE_READY = 0x01U, /*!< LTDC initialized and ready for use */ | |||
| HAL_LTDC_STATE_BUSY = 0x02U, /*!< LTDC internal process is ongoing */ | |||
| HAL_LTDC_STATE_TIMEOUT = 0x03U, /*!< LTDC Timeout state */ | |||
| HAL_LTDC_STATE_ERROR = 0x04U /*!< LTDC state error */ | |||
| }HAL_LTDC_StateTypeDef; | |||
| /** | |||
| * @brief LTDC handle Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| LTDC_TypeDef *Instance; /*!< LTDC Register base address */ | |||
| LTDC_InitTypeDef Init; /*!< LTDC parameters */ | |||
| LTDC_LayerCfgTypeDef LayerCfg[MAX_LAYER]; /*!< LTDC Layers parameters */ | |||
| HAL_LockTypeDef Lock; /*!< LTDC Lock */ | |||
| __IO HAL_LTDC_StateTypeDef State; /*!< LTDC state */ | |||
| __IO uint32_t ErrorCode; /*!< LTDC Error code */ | |||
| } LTDC_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup LTDC_Exported_Constants LTDC Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup LTDC_Error_Code LTDC Error Code | |||
| * @{ | |||
| */ | |||
| #define HAL_LTDC_ERROR_NONE ((uint32_t)0x00000000U) /*!< LTDC No error */ | |||
| #define HAL_LTDC_ERROR_TE ((uint32_t)0x00000001U) /*!< LTDC Transfer error */ | |||
| #define HAL_LTDC_ERROR_FU ((uint32_t)0x00000002U) /*!< LTDC FIFO Underrun */ | |||
| #define HAL_LTDC_ERROR_TIMEOUT ((uint32_t)0x00000020U) /*!< LTDC Timeout error */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LTDC_HS_POLARITY LTDC HS POLARITY | |||
| * @{ | |||
| */ | |||
| #define LTDC_HSPOLARITY_AL ((uint32_t)0x00000000U) /*!< Horizontal Synchronization is active low. */ | |||
| #define LTDC_HSPOLARITY_AH LTDC_GCR_HSPOL /*!< Horizontal Synchronization is active high. */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LTDC_VS_POLARITY LTDC VS POLARITY | |||
| * @{ | |||
| */ | |||
| #define LTDC_VSPOLARITY_AL ((uint32_t)0x00000000U) /*!< Vertical Synchronization is active low. */ | |||
| #define LTDC_VSPOLARITY_AH LTDC_GCR_VSPOL /*!< Vertical Synchronization is active high. */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LTDC_DE_POLARITY LTDC DE POLARITY | |||
| * @{ | |||
| */ | |||
| #define LTDC_DEPOLARITY_AL ((uint32_t)0x00000000U) /*!< Data Enable, is active low. */ | |||
| #define LTDC_DEPOLARITY_AH LTDC_GCR_DEPOL /*!< Data Enable, is active high. */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LTDC_PC_POLARITY LTDC PC POLARITY | |||
| * @{ | |||
| */ | |||
| #define LTDC_PCPOLARITY_IPC ((uint32_t)0x00000000U) /*!< input pixel clock. */ | |||
| #define LTDC_PCPOLARITY_IIPC LTDC_GCR_PCPOL /*!< inverted input pixel clock. */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LTDC_SYNC LTDC SYNC | |||
| * @{ | |||
| */ | |||
| #define LTDC_HORIZONTALSYNC (LTDC_SSCR_HSW >> 16U) /*!< Horizontal synchronization width. */ | |||
| #define LTDC_VERTICALSYNC LTDC_SSCR_VSH /*!< Vertical synchronization height. */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LTDC_BACK_COLOR LTDC BACK COLOR | |||
| * @{ | |||
| */ | |||
| #define LTDC_COLOR ((uint32_t)0x000000FFU) /*!< Color mask */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LTDC_BlendingFactor1 LTDC Blending Factor1 | |||
| * @{ | |||
| */ | |||
| #define LTDC_BLENDING_FACTOR1_CA ((uint32_t)0x00000400U) /*!< Blending factor : Cte Alpha */ | |||
| #define LTDC_BLENDING_FACTOR1_PAxCA ((uint32_t)0x00000600U) /*!< Blending factor : Cte Alpha x Pixel Alpha*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LTDC_BlendingFactor2 LTDC Blending Factor2 | |||
| * @{ | |||
| */ | |||
| #define LTDC_BLENDING_FACTOR2_CA ((uint32_t)0x00000005U) /*!< Blending factor : Cte Alpha */ | |||
| #define LTDC_BLENDING_FACTOR2_PAxCA ((uint32_t)0x00000007U) /*!< Blending factor : Cte Alpha x Pixel Alpha*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LTDC_Pixelformat LTDC Pixel format | |||
| * @{ | |||
| */ | |||
| #define LTDC_PIXEL_FORMAT_ARGB8888 ((uint32_t)0x00000000U) /*!< ARGB8888 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_RGB888 ((uint32_t)0x00000001U) /*!< RGB888 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_RGB565 ((uint32_t)0x00000002U) /*!< RGB565 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_ARGB1555 ((uint32_t)0x00000003U) /*!< ARGB1555 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_ARGB4444 ((uint32_t)0x00000004U) /*!< ARGB4444 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_L8 ((uint32_t)0x00000005U) /*!< L8 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_AL44 ((uint32_t)0x00000006U) /*!< AL44 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_AL88 ((uint32_t)0x00000007U) /*!< AL88 LTDC pixel format */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LTDC_Alpha LTDC Alpha | |||
| * @{ | |||
| */ | |||
| #define LTDC_ALPHA LTDC_LxCACR_CONSTA /*!< LTDC Cte Alpha mask */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LTDC_LAYER_Config LTDC LAYER Config | |||
| * @{ | |||
| */ | |||
| #define LTDC_STOPPOSITION (LTDC_LxWHPCR_WHSPPOS >> 16U) /*!< LTDC Layer stop position */ | |||
| #define LTDC_STARTPOSITION LTDC_LxWHPCR_WHSTPOS /*!< LTDC Layer start position */ | |||
| #define LTDC_COLOR_FRAME_BUFFER LTDC_LxCFBLR_CFBLL /*!< LTDC Layer Line length */ | |||
| #define LTDC_LINE_NUMBER LTDC_LxCFBLNR_CFBLNBR /*!< LTDC Layer Line number */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LTDC_Interrupts LTDC Interrupts | |||
| * @{ | |||
| */ | |||
| #define LTDC_IT_LI LTDC_IER_LIE | |||
| #define LTDC_IT_FU LTDC_IER_FUIE | |||
| #define LTDC_IT_TE LTDC_IER_TERRIE | |||
| #define LTDC_IT_RR LTDC_IER_RRIE | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LTDC_Flag LTDC Flag | |||
| * @{ | |||
| */ | |||
| #define LTDC_FLAG_LI LTDC_ISR_LIF | |||
| #define LTDC_FLAG_FU LTDC_ISR_FUIF | |||
| #define LTDC_FLAG_TE LTDC_ISR_TERRIF | |||
| #define LTDC_FLAG_RR LTDC_ISR_RRIF | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LTDC_Reload_Type LTDC Reload Type | |||
| * @{ | |||
| */ | |||
| #define LTDC_RELOAD_IMMEDIATE LTDC_SRCR_IMR /*!< Immediate Reload */ | |||
| #define LTDC_RELOAD_VERTICAL_BLANKING LTDC_SRCR_VBR /*!< Vertical Blanking Reload */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup LTDC_Exported_Macros LTDC Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset LTDC handle state | |||
| * @param __HANDLE__: specifies the LTDC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LTDC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_LTDC_STATE_RESET) | |||
| /** | |||
| * @brief Enable the LTDC. | |||
| * @param __HANDLE__: LTDC handle | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LTDC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->GCR |= LTDC_GCR_LTDCEN) | |||
| /** | |||
| * @brief Disable the LTDC. | |||
| * @param __HANDLE__: LTDC handle | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LTDC_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->GCR &= ~(LTDC_GCR_LTDCEN)) | |||
| /** | |||
| * @brief Enable the LTDC Layer. | |||
| * @param __HANDLE__: LTDC handle | |||
| * @param __LAYER__: Specify the layer to be enabled | |||
| * This parameter can be 0 or 1 | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LTDC_LAYER_ENABLE(__HANDLE__, __LAYER__) ((LTDC_LAYER((__HANDLE__), (__LAYER__)))->CR |= (uint32_t)LTDC_LxCR_LEN) | |||
| /** | |||
| * @brief Disable the LTDC Layer. | |||
| * @param __HANDLE__: LTDC handle | |||
| * @param __LAYER__: Specify the layer to be disabled | |||
| * This parameter can be 0 or 1 | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LTDC_LAYER_DISABLE(__HANDLE__, __LAYER__) ((LTDC_LAYER((__HANDLE__), (__LAYER__)))->CR &= ~(uint32_t)LTDC_LxCR_LEN) | |||
| /** | |||
| * @brief Reload Layer Configuration. | |||
| * @param __HANDLE__: LTDC handle | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LTDC_RELOAD_CONFIG(__HANDLE__) ((__HANDLE__)->Instance->SRCR |= LTDC_SRCR_IMR) | |||
| /* Interrupt & Flag management */ | |||
| /** | |||
| * @brief Get the LTDC pending flags. | |||
| * @param __HANDLE__: LTDC handle | |||
| * @param __FLAG__: Get the specified flag. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg LTDC_FLAG_LI: Line Interrupt flag | |||
| * @arg LTDC_FLAG_FU: FIFO Underrun Interrupt flag | |||
| * @arg LTDC_FLAG_TE: Transfer Error interrupt flag | |||
| * @arg LTDC_FLAG_RR: Register Reload Interrupt Flag | |||
| * @retval The state of FLAG (SET or RESET). | |||
| */ | |||
| #define __HAL_LTDC_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR & (__FLAG__)) | |||
| /** | |||
| * @brief Clears the LTDC pending flags. | |||
| * @param __HANDLE__: LTDC handle | |||
| * @param __FLAG__: specifies the flag to clear. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg LTDC_FLAG_LI: Line Interrupt flag | |||
| * @arg LTDC_FLAG_FU: FIFO Underrun Interrupt flag | |||
| * @arg LTDC_FLAG_TE: Transfer Error interrupt flag | |||
| * @arg LTDC_FLAG_RR: Register Reload Interrupt Flag | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LTDC_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) | |||
| /** | |||
| * @brief Enables the specified LTDC interrupts. | |||
| * @param __HANDLE__: LTDC handle | |||
| * @param __INTERRUPT__: specifies the LTDC interrupt sources to be enabled. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg LTDC_IT_LI: Line Interrupt flag | |||
| * @arg LTDC_IT_FU: FIFO Underrun Interrupt flag | |||
| * @arg LTDC_IT_TE: Transfer Error interrupt flag | |||
| * @arg LTDC_IT_RR: Register Reload Interrupt Flag | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LTDC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__)) | |||
| /** | |||
| * @brief Disables the specified LTDC interrupts. | |||
| * @param __HANDLE__: LTDC handle | |||
| * @param __INTERRUPT__: specifies the LTDC interrupt sources to be disabled. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg LTDC_IT_LI: Line Interrupt flag | |||
| * @arg LTDC_IT_FU: FIFO Underrun Interrupt flag | |||
| * @arg LTDC_IT_TE: Transfer Error interrupt flag | |||
| * @arg LTDC_IT_RR: Register Reload Interrupt Flag | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LTDC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= ~(__INTERRUPT__)) | |||
| /** | |||
| * @brief Checks whether the specified LTDC interrupt has occurred or not. | |||
| * @param __HANDLE__: LTDC handle | |||
| * @param __INTERRUPT__: specifies the LTDC interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg LTDC_IT_LI: Line Interrupt flag | |||
| * @arg LTDC_IT_FU: FIFO Underrun Interrupt flag | |||
| * @arg LTDC_IT_TE: Transfer Error interrupt flag | |||
| * @arg LTDC_IT_RR: Register Reload Interrupt Flag | |||
| * @retval The state of INTERRUPT (SET or RESET). | |||
| */ | |||
| #define __HAL_LTDC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->ISR & (__INTERRUPT__)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Include LTDC HAL Extension module */ | |||
| #include "stm32f4xx_hal_ltdc_ex.h" | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup LTDC_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup LTDC_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| /* Initialization and de-initialization functions *****************************/ | |||
| HAL_StatusTypeDef HAL_LTDC_Init(LTDC_HandleTypeDef *hltdc); | |||
| HAL_StatusTypeDef HAL_LTDC_DeInit(LTDC_HandleTypeDef *hltdc); | |||
| void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc); | |||
| void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef* hltdc); | |||
| void HAL_LTDC_ErrorCallback(LTDC_HandleTypeDef *hltdc); | |||
| void HAL_LTDC_LineEventCallback(LTDC_HandleTypeDef *hltdc); | |||
| void HAL_LTDC_ReloadEventCallback(LTDC_HandleTypeDef *hltdc); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup LTDC_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| /* IO operation functions *****************************************************/ | |||
| void HAL_LTDC_IRQHandler(LTDC_HandleTypeDef *hltdc); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup LTDC_Exported_Functions_Group3 | |||
| * @{ | |||
| */ | |||
| /* Peripheral Control functions ***********************************************/ | |||
| HAL_StatusTypeDef HAL_LTDC_ConfigLayer(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_SetWindowSize(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_SetWindowPosition(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_SetPixelFormat(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_SetAlpha(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_SetAddress(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_SetPitch(LTDC_HandleTypeDef *hltdc, uint32_t LinePitchInPixels, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_ConfigCLUT(LTDC_HandleTypeDef *hltdc, uint32_t *pCLUT, uint32_t CLUTSize, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_EnableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_DisableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_EnableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_DisableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_ProgramLineEvent(LTDC_HandleTypeDef *hltdc, uint32_t Line); | |||
| HAL_StatusTypeDef HAL_LTDC_EnableDither(LTDC_HandleTypeDef *hltdc); | |||
| HAL_StatusTypeDef HAL_LTDC_DisableDither(LTDC_HandleTypeDef *hltdc); | |||
| HAL_StatusTypeDef HAL_LTDC_Relaod(LTDC_HandleTypeDef *hltdc, uint32_t ReloadType); | |||
| HAL_StatusTypeDef HAL_LTDC_ConfigLayer_NoReload(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_SetWindowSize_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_SetWindowPosition_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_SetPixelFormat_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_SetAlpha_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_SetAddress_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_SetPitch_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LinePitchInPixels, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_EnableColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_DisableColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_EnableCLUT_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); | |||
| HAL_StatusTypeDef HAL_LTDC_DisableCLUT_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup LTDC_Exported_Functions_Group4 | |||
| * @{ | |||
| */ | |||
| /* Peripheral State functions *************************************************/ | |||
| HAL_LTDC_StateTypeDef HAL_LTDC_GetState(LTDC_HandleTypeDef *hltdc); | |||
| uint32_t HAL_LTDC_GetError(LTDC_HandleTypeDef *hltdc); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /** @defgroup LTDC_Private_Types LTDC Private Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /** @defgroup LTDC_Private_Variables LTDC Private Variables | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup LTDC_Private_Constants LTDC Private Constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup LTDC_Private_Macros LTDC Private Macros | |||
| * @{ | |||
| */ | |||
| #define LTDC_LAYER(__HANDLE__, __LAYER__) ((LTDC_Layer_TypeDef *)((uint32_t)(((uint32_t)((__HANDLE__)->Instance)) + 0x84U + (0x80U * (__LAYER__))))) | |||
| #define IS_LTDC_LAYER(LAYER) ((LAYER) <= MAX_LAYER) | |||
| #define IS_LTDC_HSPOL(HSPOL) (((HSPOL) == LTDC_HSPOLARITY_AL) || \ | |||
| ((HSPOL) == LTDC_HSPOLARITY_AH)) | |||
| #define IS_LTDC_VSPOL(VSPOL) (((VSPOL) == LTDC_VSPOLARITY_AL) || \ | |||
| ((VSPOL) == LTDC_VSPOLARITY_AH)) | |||
| #define IS_LTDC_DEPOL(DEPOL) (((DEPOL) == LTDC_DEPOLARITY_AL) || \ | |||
| ((DEPOL) == LTDC_DEPOLARITY_AH)) | |||
| #define IS_LTDC_PCPOL(PCPOL) (((PCPOL) == LTDC_PCPOLARITY_IPC) || \ | |||
| ((PCPOL) == LTDC_PCPOLARITY_IIPC)) | |||
| #define IS_LTDC_HSYNC(HSYNC) ((HSYNC) <= LTDC_HORIZONTALSYNC) | |||
| #define IS_LTDC_VSYNC(VSYNC) ((VSYNC) <= LTDC_VERTICALSYNC) | |||
| #define IS_LTDC_AHBP(AHBP) ((AHBP) <= LTDC_HORIZONTALSYNC) | |||
| #define IS_LTDC_AVBP(AVBP) ((AVBP) <= LTDC_VERTICALSYNC) | |||
| #define IS_LTDC_AAW(AAW) ((AAW) <= LTDC_HORIZONTALSYNC) | |||
| #define IS_LTDC_AAH(AAH) ((AAH) <= LTDC_VERTICALSYNC) | |||
| #define IS_LTDC_TOTALW(TOTALW) ((TOTALW) <= LTDC_HORIZONTALSYNC) | |||
| #define IS_LTDC_TOTALH(TOTALH) ((TOTALH) <= LTDC_VERTICALSYNC) | |||
| #define IS_LTDC_BLUEVALUE(BBLUE) ((BBLUE) <= LTDC_COLOR) | |||
| #define IS_LTDC_GREENVALUE(BGREEN) ((BGREEN) <= LTDC_COLOR) | |||
| #define IS_LTDC_REDVALUE(BRED) ((BRED) <= LTDC_COLOR) | |||
| #define IS_LTDC_BLENDING_FACTOR1(BlendingFactor1) (((BlendingFactor1) == LTDC_BLENDING_FACTOR1_CA) || \ | |||
| ((BlendingFactor1) == LTDC_BLENDING_FACTOR1_PAxCA)) | |||
| #define IS_LTDC_BLENDING_FACTOR2(BlendingFactor2) (((BlendingFactor2) == LTDC_BLENDING_FACTOR2_CA) || \ | |||
| ((BlendingFactor2) == LTDC_BLENDING_FACTOR2_PAxCA)) | |||
| #define IS_LTDC_PIXEL_FORMAT(Pixelformat) (((Pixelformat) == LTDC_PIXEL_FORMAT_ARGB8888) || ((Pixelformat) == LTDC_PIXEL_FORMAT_RGB888) || \ | |||
| ((Pixelformat) == LTDC_PIXEL_FORMAT_RGB565) || ((Pixelformat) == LTDC_PIXEL_FORMAT_ARGB1555) || \ | |||
| ((Pixelformat) == LTDC_PIXEL_FORMAT_ARGB4444) || ((Pixelformat) == LTDC_PIXEL_FORMAT_L8) || \ | |||
| ((Pixelformat) == LTDC_PIXEL_FORMAT_AL44) || ((Pixelformat) == LTDC_PIXEL_FORMAT_AL88)) | |||
| #define IS_LTDC_ALPHA(ALPHA) ((ALPHA) <= LTDC_ALPHA) | |||
| #define IS_LTDC_HCONFIGST(HCONFIGST) ((HCONFIGST) <= LTDC_STARTPOSITION) | |||
| #define IS_LTDC_HCONFIGSP(HCONFIGSP) ((HCONFIGSP) <= LTDC_STOPPOSITION) | |||
| #define IS_LTDC_VCONFIGST(VCONFIGST) ((VCONFIGST) <= LTDC_STARTPOSITION) | |||
| #define IS_LTDC_VCONFIGSP(VCONFIGSP) ((VCONFIGSP) <= LTDC_STOPPOSITION) | |||
| #define IS_LTDC_CFBP(CFBP) ((CFBP) <= LTDC_COLOR_FRAME_BUFFER) | |||
| #define IS_LTDC_CFBLL(CFBLL) ((CFBLL) <= LTDC_COLOR_FRAME_BUFFER) | |||
| #define IS_LTDC_CFBLNBR(CFBLNBR) ((CFBLNBR) <= LTDC_LINE_NUMBER) | |||
| #define IS_LTDC_LIPOS(LIPOS) ((LIPOS) <= 0x7FFU) | |||
| #define IS_LTDC_RELAOD(RELOADTYPE) (((RELOADTYPE) == LTDC_RELOAD_IMMEDIATE) || ((RELOADTYPE) == LTDC_SRCR_VBR)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup LTDC_Private_Functions LTDC Private Functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_LTDC_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,151 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_ltdc_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of LTDC HAL Extension module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_LTDC_EX_H | |||
| #define __STM32F4xx_HAL_LTDC_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #if defined(STM32F469xx) || defined(STM32F479xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| #include "stm32f4xx_hal_dsi.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup LTDCEx | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup LTDCEx_Exported_Constants LTDCEx Exported Constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup LTDCEx_Exported_Macros LTDC Exported Macros | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @defgroup LTDCEx_Exported_Functions LTDC Extended Exported Functions | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_LTDC_StructInitFromVideoConfig(LTDC_HandleTypeDef* hltdc, DSI_VidCfgTypeDef *VidCfg); | |||
| HAL_StatusTypeDef HAL_LTDC_StructInitFromAdaptedCommandConfig(LTDC_HandleTypeDef* hltdc, DSI_CmdCfgTypeDef *CmdCfg); | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /** @defgroup LTDCEx_Private_Types LTDCEx Private Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /** @defgroup LTDCEx_Private_Variables LTDCEx Private Variables | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup LTDCEx_Private_Constants LTDCEx Private Constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup LTDCEx_Private_Macros LTDCEx Private Macros | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup LTDCEx_Private_Functions LTDCEx Private Functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F469xx || STM32F479xx */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_LTDC_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,318 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_nand.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of NAND HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_NAND_H | |||
| #define __STM32F4xx_HAL_NAND_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) | |||
| #include "stm32f4xx_ll_fsmc.h" | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */ | |||
| #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ | |||
| defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) | |||
| #include "stm32f4xx_ll_fmc.h" | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx ||\ | |||
| STM32F479xx */ | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup NAND | |||
| * @{ | |||
| */ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ | |||
| defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ | |||
| defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) | |||
| /* Exported typedef ----------------------------------------------------------*/ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup NAND_Exported_Types NAND Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief HAL NAND State structures definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_NAND_STATE_RESET = 0x00U, /*!< NAND not yet initialized or disabled */ | |||
| HAL_NAND_STATE_READY = 0x01U, /*!< NAND initialized and ready for use */ | |||
| HAL_NAND_STATE_BUSY = 0x02U, /*!< NAND internal process is ongoing */ | |||
| HAL_NAND_STATE_ERROR = 0x03U /*!< NAND error state */ | |||
| }HAL_NAND_StateTypeDef; | |||
| /** | |||
| * @brief NAND Memory electronic signature Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| /*<! NAND memory electronic signature maker and device IDs */ | |||
| uint8_t Maker_Id; | |||
| uint8_t Device_Id; | |||
| uint8_t Third_Id; | |||
| uint8_t Fourth_Id; | |||
| }NAND_IDTypeDef; | |||
| /** | |||
| * @brief NAND Memory address Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint16_t Page; /*!< NAND memory Page address */ | |||
| uint16_t Zone; /*!< NAND memory Zone address */ | |||
| uint16_t Block; /*!< NAND memory Block address */ | |||
| }NAND_AddressTypeDef; | |||
| /** | |||
| * @brief NAND Memory info Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t PageSize; /*!< NAND memory page (without spare area) size measured in K. bytes */ | |||
| uint32_t SpareAreaSize; /*!< NAND memory spare area size measured in K. bytes */ | |||
| uint32_t BlockSize; /*!< NAND memory block size number of pages */ | |||
| uint32_t BlockNbr; /*!< NAND memory number of blocks */ | |||
| uint32_t ZoneSize; /*!< NAND memory zone size measured in number of blocks */ | |||
| }NAND_InfoTypeDef; | |||
| /** | |||
| * @brief NAND handle Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| FMC_NAND_TypeDef *Instance; /*!< Register base address */ | |||
| FMC_NAND_InitTypeDef Init; /*!< NAND device control configuration parameters */ | |||
| HAL_LockTypeDef Lock; /*!< NAND locking object */ | |||
| __IO HAL_NAND_StateTypeDef State; /*!< NAND device access state */ | |||
| NAND_InfoTypeDef Info; /*!< NAND characteristic information structure */ | |||
| }NAND_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /* Exported macros ------------------------------------------------------------*/ | |||
| /** @defgroup NAND_Exported_Macros NAND Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset NAND handle state | |||
| * @param __HANDLE__: specifies the NAND handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_NAND_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_NAND_STATE_RESET) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup NAND_Exported_Functions NAND Exported Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup NAND_Exported_Functions_Group1 Initialization and de-initialization functions | |||
| * @{ | |||
| */ | |||
| /* Initialization/de-initialization functions ********************************/ | |||
| HAL_StatusTypeDef HAL_NAND_Init(NAND_HandleTypeDef *hnand, FMC_NAND_PCC_TimingTypeDef *ComSpace_Timing, FMC_NAND_PCC_TimingTypeDef *AttSpace_Timing); | |||
| HAL_StatusTypeDef HAL_NAND_DeInit(NAND_HandleTypeDef *hnand); | |||
| void HAL_NAND_MspInit(NAND_HandleTypeDef *hnand); | |||
| void HAL_NAND_MspDeInit(NAND_HandleTypeDef *hnand); | |||
| void HAL_NAND_IRQHandler(NAND_HandleTypeDef *hnand); | |||
| void HAL_NAND_ITCallback(NAND_HandleTypeDef *hnand); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup NAND_Exported_Functions_Group2 Input and Output functions | |||
| * @{ | |||
| */ | |||
| /* IO operation functions ****************************************************/ | |||
| HAL_StatusTypeDef HAL_NAND_Read_ID(NAND_HandleTypeDef *hnand, NAND_IDTypeDef *pNAND_ID); | |||
| HAL_StatusTypeDef HAL_NAND_Reset(NAND_HandleTypeDef *hnand); | |||
| HAL_StatusTypeDef HAL_NAND_Read_Page(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumPageToRead); | |||
| HAL_StatusTypeDef HAL_NAND_Write_Page(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumPageToWrite); | |||
| HAL_StatusTypeDef HAL_NAND_Read_SpareArea(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumSpareAreaToRead); | |||
| HAL_StatusTypeDef HAL_NAND_Write_SpareArea(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumSpareAreaTowrite); | |||
| HAL_StatusTypeDef HAL_NAND_Erase_Block(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress); | |||
| uint32_t HAL_NAND_Read_Status(NAND_HandleTypeDef *hnand); | |||
| uint32_t HAL_NAND_Address_Inc(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup NAND_Exported_Functions_Group3 Peripheral Control functions | |||
| * @{ | |||
| */ | |||
| /* NAND Control functions ****************************************************/ | |||
| HAL_StatusTypeDef HAL_NAND_ECC_Enable(NAND_HandleTypeDef *hnand); | |||
| HAL_StatusTypeDef HAL_NAND_ECC_Disable(NAND_HandleTypeDef *hnand); | |||
| HAL_StatusTypeDef HAL_NAND_GetECC(NAND_HandleTypeDef *hnand, uint32_t *ECCval, uint32_t Timeout); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup NAND_Exported_Functions_Group4 Peripheral State functions | |||
| * @{ | |||
| */ | |||
| /* NAND State functions *******************************************************/ | |||
| HAL_NAND_StateTypeDef HAL_NAND_GetState(NAND_HandleTypeDef *hnand); | |||
| uint32_t HAL_NAND_Read_Status(NAND_HandleTypeDef *hnand); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup NAND_Private_Constants NAND Private Constants | |||
| * @{ | |||
| */ | |||
| #define NAND_DEVICE1 ((uint32_t)0x70000000U) | |||
| #define NAND_DEVICE2 ((uint32_t)0x80000000U) | |||
| #define NAND_WRITE_TIMEOUT ((uint32_t)0x01000000U) | |||
| #define CMD_AREA ((uint32_t)(1U<<16U)) /* A16 = CLE high */ | |||
| #define ADDR_AREA ((uint32_t)(1U<<17U)) /* A17 = ALE high */ | |||
| #define NAND_CMD_AREA_A ((uint8_t)0x00U) | |||
| #define NAND_CMD_AREA_B ((uint8_t)0x01U) | |||
| #define NAND_CMD_AREA_C ((uint8_t)0x50U) | |||
| #define NAND_CMD_AREA_TRUE1 ((uint8_t)0x30U) | |||
| #define NAND_CMD_WRITE0 ((uint8_t)0x80U) | |||
| #define NAND_CMD_WRITE_TRUE1 ((uint8_t)0x10U) | |||
| #define NAND_CMD_ERASE0 ((uint8_t)0x60U) | |||
| #define NAND_CMD_ERASE1 ((uint8_t)0xD0U) | |||
| #define NAND_CMD_READID ((uint8_t)0x90U) | |||
| #define NAND_CMD_STATUS ((uint8_t)0x70U) | |||
| #define NAND_CMD_LOCK_STATUS ((uint8_t)0x7AU) | |||
| #define NAND_CMD_RESET ((uint8_t)0xFFU) | |||
| /* NAND memory status */ | |||
| #define NAND_VALID_ADDRESS ((uint32_t)0x00000100U) | |||
| #define NAND_INVALID_ADDRESS ((uint32_t)0x00000200U) | |||
| #define NAND_TIMEOUT_ERROR ((uint32_t)0x00000400U) | |||
| #define NAND_BUSY ((uint32_t)0x00000000U) | |||
| #define NAND_ERROR ((uint32_t)0x00000001U) | |||
| #define NAND_READY ((uint32_t)0x00000040U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup NAND_Private_Macros NAND Private Macros | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief NAND memory address computation. | |||
| * @param __ADDRESS__: NAND memory address. | |||
| * @param __HANDLE__: NAND handle. | |||
| * @retval NAND Raw address value | |||
| */ | |||
| #define ARRAY_ADDRESS(__ADDRESS__ , __HANDLE__) ((__ADDRESS__)->Page + \ | |||
| (((__ADDRESS__)->Block + (((__ADDRESS__)->Zone) * ((__HANDLE__)->Info.ZoneSize)))* ((__HANDLE__)->Info.BlockSize))) | |||
| /** | |||
| * @brief NAND memory address cycling. | |||
| * @param __ADDRESS__: NAND memory address. | |||
| * @retval NAND address cycling value. | |||
| */ | |||
| #define ADDR_1ST_CYCLE(__ADDRESS__) (uint8_t)(__ADDRESS__) /* 1st addressing cycle */ | |||
| #define ADDR_2ND_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 8U) /* 2nd addressing cycle */ | |||
| #define ADDR_3RD_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 16U) /* 3rd addressing cycle */ | |||
| #define ADDR_4TH_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 24U) /* 4th addressing cycle */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx ||\ | |||
| STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||\ | |||
| STM32F446xx || STM32F469xx || STM32F479xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_NAND_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,305 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_nor.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of NOR HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_NOR_H | |||
| #define __STM32F4xx_HAL_NOR_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| #include "stm32f4xx_ll_fsmc.h" | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F412Zx || STM32F412Vx || STM32F413xx || STM32F423xx */ | |||
| #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ | |||
| defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) | |||
| #include "stm32f4xx_ll_fmc.h" | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup NOR | |||
| * @{ | |||
| */ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ | |||
| defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ | |||
| defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /* Exported typedef ----------------------------------------------------------*/ | |||
| /** @defgroup NOR_Exported_Types NOR Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief HAL SRAM State structures definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_NOR_STATE_RESET = 0x00U, /*!< NOR not yet initialized or disabled */ | |||
| HAL_NOR_STATE_READY = 0x01U, /*!< NOR initialized and ready for use */ | |||
| HAL_NOR_STATE_BUSY = 0x02U, /*!< NOR internal processing is ongoing */ | |||
| HAL_NOR_STATE_ERROR = 0x03U, /*!< NOR error state */ | |||
| HAL_NOR_STATE_PROTECTED = 0x04U /*!< NOR NORSRAM device write protected */ | |||
| }HAL_NOR_StateTypeDef; | |||
| /** | |||
| * @brief FMC NOR Status typedef | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_NOR_STATUS_SUCCESS = 0U, | |||
| HAL_NOR_STATUS_ONGOING, | |||
| HAL_NOR_STATUS_ERROR, | |||
| HAL_NOR_STATUS_TIMEOUT | |||
| }HAL_NOR_StatusTypeDef; | |||
| /** | |||
| * @brief FMC NOR ID typedef | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint16_t Manufacturer_Code; /*!< Defines the device's manufacturer code used to identify the memory */ | |||
| uint16_t Device_Code1; | |||
| uint16_t Device_Code2; | |||
| uint16_t Device_Code3; /*!< Defines the device's codes used to identify the memory. | |||
| These codes can be accessed by performing read operations with specific | |||
| control signals and addresses set.They can also be accessed by issuing | |||
| an Auto Select command */ | |||
| }NOR_IDTypeDef; | |||
| /** | |||
| * @brief FMC NOR CFI typedef | |||
| */ | |||
| typedef struct | |||
| { | |||
| /*!< Defines the information stored in the memory's Common flash interface | |||
| which contains a description of various electrical and timing parameters, | |||
| density information and functions supported by the memory */ | |||
| uint16_t CFI_1; | |||
| uint16_t CFI_2; | |||
| uint16_t CFI_3; | |||
| uint16_t CFI_4; | |||
| }NOR_CFITypeDef; | |||
| /** | |||
| * @brief NOR handle Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| FMC_NORSRAM_TypeDef *Instance; /*!< Register base address */ | |||
| FMC_NORSRAM_EXTENDED_TypeDef *Extended; /*!< Extended mode register base address */ | |||
| FMC_NORSRAM_InitTypeDef Init; /*!< NOR device control configuration parameters */ | |||
| HAL_LockTypeDef Lock; /*!< NOR locking object */ | |||
| __IO HAL_NOR_StateTypeDef State; /*!< NOR device access state */ | |||
| }NOR_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /* Exported macros ------------------------------------------------------------*/ | |||
| /** @defgroup NOR_Exported_Macros NOR Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset NOR handle state | |||
| * @param __HANDLE__: specifies the NOR handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_NOR_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_NOR_STATE_RESET) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup NOR_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup NOR_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| /* Initialization/de-initialization functions ********************************/ | |||
| HAL_StatusTypeDef HAL_NOR_Init(NOR_HandleTypeDef *hnor, FMC_NORSRAM_TimingTypeDef *Timing, FMC_NORSRAM_TimingTypeDef *ExtTiming); | |||
| HAL_StatusTypeDef HAL_NOR_DeInit(NOR_HandleTypeDef *hnor); | |||
| void HAL_NOR_MspInit(NOR_HandleTypeDef *hnor); | |||
| void HAL_NOR_MspDeInit(NOR_HandleTypeDef *hnor); | |||
| void HAL_NOR_MspWait(NOR_HandleTypeDef *hnor, uint32_t Timeout); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup NOR_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| /* I/O operation functions ***************************************************/ | |||
| HAL_StatusTypeDef HAL_NOR_Read_ID(NOR_HandleTypeDef *hnor, NOR_IDTypeDef *pNOR_ID); | |||
| HAL_StatusTypeDef HAL_NOR_ReturnToReadMode(NOR_HandleTypeDef *hnor); | |||
| HAL_StatusTypeDef HAL_NOR_Read(NOR_HandleTypeDef *hnor, uint32_t *pAddress, uint16_t *pData); | |||
| HAL_StatusTypeDef HAL_NOR_Program(NOR_HandleTypeDef *hnor, uint32_t *pAddress, uint16_t *pData); | |||
| HAL_StatusTypeDef HAL_NOR_ReadBuffer(NOR_HandleTypeDef *hnor, uint32_t uwAddress, uint16_t *pData, uint32_t uwBufferSize); | |||
| HAL_StatusTypeDef HAL_NOR_ProgramBuffer(NOR_HandleTypeDef *hnor, uint32_t uwAddress, uint16_t *pData, uint32_t uwBufferSize); | |||
| HAL_StatusTypeDef HAL_NOR_Erase_Block(NOR_HandleTypeDef *hnor, uint32_t BlockAddress, uint32_t Address); | |||
| HAL_StatusTypeDef HAL_NOR_Erase_Chip(NOR_HandleTypeDef *hnor, uint32_t Address); | |||
| HAL_StatusTypeDef HAL_NOR_Read_CFI(NOR_HandleTypeDef *hnor, NOR_CFITypeDef *pNOR_CFI); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup NOR_Exported_Functions_Group3 | |||
| * @{ | |||
| */ | |||
| /* NOR Control functions *****************************************************/ | |||
| HAL_StatusTypeDef HAL_NOR_WriteOperation_Enable(NOR_HandleTypeDef *hnor); | |||
| HAL_StatusTypeDef HAL_NOR_WriteOperation_Disable(NOR_HandleTypeDef *hnor); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup NOR_Exported_Functions_Group4 | |||
| * @{ | |||
| */ | |||
| /* NOR State functions ********************************************************/ | |||
| HAL_NOR_StateTypeDef HAL_NOR_GetState(NOR_HandleTypeDef *hnor); | |||
| HAL_NOR_StatusTypeDef HAL_NOR_GetStatus(NOR_HandleTypeDef *hnor, uint32_t Address, uint32_t Timeout); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup NOR_Private_Constants NOR Private Constants | |||
| * @{ | |||
| */ | |||
| /* NOR device IDs addresses */ | |||
| #define MC_ADDRESS ((uint16_t)0x0000U) | |||
| #define DEVICE_CODE1_ADDR ((uint16_t)0x0001U) | |||
| #define DEVICE_CODE2_ADDR ((uint16_t)0x000EU) | |||
| #define DEVICE_CODE3_ADDR ((uint16_t)0x000FU) | |||
| /* NOR CFI IDs addresses */ | |||
| #define CFI1_ADDRESS ((uint16_t)0x0061U) | |||
| #define CFI2_ADDRESS ((uint16_t)0x0062U) | |||
| #define CFI3_ADDRESS ((uint16_t)0x0063U) | |||
| #define CFI4_ADDRESS ((uint16_t)0x0064U) | |||
| /* NOR operation wait timeout */ | |||
| #define NOR_TMEOUT ((uint16_t)0xFFFFU) | |||
| /* NOR memory data width */ | |||
| #define NOR_MEMORY_8B ((uint8_t)0x00U) | |||
| #define NOR_MEMORY_16B ((uint8_t)0x01U) | |||
| /* NOR memory device read/write start address */ | |||
| #define NOR_MEMORY_ADRESS1 ((uint32_t)0x60000000U) | |||
| #define NOR_MEMORY_ADRESS2 ((uint32_t)0x64000000U) | |||
| #define NOR_MEMORY_ADRESS3 ((uint32_t)0x68000000U) | |||
| #define NOR_MEMORY_ADRESS4 ((uint32_t)0x6C000000U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup NOR_Private_Macros NOR Private Macros | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief NOR memory address shifting. | |||
| * @param __NOR_ADDRESS__: NOR base address | |||
| * @param NOR_MEMORY_WIDTH: NOR memory width | |||
| * @param ADDRESS: NOR memory address | |||
| * @retval NOR shifted address value | |||
| */ | |||
| #define NOR_ADDR_SHIFT(__NOR_ADDRESS__, NOR_MEMORY_WIDTH, ADDRESS) (uint32_t)(((NOR_MEMORY_WIDTH) == NOR_MEMORY_16B)? ((uint32_t)((__NOR_ADDRESS__) + (2U * (ADDRESS)))):\ | |||
| ((uint32_t)((__NOR_ADDRESS__) + (ADDRESS)))) | |||
| /** | |||
| * @brief NOR memory write data to specified address. | |||
| * @param ADDRESS: NOR memory address | |||
| * @param DATA: Data to write | |||
| * @retval None | |||
| */ | |||
| #define NOR_WRITE(ADDRESS, DATA) (*(__IO uint16_t *)((uint32_t)(ADDRESS)) = (DATA)) | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx ||\ | |||
| STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||\ | |||
| STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ | |||
| STM32F412Vx || STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_NOR_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,266 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_pccard.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of PCCARD HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_PCCARD_H | |||
| #define __STM32F4xx_HAL_PCCARD_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) | |||
| #include "stm32f4xx_ll_fsmc.h" | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */ | |||
| #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) | |||
| #include "stm32f4xx_ll_fmc.h" | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ | |||
| defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) | |||
| /** @addtogroup PCCARD | |||
| * @{ | |||
| */ | |||
| /* Exported typedef ----------------------------------------------------------*/ | |||
| /** @defgroup PCCARD_Exported_Types PCCARD Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief HAL PCCARD State structures definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_PCCARD_STATE_RESET = 0x00U, /*!< PCCARD peripheral not yet initialized or disabled */ | |||
| HAL_PCCARD_STATE_READY = 0x01U, /*!< PCCARD peripheral ready */ | |||
| HAL_PCCARD_STATE_BUSY = 0x02U, /*!< PCCARD peripheral busy */ | |||
| HAL_PCCARD_STATE_ERROR = 0x04U /*!< PCCARD peripheral error */ | |||
| }HAL_PCCARD_StateTypeDef; | |||
| typedef enum | |||
| { | |||
| HAL_PCCARD_STATUS_SUCCESS = 0U, | |||
| HAL_PCCARD_STATUS_ONGOING, | |||
| HAL_PCCARD_STATUS_ERROR, | |||
| HAL_PCCARD_STATUS_TIMEOUT | |||
| }HAL_PCCARD_StatusTypeDef; | |||
| /** | |||
| * @brief FMC_PCCARD handle Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| FMC_PCCARD_TypeDef *Instance; /*!< Register base address for PCCARD device */ | |||
| FMC_PCCARD_InitTypeDef Init; /*!< PCCARD device control configuration parameters */ | |||
| __IO HAL_PCCARD_StateTypeDef State; /*!< PCCARD device access state */ | |||
| HAL_LockTypeDef Lock; /*!< PCCARD Lock */ | |||
| }PCCARD_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup PCCARD_Exported_Macros PCCARD Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset PCCARD handle state | |||
| * @param __HANDLE__: specifies the PCCARD handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_PCCARD_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_PCCARD_STATE_RESET) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup PCCARD_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup PCCARD_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| /* Initialization/de-initialization functions **********************************/ | |||
| HAL_StatusTypeDef HAL_PCCARD_Init(PCCARD_HandleTypeDef *hpccard, FMC_NAND_PCC_TimingTypeDef *ComSpaceTiming, FMC_NAND_PCC_TimingTypeDef *AttSpaceTiming, FMC_NAND_PCC_TimingTypeDef *IOSpaceTiming); | |||
| HAL_StatusTypeDef HAL_PCCARD_DeInit(PCCARD_HandleTypeDef *hpccard); | |||
| void HAL_PCCARD_MspInit(PCCARD_HandleTypeDef *hpccard); | |||
| void HAL_PCCARD_MspDeInit(PCCARD_HandleTypeDef *hpccard); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup PCCARD_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| /* IO operation functions *****************************************************/ | |||
| HAL_StatusTypeDef HAL_PCCARD_Read_ID(PCCARD_HandleTypeDef *hpccard, uint8_t CompactFlash_ID[], uint8_t *pStatus); | |||
| HAL_StatusTypeDef HAL_PCCARD_Write_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress, uint8_t *pStatus); | |||
| HAL_StatusTypeDef HAL_PCCARD_Read_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress, uint8_t *pStatus); | |||
| HAL_StatusTypeDef HAL_PCCARD_Erase_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t SectorAddress, uint8_t *pStatus); | |||
| HAL_StatusTypeDef HAL_PCCARD_Reset(PCCARD_HandleTypeDef *hpccard); | |||
| void HAL_PCCARD_IRQHandler(PCCARD_HandleTypeDef *hpccard); | |||
| void HAL_PCCARD_ITCallback(PCCARD_HandleTypeDef *hpccard); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup PCCARD_Exported_Functions_Group3 | |||
| * @{ | |||
| */ | |||
| /* PCCARD State functions *******************************************************/ | |||
| HAL_PCCARD_StateTypeDef HAL_PCCARD_GetState(PCCARD_HandleTypeDef *hpccard); | |||
| HAL_PCCARD_StatusTypeDef HAL_PCCARD_GetStatus(PCCARD_HandleTypeDef *hpccard); | |||
| HAL_PCCARD_StatusTypeDef HAL_PCCARD_ReadStatus(PCCARD_HandleTypeDef *hpccard); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup PCCARD_Private_Constants PCCARD Private Constants | |||
| * @{ | |||
| */ | |||
| #define PCCARD_DEVICE_ADDRESS ((uint32_t)0x90000000U) | |||
| #define PCCARD_ATTRIBUTE_SPACE_ADDRESS ((uint32_t)0x98000000U) /* Attribute space size to @0x9BFF FFFF */ | |||
| #define PCCARD_COMMON_SPACE_ADDRESS PCCARD_DEVICE_ADDRESS /* Common space size to @0x93FF FFFF */ | |||
| #define PCCARD_IO_SPACE_ADDRESS ((uint32_t)0x9C000000U) /* IO space size to @0x9FFF FFFF */ | |||
| #define PCCARD_IO_SPACE_PRIMARY_ADDR ((uint32_t)0x9C0001F0U) /* IO space size to @0x9FFF FFFF */ | |||
| /* Flash-ATA registers description */ | |||
| #define ATA_DATA ((uint8_t)0x00U) /* Data register */ | |||
| #define ATA_SECTOR_COUNT ((uint8_t)0x02U) /* Sector Count register */ | |||
| #define ATA_SECTOR_NUMBER ((uint8_t)0x03U) /* Sector Number register */ | |||
| #define ATA_CYLINDER_LOW ((uint8_t)0x04U) /* Cylinder low register */ | |||
| #define ATA_CYLINDER_HIGH ((uint8_t)0x05U) /* Cylinder high register */ | |||
| #define ATA_CARD_HEAD ((uint8_t)0x06U) /* Card/Head register */ | |||
| #define ATA_STATUS_CMD ((uint8_t)0x07U) /* Status(read)/Command(write) register */ | |||
| #define ATA_STATUS_CMD_ALTERNATE ((uint8_t)0x0EU) /* Alternate Status(read)/Command(write) register */ | |||
| #define ATA_COMMON_DATA_AREA ((uint16_t)0x0400U) /* Start of data area (for Common access only!) */ | |||
| #define ATA_CARD_CONFIGURATION ((uint16_t)0x0202U) /* Card Configuration and Status Register */ | |||
| /* Flash-ATA commands */ | |||
| #define ATA_READ_SECTOR_CMD ((uint8_t)0x20U) | |||
| #define ATA_WRITE_SECTOR_CMD ((uint8_t)0x30U) | |||
| #define ATA_ERASE_SECTOR_CMD ((uint8_t)0xC0) | |||
| #define ATA_IDENTIFY_CMD ((uint8_t)0xEC) | |||
| /* PC Card/Compact Flash status */ | |||
| #define PCCARD_TIMEOUT_ERROR ((uint8_t)0x60U) | |||
| #define PCCARD_BUSY ((uint8_t)0x80U) | |||
| #define PCCARD_PROGR ((uint8_t)0x01U) | |||
| #define PCCARD_READY ((uint8_t)0x40U) | |||
| #define PCCARD_SECTOR_SIZE ((uint32_t)255U) /* In half words */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Compact Flash redefinition */ | |||
| #define HAL_CF_Init HAL_PCCARD_Init | |||
| #define HAL_CF_DeInit HAL_PCCARD_DeInit | |||
| #define HAL_CF_MspInit HAL_PCCARD_MspInit | |||
| #define HAL_CF_MspDeInit HAL_PCCARD_MspDeInit | |||
| #define HAL_CF_Read_ID HAL_PCCARD_Read_ID | |||
| #define HAL_CF_Write_Sector HAL_PCCARD_Write_Sector | |||
| #define HAL_CF_Read_Sector HAL_PCCARD_Read_Sector | |||
| #define HAL_CF_Erase_Sector HAL_PCCARD_Erase_Sector | |||
| #define HAL_CF_Reset HAL_PCCARD_Reset | |||
| #define HAL_CF_IRQHandler HAL_PCCARD_IRQHandler | |||
| #define HAL_CF_ITCallback HAL_PCCARD_ITCallback | |||
| #define HAL_CF_GetState HAL_PCCARD_GetState | |||
| #define HAL_CF_GetStatus HAL_PCCARD_GetStatus | |||
| #define HAL_CF_ReadStatus HAL_PCCARD_ReadStatus | |||
| #define HAL_CF_STATUS_SUCCESS HAL_PCCARD_STATUS_SUCCESS | |||
| #define HAL_CF_STATUS_ONGOING HAL_PCCARD_STATUS_ONGOING | |||
| #define HAL_CF_STATUS_ERROR HAL_PCCARD_STATUS_ERROR | |||
| #define HAL_CF_STATUS_TIMEOUT HAL_PCCARD_STATUS_TIMEOUT | |||
| #define HAL_CF_StatusTypeDef HAL_PCCARD_StatusTypeDef | |||
| #define CF_DEVICE_ADDRESS PCCARD_DEVICE_ADDRESS | |||
| #define CF_ATTRIBUTE_SPACE_ADDRESS PCCARD_ATTRIBUTE_SPACE_ADDRESS | |||
| #define CF_COMMON_SPACE_ADDRESS PCCARD_COMMON_SPACE_ADDRESS | |||
| #define CF_IO_SPACE_ADDRESS PCCARD_IO_SPACE_ADDRESS | |||
| #define CF_IO_SPACE_PRIMARY_ADDR PCCARD_IO_SPACE_PRIMARY_ADDR | |||
| #define CF_TIMEOUT_ERROR PCCARD_TIMEOUT_ERROR | |||
| #define CF_BUSY PCCARD_BUSY | |||
| #define CF_PROGR PCCARD_PROGR | |||
| #define CF_READY PCCARD_READY | |||
| #define CF_SECTOR_SIZE PCCARD_SECTOR_SIZE | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx ||\ | |||
| STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_PCCARD_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_pcd.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of PCD HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -46,7 +46,7 @@ | |||
| defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \ | |||
| defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_ll_usb.h" | |||
| @@ -97,8 +97,8 @@ typedef struct | |||
| { | |||
| PCD_TypeDef *Instance; /*!< Register base address */ | |||
| PCD_InitTypeDef Init; /*!< PCD required parameters */ | |||
| PCD_EPTypeDef IN_ep[15]; /*!< IN endpoint parameters */ | |||
| PCD_EPTypeDef OUT_ep[15]; /*!< OUT endpoint parameters */ | |||
| PCD_EPTypeDef IN_ep[16]; /*!< IN endpoint parameters */ | |||
| PCD_EPTypeDef OUT_ep[16]; /*!< OUT endpoint parameters */ | |||
| HAL_LockTypeDef Lock; /*!< PCD peripheral status */ | |||
| __IO PCD_StateTypeDef State; /*!< PCD communication state */ | |||
| uint32_t Setup[12]; /*!< Setup packet buffer */ | |||
| @@ -332,7 +332,7 @@ PCD_StateTypeDef HAL_PCD_GetState(PCD_HandleTypeDef *hpcd); | |||
| */ | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || | |||
| STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Rx || | |||
| STM32F412Vx || STM32F412Cx */ | |||
| STM32F412Vx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_pcd_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of PCD HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -46,7 +46,7 @@ | |||
| defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \ | |||
| defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| @@ -59,15 +59,15 @@ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| #if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| typedef enum | |||
| { | |||
| PCD_LPM_L0_ACTIVE = 0x00U, /* on */ | |||
| PCD_LPM_L1_ACTIVE = 0x01U /* LPM L1 sleep */ | |||
| }PCD_LPM_MsgTypeDef; | |||
| #endif /* STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Rx || STM32F412Vx || STM32F412Cx */ | |||
| #endif /* STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Rx || STM32F412Vx || STM32F412Cx || STM32F413xx || STM32F423xx*/ | |||
| #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| typedef enum | |||
| { | |||
| PCD_BCD_ERROR = 0xFFU, | |||
| @@ -77,7 +77,7 @@ typedef enum | |||
| PCD_BCD_DEDICATED_CHARGING_PORT = 0xFBU, | |||
| PCD_BCD_DISCOVERY_COMPLETED = 0x00U | |||
| }PCD_BCD_MsgTypeDef; | |||
| #endif /* STM32F412Zx || STM32F412Rx || STM32F412Vx || STM32F412Cx */ | |||
| #endif /* STM32F412Zx || STM32F412Rx || STM32F412Vx || STM32F412Cx || STM32F413xx || STM32F423xx*/ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /* Exported macros -----------------------------------------------------------*/ | |||
| @@ -91,19 +91,19 @@ typedef enum | |||
| HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size); | |||
| HAL_StatusTypeDef HAL_PCDEx_SetRxFiFo(PCD_HandleTypeDef *hpcd, uint16_t size); | |||
| #if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd); | |||
| HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd); | |||
| void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg); | |||
| #endif /* STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Rx || STM32F412Vx || STM32F412Cx */ | |||
| #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| #endif /* STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Rx || STM32F412Vx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd); | |||
| HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd); | |||
| void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd); | |||
| void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg); | |||
| void HAL_PCDEx_ADP_Sensing_Start(PCD_HandleTypeDef *hpcd); | |||
| void HAL_PCDEx_ADP_Sensing_Callback(PCD_HandleTypeDef *hpcd); | |||
| #endif /* STM32F412Zx || STM32F412Rx || STM32F412Vx || STM32F412Cx */ | |||
| #endif /* STM32F412Zx || STM32F412Rx || STM32F412Vx || STM32F412Cx || STM32F413xx || STM32F423xx*/ | |||
| /** | |||
| * @} | |||
| @@ -122,7 +122,7 @@ void HAL_PCDEx_ADP_Sensing_Callback(PCD_HandleTypeDef *hpcd); | |||
| */ | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || | |||
| STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Rx || | |||
| STM32F412Vx || STM32F412Cx */ | |||
| STM32F412Vx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_pwr.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of PWR HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_pwr_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of PWR HAL Extension module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -99,20 +99,21 @@ | |||
| * @} | |||
| */ | |||
| #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /** @defgroup PWREx_WakeUp_Pins PWREx WakeUp Pins | |||
| * @{ | |||
| */ | |||
| #define PWR_WAKEUP_PIN2 ((uint32_t)0x00000080U) | |||
| #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define PWR_WAKEUP_PIN3 ((uint32_t)0x00000040U) | |||
| #endif /* STM32F410xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Zx || STM32F412Vx || \ | |||
| STM32F412Rx || STM32F412Cx */ | |||
| STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F410xx || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| #endif /* STM32F410xx || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || | |||
| STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| @@ -233,13 +234,13 @@ void HAL_PWREx_EnableWakeUpPinPolarityFallingEdge(void); | |||
| #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F401xC) ||\ | |||
| defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\ | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| void HAL_PWREx_EnableMainRegulatorLowVoltage(void); | |||
| void HAL_PWREx_DisableMainRegulatorLowVoltage(void); | |||
| void HAL_PWREx_EnableLowRegulatorLowVoltage(void); | |||
| void HAL_PWREx_DisableLowRegulatorLowVoltage(void); | |||
| #endif /* STM32F410xx || STM32F401xC || STM32F401xE || STM32F411xE || STM32F412Zx || STM32F412Vx ||\ | |||
| STM32F412Rx || STM32F412Cx */ | |||
| STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) ||\ | |||
| defined(STM32F469xx) || defined(STM32F479xx) | |||
| @@ -337,8 +338,9 @@ HAL_StatusTypeDef HAL_PWREx_EnterUnderDriveSTOPMode(uint32_t Regulator, uint8_t | |||
| #if defined(STM32F446xx) | |||
| #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || ((PIN) == PWR_WAKEUP_PIN2)) | |||
| #elif defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| #elif defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ | |||
| defined(STM32F423xx) | |||
| #define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || ((PIN) == PWR_WAKEUP_PIN2) || \ | |||
| ((PIN) == PWR_WAKEUP_PIN3)) | |||
| #else | |||
| @@ -0,0 +1,785 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_qspi.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of QSPI HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_QSPI_H | |||
| #define __STM32F4xx_HAL_QSPI_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ | |||
| defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup QSPI | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup QSPI_Exported_Types QSPI Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief QSPI Init structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t ClockPrescaler; /* Specifies the prescaler factor for generating clock based on the AHB clock. | |||
| This parameter can be a number between 0 and 255 */ | |||
| uint32_t FifoThreshold; /* Specifies the threshold number of bytes in the FIFO (used only in indirect mode) | |||
| This parameter can be a value between 1 and 32 */ | |||
| uint32_t SampleShifting; /* Specifies the Sample Shift. The data is sampled 1/2 clock cycle delay later to | |||
| take in account external signal delays. (It should be QSPI_SAMPLE_SHIFTING_NONE in DDR mode) | |||
| This parameter can be a value of @ref QSPI_SampleShifting */ | |||
| uint32_t FlashSize; /* Specifies the Flash Size. FlashSize+1 is effectively the number of address bits | |||
| required to address the flash memory. The flash capacity can be up to 4GB | |||
| (addressed using 32 bits) in indirect mode, but the addressable space in | |||
| memory-mapped mode is limited to 256MB | |||
| This parameter can be a number between 0 and 31 */ | |||
| uint32_t ChipSelectHighTime; /* Specifies the Chip Select High Time. ChipSelectHighTime+1 defines the minimum number | |||
| of clock cycles which the chip select must remain high between commands. | |||
| This parameter can be a value of @ref QSPI_ChipSelectHighTime */ | |||
| uint32_t ClockMode; /* Specifies the Clock Mode. It indicates the level that clock takes between commands. | |||
| This parameter can be a value of @ref QSPI_ClockMode */ | |||
| uint32_t FlashID; /* Specifies the Flash which will be used, | |||
| This parameter can be a value of @ref QSPI_Flash_Select */ | |||
| uint32_t DualFlash; /* Specifies the Dual Flash Mode State | |||
| This parameter can be a value of @ref QSPI_DualFlash_Mode */ | |||
| }QSPI_InitTypeDef; | |||
| /** | |||
| * @brief HAL QSPI State structures definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_QSPI_STATE_RESET = 0x00U, /*!< Peripheral not initialized */ | |||
| HAL_QSPI_STATE_READY = 0x01U, /*!< Peripheral initialized and ready for use */ | |||
| HAL_QSPI_STATE_BUSY = 0x02U, /*!< Peripheral in indirect mode and busy */ | |||
| HAL_QSPI_STATE_BUSY_INDIRECT_TX = 0x12U, /*!< Peripheral in indirect mode with transmission ongoing */ | |||
| HAL_QSPI_STATE_BUSY_INDIRECT_RX = 0x22U, /*!< Peripheral in indirect mode with reception ongoing */ | |||
| HAL_QSPI_STATE_BUSY_AUTO_POLLING = 0x42U, /*!< Peripheral in auto polling mode ongoing */ | |||
| HAL_QSPI_STATE_BUSY_MEM_MAPPED = 0x82U, /*!< Peripheral in memory mapped mode ongoing */ | |||
| HAL_QSPI_STATE_ABORT = 0x08U, /*!< Peripheral with abort request ongoing */ | |||
| HAL_QSPI_STATE_ERROR = 0x04U /*!< Peripheral in error */ | |||
| }HAL_QSPI_StateTypeDef; | |||
| /** | |||
| * @brief QSPI Handle Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| QUADSPI_TypeDef *Instance; /* QSPI registers base address */ | |||
| QSPI_InitTypeDef Init; /* QSPI communication parameters */ | |||
| uint8_t *pTxBuffPtr; /* Pointer to QSPI Tx transfer Buffer */ | |||
| __IO uint16_t TxXferSize; /* QSPI Tx Transfer size */ | |||
| __IO uint16_t TxXferCount; /* QSPI Tx Transfer Counter */ | |||
| uint8_t *pRxBuffPtr; /* Pointer to QSPI Rx transfer Buffer */ | |||
| __IO uint16_t RxXferSize; /* QSPI Rx Transfer size */ | |||
| __IO uint16_t RxXferCount; /* QSPI Rx Transfer Counter */ | |||
| DMA_HandleTypeDef *hdma; /* QSPI Rx/Tx DMA Handle parameters */ | |||
| __IO HAL_LockTypeDef Lock; /* Locking object */ | |||
| __IO HAL_QSPI_StateTypeDef State; /* QSPI communication state */ | |||
| __IO uint32_t ErrorCode; /* QSPI Error code */ | |||
| uint32_t Timeout; /* Timeout for the QSPI memory access */ | |||
| }QSPI_HandleTypeDef; | |||
| /** | |||
| * @brief QSPI Command structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t Instruction; /* Specifies the Instruction to be sent | |||
| This parameter can be a value (8-bit) between 0x00 and 0xFF */ | |||
| uint32_t Address; /* Specifies the Address to be sent (Size from 1 to 4 bytes according AddressSize) | |||
| This parameter can be a value (32-bits) between 0x0 and 0xFFFFFFFFU */ | |||
| uint32_t AlternateBytes; /* Specifies the Alternate Bytes to be sent (Size from 1 to 4 bytes according AlternateBytesSize) | |||
| This parameter can be a value (32-bits) between 0x0 and 0xFFFFFFFFU */ | |||
| uint32_t AddressSize; /* Specifies the Address Size | |||
| This parameter can be a value of @ref QSPI_AddressSize */ | |||
| uint32_t AlternateBytesSize; /* Specifies the Alternate Bytes Size | |||
| This parameter can be a value of @ref QSPI_AlternateBytesSize */ | |||
| uint32_t DummyCycles; /* Specifies the Number of Dummy Cycles. | |||
| This parameter can be a number between 0 and 31 */ | |||
| uint32_t InstructionMode; /* Specifies the Instruction Mode | |||
| This parameter can be a value of @ref QSPI_InstructionMode */ | |||
| uint32_t AddressMode; /* Specifies the Address Mode | |||
| This parameter can be a value of @ref QSPI_AddressMode */ | |||
| uint32_t AlternateByteMode; /* Specifies the Alternate Bytes Mode | |||
| This parameter can be a value of @ref QSPI_AlternateBytesMode */ | |||
| uint32_t DataMode; /* Specifies the Data Mode (used for dummy cycles and data phases) | |||
| This parameter can be a value of @ref QSPI_DataMode */ | |||
| uint32_t NbData; /* Specifies the number of data to transfer. | |||
| This parameter can be any value between 0 and 0xFFFFFFFFU (0 means undefined length | |||
| until end of memory)*/ | |||
| uint32_t DdrMode; /* Specifies the double data rate mode for address, alternate byte and data phase | |||
| This parameter can be a value of @ref QSPI_DdrMode */ | |||
| uint32_t DdrHoldHalfCycle; /* Specifies the DDR hold half cycle. It delays the data output by one half of | |||
| system clock in DDR mode. | |||
| This parameter can be a value of @ref QSPI_DdrHoldHalfCycle */ | |||
| uint32_t SIOOMode; /* Specifies the send instruction only once mode | |||
| This parameter can be a value of @ref QSPI_SIOOMode */ | |||
| }QSPI_CommandTypeDef; | |||
| /** | |||
| * @brief QSPI Auto Polling mode configuration structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t Match; /* Specifies the value to be compared with the masked status register to get a match. | |||
| This parameter can be any value between 0 and 0xFFFFFFFFU */ | |||
| uint32_t Mask; /* Specifies the mask to be applied to the status bytes received. | |||
| This parameter can be any value between 0 and 0xFFFFFFFFU */ | |||
| uint32_t Interval; /* Specifies the number of clock cycles between two read during automatic polling phases. | |||
| This parameter can be any value between 0 and 0xFFFFU */ | |||
| uint32_t StatusBytesSize; /* Specifies the size of the status bytes received. | |||
| This parameter can be any value between 1 and 4 */ | |||
| uint32_t MatchMode; /* Specifies the method used for determining a match. | |||
| This parameter can be a value of @ref QSPI_MatchMode */ | |||
| uint32_t AutomaticStop; /* Specifies if automatic polling is stopped after a match. | |||
| This parameter can be a value of @ref QSPI_AutomaticStop */ | |||
| }QSPI_AutoPollingTypeDef; | |||
| /** | |||
| * @brief QSPI Memory Mapped mode configuration structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t TimeOutPeriod; /* Specifies the number of clock to wait when the FIFO is full before to release the chip select. | |||
| This parameter can be any value between 0 and 0xFFFFU */ | |||
| uint32_t TimeOutActivation; /* Specifies if the time out counter is enabled to release the chip select. | |||
| This parameter can be a value of @ref QSPI_TimeOutActivation */ | |||
| }QSPI_MemoryMappedTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup QSPI_Exported_Constants QSPI Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup QSPI_ErrorCode QSPI Error Code | |||
| * @{ | |||
| */ | |||
| #define HAL_QSPI_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */ | |||
| #define HAL_QSPI_ERROR_TIMEOUT ((uint32_t)0x00000001U) /*!< Timeout error */ | |||
| #define HAL_QSPI_ERROR_TRANSFER ((uint32_t)0x00000002U) /*!< Transfer error */ | |||
| #define HAL_QSPI_ERROR_DMA ((uint32_t)0x00000004U) /*!< DMA transfer error */ | |||
| #define HAL_QSPI_ERROR_INVALID_PARAM ((uint32_t)0x00000008U) /*!< Invalid parameters error */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_SampleShifting QSPI Sample Shifting | |||
| * @{ | |||
| */ | |||
| #define QSPI_SAMPLE_SHIFTING_NONE ((uint32_t)0x00000000U) /*!<No clock cycle shift to sample data*/ | |||
| #define QSPI_SAMPLE_SHIFTING_HALFCYCLE ((uint32_t)QUADSPI_CR_SSHIFT) /*!<1/2 clock cycle shift to sample data*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_ChipSelectHighTime QSPI Chip Select High Time | |||
| * @{ | |||
| */ | |||
| #define QSPI_CS_HIGH_TIME_1_CYCLE ((uint32_t)0x00000000U) /*!<nCS stay high for at least 1 clock cycle between commands*/ | |||
| #define QSPI_CS_HIGH_TIME_2_CYCLE ((uint32_t)QUADSPI_DCR_CSHT_0) /*!<nCS stay high for at least 2 clock cycles between commands*/ | |||
| #define QSPI_CS_HIGH_TIME_3_CYCLE ((uint32_t)QUADSPI_DCR_CSHT_1) /*!<nCS stay high for at least 3 clock cycles between commands*/ | |||
| #define QSPI_CS_HIGH_TIME_4_CYCLE ((uint32_t)QUADSPI_DCR_CSHT_0 | QUADSPI_DCR_CSHT_1) /*!<nCS stay high for at least 4 clock cycles between commands*/ | |||
| #define QSPI_CS_HIGH_TIME_5_CYCLE ((uint32_t)QUADSPI_DCR_CSHT_2) /*!<nCS stay high for at least 5 clock cycles between commands*/ | |||
| #define QSPI_CS_HIGH_TIME_6_CYCLE ((uint32_t)QUADSPI_DCR_CSHT_2 | QUADSPI_DCR_CSHT_0) /*!<nCS stay high for at least 6 clock cycles between commands*/ | |||
| #define QSPI_CS_HIGH_TIME_7_CYCLE ((uint32_t)QUADSPI_DCR_CSHT_2 | QUADSPI_DCR_CSHT_1) /*!<nCS stay high for at least 7 clock cycles between commands*/ | |||
| #define QSPI_CS_HIGH_TIME_8_CYCLE ((uint32_t)QUADSPI_DCR_CSHT) /*!<nCS stay high for at least 8 clock cycles between commands*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_ClockMode QSPI Clock Mode | |||
| * @{ | |||
| */ | |||
| #define QSPI_CLOCK_MODE_0 ((uint32_t)0x00000000U) /*!<Clk stays low while nCS is released*/ | |||
| #define QSPI_CLOCK_MODE_3 ((uint32_t)QUADSPI_DCR_CKMODE) /*!<Clk goes high while nCS is released*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_Flash_Select QSPI Flash Select | |||
| * @{ | |||
| */ | |||
| #define QSPI_FLASH_ID_1 ((uint32_t)0x00000000U) | |||
| #define QSPI_FLASH_ID_2 ((uint32_t)QUADSPI_CR_FSEL) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_DualFlash_Mode QSPI Dual Flash Mode | |||
| * @{ | |||
| */ | |||
| #define QSPI_DUALFLASH_ENABLE ((uint32_t)QUADSPI_CR_DFM) | |||
| #define QSPI_DUALFLASH_DISABLE ((uint32_t)0x00000000U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_AddressSize QSPI Address Size | |||
| * @{ | |||
| */ | |||
| #define QSPI_ADDRESS_8_BITS ((uint32_t)0x00000000U) /*!<8-bit address*/ | |||
| #define QSPI_ADDRESS_16_BITS ((uint32_t)QUADSPI_CCR_ADSIZE_0) /*!<16-bit address*/ | |||
| #define QSPI_ADDRESS_24_BITS ((uint32_t)QUADSPI_CCR_ADSIZE_1) /*!<24-bit address*/ | |||
| #define QSPI_ADDRESS_32_BITS ((uint32_t)QUADSPI_CCR_ADSIZE) /*!<32-bit address*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_AlternateBytesSize QSPI Alternate Bytes Size | |||
| * @{ | |||
| */ | |||
| #define QSPI_ALTERNATE_BYTES_8_BITS ((uint32_t)0x00000000U) /*!<8-bit alternate bytes*/ | |||
| #define QSPI_ALTERNATE_BYTES_16_BITS ((uint32_t)QUADSPI_CCR_ABSIZE_0) /*!<16-bit alternate bytes*/ | |||
| #define QSPI_ALTERNATE_BYTES_24_BITS ((uint32_t)QUADSPI_CCR_ABSIZE_1) /*!<24-bit alternate bytes*/ | |||
| #define QSPI_ALTERNATE_BYTES_32_BITS ((uint32_t)QUADSPI_CCR_ABSIZE) /*!<32-bit alternate bytes*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_InstructionMode QSPI Instruction Mode | |||
| * @{ | |||
| */ | |||
| #define QSPI_INSTRUCTION_NONE ((uint32_t)0x00000000U) /*!<No instruction*/ | |||
| #define QSPI_INSTRUCTION_1_LINE ((uint32_t)QUADSPI_CCR_IMODE_0) /*!<Instruction on a single line*/ | |||
| #define QSPI_INSTRUCTION_2_LINES ((uint32_t)QUADSPI_CCR_IMODE_1) /*!<Instruction on two lines*/ | |||
| #define QSPI_INSTRUCTION_4_LINES ((uint32_t)QUADSPI_CCR_IMODE) /*!<Instruction on four lines*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_AddressMode QSPI Address Mode | |||
| * @{ | |||
| */ | |||
| #define QSPI_ADDRESS_NONE ((uint32_t)0x00000000U) /*!<No address*/ | |||
| #define QSPI_ADDRESS_1_LINE ((uint32_t)QUADSPI_CCR_ADMODE_0) /*!<Address on a single line*/ | |||
| #define QSPI_ADDRESS_2_LINES ((uint32_t)QUADSPI_CCR_ADMODE_1) /*!<Address on two lines*/ | |||
| #define QSPI_ADDRESS_4_LINES ((uint32_t)QUADSPI_CCR_ADMODE) /*!<Address on four lines*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_AlternateBytesMode QSPI Alternate Bytes Mode | |||
| * @{ | |||
| */ | |||
| #define QSPI_ALTERNATE_BYTES_NONE ((uint32_t)0x00000000U) /*!<No alternate bytes*/ | |||
| #define QSPI_ALTERNATE_BYTES_1_LINE ((uint32_t)QUADSPI_CCR_ABMODE_0) /*!<Alternate bytes on a single line*/ | |||
| #define QSPI_ALTERNATE_BYTES_2_LINES ((uint32_t)QUADSPI_CCR_ABMODE_1) /*!<Alternate bytes on two lines*/ | |||
| #define QSPI_ALTERNATE_BYTES_4_LINES ((uint32_t)QUADSPI_CCR_ABMODE) /*!<Alternate bytes on four lines*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_DataMode QSPI Data Mode | |||
| * @{ | |||
| */ | |||
| #define QSPI_DATA_NONE ((uint32_t)0x00000000U) /*!<No data*/ | |||
| #define QSPI_DATA_1_LINE ((uint32_t)QUADSPI_CCR_DMODE_0) /*!<Data on a single line*/ | |||
| #define QSPI_DATA_2_LINES ((uint32_t)QUADSPI_CCR_DMODE_1) /*!<Data on two lines*/ | |||
| #define QSPI_DATA_4_LINES ((uint32_t)QUADSPI_CCR_DMODE) /*!<Data on four lines*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_DdrMode QSPI Ddr Mode | |||
| * @{ | |||
| */ | |||
| #define QSPI_DDR_MODE_DISABLE ((uint32_t)0x00000000U) /*!<Double data rate mode disabled*/ | |||
| #define QSPI_DDR_MODE_ENABLE ((uint32_t)QUADSPI_CCR_DDRM) /*!<Double data rate mode enabled*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_DdrHoldHalfCycle QSPI Ddr HoldHalfCycle | |||
| * @{ | |||
| */ | |||
| #define QSPI_DDR_HHC_ANALOG_DELAY ((uint32_t)0x00000000U) /*!<Delay the data output using analog delay in DDR mode*/ | |||
| #define QSPI_DDR_HHC_HALF_CLK_DELAY ((uint32_t)QUADSPI_CCR_DHHC) /*!<Delay the data output by 1/2 clock cycle in DDR mode*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_SIOOMode QSPI SIOO Mode | |||
| * @{ | |||
| */ | |||
| #define QSPI_SIOO_INST_EVERY_CMD ((uint32_t)0x00000000U) /*!<Send instruction on every transaction*/ | |||
| #define QSPI_SIOO_INST_ONLY_FIRST_CMD ((uint32_t)QUADSPI_CCR_SIOO) /*!<Send instruction only for the first command*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_MatchMode QSPI Match Mode | |||
| * @{ | |||
| */ | |||
| #define QSPI_MATCH_MODE_AND ((uint32_t)0x00000000U) /*!<AND match mode between unmasked bits*/ | |||
| #define QSPI_MATCH_MODE_OR ((uint32_t)QUADSPI_CR_PMM) /*!<OR match mode between unmasked bits*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_AutomaticStop QSPI Automatic Stop | |||
| * @{ | |||
| */ | |||
| #define QSPI_AUTOMATIC_STOP_DISABLE ((uint32_t)0x00000000U) /*!<AutoPolling stops only with abort or QSPI disabling*/ | |||
| #define QSPI_AUTOMATIC_STOP_ENABLE ((uint32_t)QUADSPI_CR_APMS) /*!<AutoPolling stops as soon as there is a match*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_TimeOutActivation QSPI TimeOut Activation | |||
| * @{ | |||
| */ | |||
| #define QSPI_TIMEOUT_COUNTER_DISABLE ((uint32_t)0x00000000U) /*!<Timeout counter disabled, nCS remains active*/ | |||
| #define QSPI_TIMEOUT_COUNTER_ENABLE ((uint32_t)QUADSPI_CR_TCEN) /*!<Timeout counter enabled, nCS released when timeout expires*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_Flags QSPI Flags | |||
| * @{ | |||
| */ | |||
| #define QSPI_FLAG_BUSY QUADSPI_SR_BUSY /*!<Busy flag: operation is ongoing*/ | |||
| #define QSPI_FLAG_TO QUADSPI_SR_TOF /*!<Timeout flag: timeout occurs in memory-mapped mode*/ | |||
| #define QSPI_FLAG_SM QUADSPI_SR_SMF /*!<Status match flag: received data matches in autopolling mode*/ | |||
| #define QSPI_FLAG_FT QUADSPI_SR_FTF /*!<Fifo threshold flag: Fifo threshold reached or data left after read from memory is complete*/ | |||
| #define QSPI_FLAG_TC QUADSPI_SR_TCF /*!<Transfer complete flag: programmed number of data have been transferred or the transfer has been aborted*/ | |||
| #define QSPI_FLAG_TE QUADSPI_SR_TEF /*!<Transfer error flag: invalid address is being accessed*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_Interrupts QSPI Interrupts | |||
| * @{ | |||
| */ | |||
| #define QSPI_IT_TO QUADSPI_CR_TOIE /*!<Interrupt on the timeout flag*/ | |||
| #define QSPI_IT_SM QUADSPI_CR_SMIE /*!<Interrupt on the status match flag*/ | |||
| #define QSPI_IT_FT QUADSPI_CR_FTIE /*!<Interrupt on the fifo threshold flag*/ | |||
| #define QSPI_IT_TC QUADSPI_CR_TCIE /*!<Interrupt on the transfer complete flag*/ | |||
| #define QSPI_IT_TE QUADSPI_CR_TEIE /*!<Interrupt on the transfer error flag*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_Timeout_definition QSPI Timeout definition | |||
| * @{ | |||
| */ | |||
| #define HAL_QPSI_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000U)/* 5 s */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macros -----------------------------------------------------------*/ | |||
| /** @defgroup QSPI_Exported_Macros QSPI Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset QSPI handle state | |||
| * @param __HANDLE__: QSPI handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_QSPI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_QSPI_STATE_RESET) | |||
| /** @brief Enable QSPI | |||
| * @param __HANDLE__: specifies the QSPI Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_QSPI_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, QUADSPI_CR_EN) | |||
| /** @brief Disable QSPI | |||
| * @param __HANDLE__: specifies the QSPI Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_QSPI_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR, QUADSPI_CR_EN) | |||
| /** @brief Enables the specified QSPI interrupt. | |||
| * @param __HANDLE__: specifies the QSPI Handle. | |||
| * @param __INTERRUPT__: specifies the QSPI interrupt source to enable. | |||
| * This parameter can be one of the following values: | |||
| * @arg QSPI_IT_TO: QSPI Time out interrupt | |||
| * @arg QSPI_IT_SM: QSPI Status match interrupt | |||
| * @arg QSPI_IT_FT: QSPI FIFO threshold interrupt | |||
| * @arg QSPI_IT_TC: QSPI Transfer complete interrupt | |||
| * @arg QSPI_IT_TE: QSPI Transfer error interrupt | |||
| * @retval None | |||
| */ | |||
| #define __HAL_QSPI_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CR, (__INTERRUPT__)) | |||
| /** @brief Disables the specified QSPI interrupt. | |||
| * @param __HANDLE__: specifies the QSPI Handle. | |||
| * @param __INTERRUPT__: specifies the QSPI interrupt source to disable. | |||
| * This parameter can be one of the following values: | |||
| * @arg QSPI_IT_TO: QSPI Timeout interrupt | |||
| * @arg QSPI_IT_SM: QSPI Status match interrupt | |||
| * @arg QSPI_IT_FT: QSPI FIFO threshold interrupt | |||
| * @arg QSPI_IT_TC: QSPI Transfer complete interrupt | |||
| * @arg QSPI_IT_TE: QSPI Transfer error interrupt | |||
| * @retval None | |||
| */ | |||
| #define __HAL_QSPI_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CR, (__INTERRUPT__)) | |||
| /** @brief Checks whether the specified QSPI interrupt source is enabled. | |||
| * @param __HANDLE__: specifies the QSPI Handle. | |||
| * @param __INTERRUPT__: specifies the QSPI interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg QSPI_IT_TO: QSPI Time out interrupt | |||
| * @arg QSPI_IT_SM: QSPI Status match interrupt | |||
| * @arg QSPI_IT_FT: QSPI FIFO threshold interrupt | |||
| * @arg QSPI_IT_TC: QSPI Transfer complete interrupt | |||
| * @arg QSPI_IT_TE: QSPI Transfer error interrupt | |||
| * @retval The new state of __INTERRUPT__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_QSPI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (READ_BIT((__HANDLE__)->Instance->CR, (__INTERRUPT__)) == (__INTERRUPT__)) | |||
| /** | |||
| * @brief Get the selected QSPI's flag status. | |||
| * @param __HANDLE__: specifies the QSPI Handle. | |||
| * @param __FLAG__: specifies the QSPI flag to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg QSPI_FLAG_BUSY: QSPI Busy flag | |||
| * @arg QSPI_FLAG_TO: QSPI Time out flag | |||
| * @arg QSPI_FLAG_SM: QSPI Status match flag | |||
| * @arg QSPI_FLAG_FT: QSPI FIFO threshold flag | |||
| * @arg QSPI_FLAG_TC: QSPI Transfer complete flag | |||
| * @arg QSPI_FLAG_TE: QSPI Transfer error flag | |||
| * @retval None | |||
| */ | |||
| #define __HAL_QSPI_GET_FLAG(__HANDLE__, __FLAG__) (READ_BIT((__HANDLE__)->Instance->SR, (__FLAG__)) != 0U) | |||
| /** @brief Clears the specified QSPI's flag status. | |||
| * @param __HANDLE__: specifies the QSPI Handle. | |||
| * @param __FLAG__: specifies the QSPI clear register flag that needs to be set | |||
| * This parameter can be one of the following values: | |||
| * @arg QSPI_FLAG_TO: QSPI Time out flag | |||
| * @arg QSPI_FLAG_SM: QSPI Status match flag | |||
| * @arg QSPI_FLAG_TC: QSPI Transfer complete flag | |||
| * @arg QSPI_FLAG_TE: QSPI Transfer error flag | |||
| * @retval None | |||
| */ | |||
| #define __HAL_QSPI_CLEAR_FLAG(__HANDLE__, __FLAG__) WRITE_REG((__HANDLE__)->Instance->FCR, (__FLAG__)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup QSPI_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup QSPI_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| /* Initialization/de-initialization functions ********************************/ | |||
| HAL_StatusTypeDef HAL_QSPI_Init (QSPI_HandleTypeDef *hqspi); | |||
| HAL_StatusTypeDef HAL_QSPI_DeInit (QSPI_HandleTypeDef *hqspi); | |||
| void HAL_QSPI_MspInit (QSPI_HandleTypeDef *hqspi); | |||
| void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup QSPI_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| /* IO operation functions *****************************************************/ | |||
| /* QSPI IRQ handler method */ | |||
| void HAL_QSPI_IRQHandler(QSPI_HandleTypeDef *hqspi); | |||
| /* QSPI indirect mode */ | |||
| HAL_StatusTypeDef HAL_QSPI_Command (QSPI_HandleTypeDef *hqspi, QSPI_CommandTypeDef *cmd, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_QSPI_Transmit (QSPI_HandleTypeDef *hqspi, uint8_t *pData, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_QSPI_Receive (QSPI_HandleTypeDef *hqspi, uint8_t *pData, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_QSPI_Command_IT (QSPI_HandleTypeDef *hqspi, QSPI_CommandTypeDef *cmd); | |||
| HAL_StatusTypeDef HAL_QSPI_Transmit_IT (QSPI_HandleTypeDef *hqspi, uint8_t *pData); | |||
| HAL_StatusTypeDef HAL_QSPI_Receive_IT (QSPI_HandleTypeDef *hqspi, uint8_t *pData); | |||
| HAL_StatusTypeDef HAL_QSPI_Transmit_DMA (QSPI_HandleTypeDef *hqspi, uint8_t *pData); | |||
| HAL_StatusTypeDef HAL_QSPI_Receive_DMA (QSPI_HandleTypeDef *hqspi, uint8_t *pData); | |||
| /* QSPI status flag polling mode */ | |||
| HAL_StatusTypeDef HAL_QSPI_AutoPolling (QSPI_HandleTypeDef *hqspi, QSPI_CommandTypeDef *cmd, QSPI_AutoPollingTypeDef *cfg, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_QSPI_AutoPolling_IT(QSPI_HandleTypeDef *hqspi, QSPI_CommandTypeDef *cmd, QSPI_AutoPollingTypeDef *cfg); | |||
| /* QSPI memory-mapped mode */ | |||
| HAL_StatusTypeDef HAL_QSPI_MemoryMapped(QSPI_HandleTypeDef *hqspi, QSPI_CommandTypeDef *cmd, QSPI_MemoryMappedTypeDef *cfg); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup QSPI_Exported_Functions_Group3 | |||
| * @{ | |||
| */ | |||
| /* Callback functions in non-blocking modes ***********************************/ | |||
| void HAL_QSPI_ErrorCallback (QSPI_HandleTypeDef *hqspi); | |||
| void HAL_QSPI_AbortCpltCallback (QSPI_HandleTypeDef *hqspi); | |||
| void HAL_QSPI_FifoThresholdCallback(QSPI_HandleTypeDef *hqspi); | |||
| /* QSPI indirect mode */ | |||
| void HAL_QSPI_CmdCpltCallback (QSPI_HandleTypeDef *hqspi); | |||
| void HAL_QSPI_RxCpltCallback (QSPI_HandleTypeDef *hqspi); | |||
| void HAL_QSPI_TxCpltCallback (QSPI_HandleTypeDef *hqspi); | |||
| void HAL_QSPI_RxHalfCpltCallback (QSPI_HandleTypeDef *hqspi); | |||
| void HAL_QSPI_TxHalfCpltCallback (QSPI_HandleTypeDef *hqspi); | |||
| /* QSPI status flag polling mode */ | |||
| void HAL_QSPI_StatusMatchCallback (QSPI_HandleTypeDef *hqspi); | |||
| /* QSPI memory-mapped mode */ | |||
| void HAL_QSPI_TimeOutCallback (QSPI_HandleTypeDef *hqspi); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup QSPI_Exported_Functions_Group4 | |||
| * @{ | |||
| */ | |||
| /* Peripheral Control and State functions ************************************/ | |||
| HAL_QSPI_StateTypeDef HAL_QSPI_GetState (QSPI_HandleTypeDef *hqspi); | |||
| uint32_t HAL_QSPI_GetError (QSPI_HandleTypeDef *hqspi); | |||
| HAL_StatusTypeDef HAL_QSPI_Abort (QSPI_HandleTypeDef *hqspi); | |||
| HAL_StatusTypeDef HAL_QSPI_Abort_IT (QSPI_HandleTypeDef *hqspi); | |||
| void HAL_QSPI_SetTimeout (QSPI_HandleTypeDef *hqspi, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_QSPI_SetFifoThreshold(QSPI_HandleTypeDef *hqspi, uint32_t Threshold); | |||
| uint32_t HAL_QSPI_GetFifoThreshold(QSPI_HandleTypeDef *hqspi); | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup QSPI_Private_Macros QSPI Private Macros | |||
| * @{ | |||
| */ | |||
| /** @defgroup QSPI_ClockPrescaler QSPI Clock Prescaler | |||
| * @{ | |||
| */ | |||
| #define IS_QSPI_CLOCK_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFFU) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_FifoThreshold QSPI Fifo Threshold | |||
| * @{ | |||
| */ | |||
| #define IS_QSPI_FIFO_THRESHOLD(THR) (((THR) > 0U) && ((THR) <= 32U)) | |||
| /** | |||
| * @} | |||
| */ | |||
| #define IS_QSPI_SSHIFT(SSHIFT) (((SSHIFT) == QSPI_SAMPLE_SHIFTING_NONE) || \ | |||
| ((SSHIFT) == QSPI_SAMPLE_SHIFTING_HALFCYCLE)) | |||
| /** @defgroup QSPI_FlashSize QSPI Flash Size | |||
| * @{ | |||
| */ | |||
| #define IS_QSPI_FLASH_SIZE(FSIZE) (((FSIZE) <= 31U)) | |||
| /** | |||
| * @} | |||
| */ | |||
| #define IS_QSPI_CS_HIGH_TIME(CSHTIME) (((CSHTIME) == QSPI_CS_HIGH_TIME_1_CYCLE) || \ | |||
| ((CSHTIME) == QSPI_CS_HIGH_TIME_2_CYCLE) || \ | |||
| ((CSHTIME) == QSPI_CS_HIGH_TIME_3_CYCLE) || \ | |||
| ((CSHTIME) == QSPI_CS_HIGH_TIME_4_CYCLE) || \ | |||
| ((CSHTIME) == QSPI_CS_HIGH_TIME_5_CYCLE) || \ | |||
| ((CSHTIME) == QSPI_CS_HIGH_TIME_6_CYCLE) || \ | |||
| ((CSHTIME) == QSPI_CS_HIGH_TIME_7_CYCLE) || \ | |||
| ((CSHTIME) == QSPI_CS_HIGH_TIME_8_CYCLE)) | |||
| #define IS_QSPI_CLOCK_MODE(CLKMODE) (((CLKMODE) == QSPI_CLOCK_MODE_0) || \ | |||
| ((CLKMODE) == QSPI_CLOCK_MODE_3)) | |||
| #define IS_QSPI_FLASH_ID(FLA) (((FLA) == QSPI_FLASH_ID_1) || \ | |||
| ((FLA) == QSPI_FLASH_ID_2)) | |||
| #define IS_QSPI_DUAL_FLASH_MODE(MODE) (((MODE) == QSPI_DUALFLASH_ENABLE) || \ | |||
| ((MODE) == QSPI_DUALFLASH_DISABLE)) | |||
| /** @defgroup QSPI_Instruction QSPI Instruction | |||
| * @{ | |||
| */ | |||
| #define IS_QSPI_INSTRUCTION(INSTRUCTION) ((INSTRUCTION) <= 0xFFU) | |||
| /** | |||
| * @} | |||
| */ | |||
| #define IS_QSPI_ADDRESS_SIZE(ADDR_SIZE) (((ADDR_SIZE) == QSPI_ADDRESS_8_BITS) || \ | |||
| ((ADDR_SIZE) == QSPI_ADDRESS_16_BITS) || \ | |||
| ((ADDR_SIZE) == QSPI_ADDRESS_24_BITS) || \ | |||
| ((ADDR_SIZE) == QSPI_ADDRESS_32_BITS)) | |||
| #define IS_QSPI_ALTERNATE_BYTES_SIZE(SIZE) (((SIZE) == QSPI_ALTERNATE_BYTES_8_BITS) || \ | |||
| ((SIZE) == QSPI_ALTERNATE_BYTES_16_BITS) || \ | |||
| ((SIZE) == QSPI_ALTERNATE_BYTES_24_BITS) || \ | |||
| ((SIZE) == QSPI_ALTERNATE_BYTES_32_BITS)) | |||
| /** @defgroup QSPI_DummyCycles QSPI Dummy Cycles | |||
| * @{ | |||
| */ | |||
| #define IS_QSPI_DUMMY_CYCLES(DCY) ((DCY) <= 31U) | |||
| /** | |||
| * @} | |||
| */ | |||
| #define IS_QSPI_INSTRUCTION_MODE(MODE) (((MODE) == QSPI_INSTRUCTION_NONE) || \ | |||
| ((MODE) == QSPI_INSTRUCTION_1_LINE) || \ | |||
| ((MODE) == QSPI_INSTRUCTION_2_LINES) || \ | |||
| ((MODE) == QSPI_INSTRUCTION_4_LINES)) | |||
| #define IS_QSPI_ADDRESS_MODE(MODE) (((MODE) == QSPI_ADDRESS_NONE) || \ | |||
| ((MODE) == QSPI_ADDRESS_1_LINE) || \ | |||
| ((MODE) == QSPI_ADDRESS_2_LINES) || \ | |||
| ((MODE) == QSPI_ADDRESS_4_LINES)) | |||
| #define IS_QSPI_ALTERNATE_BYTES_MODE(MODE) (((MODE) == QSPI_ALTERNATE_BYTES_NONE) || \ | |||
| ((MODE) == QSPI_ALTERNATE_BYTES_1_LINE) || \ | |||
| ((MODE) == QSPI_ALTERNATE_BYTES_2_LINES) || \ | |||
| ((MODE) == QSPI_ALTERNATE_BYTES_4_LINES)) | |||
| #define IS_QSPI_DATA_MODE(MODE) (((MODE) == QSPI_DATA_NONE) || \ | |||
| ((MODE) == QSPI_DATA_1_LINE) || \ | |||
| ((MODE) == QSPI_DATA_2_LINES) || \ | |||
| ((MODE) == QSPI_DATA_4_LINES)) | |||
| #define IS_QSPI_DDR_MODE(DDR_MODE) (((DDR_MODE) == QSPI_DDR_MODE_DISABLE) || \ | |||
| ((DDR_MODE) == QSPI_DDR_MODE_ENABLE)) | |||
| #define IS_QSPI_DDR_HHC(DDR_HHC) (((DDR_HHC) == QSPI_DDR_HHC_ANALOG_DELAY) || \ | |||
| ((DDR_HHC) == QSPI_DDR_HHC_HALF_CLK_DELAY)) | |||
| #define IS_QSPI_SIOO_MODE(SIOO_MODE) (((SIOO_MODE) == QSPI_SIOO_INST_EVERY_CMD) || \ | |||
| ((SIOO_MODE) == QSPI_SIOO_INST_ONLY_FIRST_CMD)) | |||
| /** @defgroup QSPI_Interval QSPI Interval | |||
| * @{ | |||
| */ | |||
| #define IS_QSPI_INTERVAL(INTERVAL) ((INTERVAL) <= QUADSPI_PIR_INTERVAL) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup QSPI_StatusBytesSize QSPI Status Bytes Size | |||
| * @{ | |||
| */ | |||
| #define IS_QSPI_STATUS_BYTES_SIZE(SIZE) (((SIZE) >= 1U) && ((SIZE) <= 4U)) | |||
| /** | |||
| * @} | |||
| */ | |||
| #define IS_QSPI_MATCH_MODE(MODE) (((MODE) == QSPI_MATCH_MODE_AND) || \ | |||
| ((MODE) == QSPI_MATCH_MODE_OR)) | |||
| #define IS_QSPI_AUTOMATIC_STOP(APMS) (((APMS) == QSPI_AUTOMATIC_STOP_DISABLE) || \ | |||
| ((APMS) == QSPI_AUTOMATIC_STOP_ENABLE)) | |||
| #define IS_QSPI_TIMEOUT_ACTIVATION(TCEN) (((TCEN) == QSPI_TIMEOUT_COUNTER_DISABLE) || \ | |||
| ((TCEN) == QSPI_TIMEOUT_COUNTER_ENABLE)) | |||
| /** @defgroup QSPI_TimeOutPeriod QSPI TimeOut Period | |||
| * @{ | |||
| */ | |||
| #define IS_QSPI_TIMEOUT_PERIOD(PERIOD) ((PERIOD) <= 0xFFFFU) | |||
| /** | |||
| * @} | |||
| */ | |||
| #define IS_QSPI_GET_FLAG(FLAG) (((FLAG) == QSPI_FLAG_BUSY) || \ | |||
| ((FLAG) == QSPI_FLAG_TO) || \ | |||
| ((FLAG) == QSPI_FLAG_SM) || \ | |||
| ((FLAG) == QSPI_FLAG_FT) || \ | |||
| ((FLAG) == QSPI_FLAG_TC) || \ | |||
| ((FLAG) == QSPI_FLAG_TE)) | |||
| #define IS_QSPI_IT(IT) ((((IT) & (uint32_t)0xFFE0FFFFU) == 0x00000000U) && ((IT) != 0x00000000U)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup QSPI_Private_Functions QSPI Private Functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || | |||
| STM32F413xx || STM32F423xx */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_QSPI_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_rcc.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of RCC HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -135,9 +135,9 @@ typedef struct | |||
| /** @defgroup RCC_HSE_Config HSE Config | |||
| * @{ | |||
| */ | |||
| #define RCC_HSE_OFF ((uint8_t)0x00U) | |||
| #define RCC_HSE_ON ((uint8_t)0x01U) | |||
| #define RCC_HSE_BYPASS ((uint8_t)0x05U) | |||
| #define RCC_HSE_OFF ((uint32_t)0x00000000U) | |||
| #define RCC_HSE_ON RCC_CR_HSEON | |||
| #define RCC_HSE_BYPASS ((uint32_t)(RCC_CR_HSEBYP | RCC_CR_HSEON)) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -145,9 +145,9 @@ typedef struct | |||
| /** @defgroup RCC_LSE_Config LSE Config | |||
| * @{ | |||
| */ | |||
| #define RCC_LSE_OFF ((uint8_t)0x00U) | |||
| #define RCC_LSE_ON ((uint8_t)0x01U) | |||
| #define RCC_LSE_BYPASS ((uint8_t)0x05U) | |||
| #define RCC_LSE_OFF ((uint32_t)0x00000000U) | |||
| #define RCC_LSE_ON RCC_BDCR_LSEON | |||
| #define RCC_LSE_BYPASS ((uint32_t)(RCC_BDCR_LSEBYP | RCC_BDCR_LSEON)) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -214,6 +214,8 @@ typedef struct | |||
| */ | |||
| /** @defgroup RCC_System_Clock_Source System Clock Source | |||
| * @note The RCC_SYSCLKSOURCE_PLLRCLK parameter is available only for | |||
| * STM32F446xx devices. | |||
| * @{ | |||
| */ | |||
| #define RCC_SYSCLKSOURCE_HSI RCC_CFGR_SW_HSI | |||
| @@ -225,6 +227,8 @@ typedef struct | |||
| */ | |||
| /** @defgroup RCC_System_Clock_Source_Status System Clock Source Status | |||
| * @note The RCC_SYSCLKSOURCE_STATUS_PLLRCLK parameter is available only for | |||
| * STM32F446xx devices. | |||
| * @{ | |||
| */ | |||
| #define RCC_SYSCLKSOURCE_STATUS_HSI RCC_CFGR_SWS_HSI /*!< HSI used as system clock */ | |||
| @@ -904,7 +908,23 @@ typedef struct | |||
| * @arg RCC_HSE_ON: turn ON the HSE oscillator. | |||
| * @arg RCC_HSE_BYPASS: HSE oscillator bypassed with external clock. | |||
| */ | |||
| #define __HAL_RCC_HSE_CONFIG(__STATE__) (*(__IO uint8_t *) RCC_CR_BYTE2_ADDRESS = (__STATE__)) | |||
| #define __HAL_RCC_HSE_CONFIG(__STATE__) \ | |||
| do { \ | |||
| if ((__STATE__) == RCC_HSE_ON) \ | |||
| { \ | |||
| SET_BIT(RCC->CR, RCC_CR_HSEON); \ | |||
| } \ | |||
| else if ((__STATE__) == RCC_HSE_BYPASS) \ | |||
| { \ | |||
| SET_BIT(RCC->CR, RCC_CR_HSEBYP); \ | |||
| SET_BIT(RCC->CR, RCC_CR_HSEON); \ | |||
| } \ | |||
| else \ | |||
| { \ | |||
| CLEAR_BIT(RCC->CR, RCC_CR_HSEON); \ | |||
| CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP); \ | |||
| } \ | |||
| } while(0) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -931,8 +951,23 @@ typedef struct | |||
| * @arg RCC_LSE_ON: turn ON the LSE oscillator. | |||
| * @arg RCC_LSE_BYPASS: LSE oscillator bypassed with external clock. | |||
| */ | |||
| #define __HAL_RCC_LSE_CONFIG(__STATE__) (*(__IO uint8_t *) RCC_BDCR_BYTE0_ADDRESS = (__STATE__)) | |||
| #define __HAL_RCC_LSE_CONFIG(__STATE__) \ | |||
| do { \ | |||
| if((__STATE__) == RCC_LSE_ON) \ | |||
| { \ | |||
| SET_BIT(RCC->BDCR, RCC_BDCR_LSEON); \ | |||
| } \ | |||
| else if((__STATE__) == RCC_LSE_BYPASS) \ | |||
| { \ | |||
| SET_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \ | |||
| SET_BIT(RCC->BDCR, RCC_BDCR_LSEON); \ | |||
| } \ | |||
| else \ | |||
| { \ | |||
| CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON); \ | |||
| CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \ | |||
| } \ | |||
| } while(0) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -1034,7 +1069,8 @@ typedef struct | |||
| * - RCC_SYSCLKSOURCE_HSI: HSI oscillator is used as system clock source. | |||
| * - RCC_SYSCLKSOURCE_HSE: HSE oscillator is used as system clock source. | |||
| * - RCC_SYSCLKSOURCE_PLLCLK: PLL output is used as system clock source. | |||
| * - RCC_SYSCLKSOURCE_PLLRCLK: PLLR output is used as system clock source. | |||
| * - RCC_SYSCLKSOURCE_PLLRCLK: PLLR output is used as system clock source. This | |||
| * parameter is available only for STM32F446xx devices. | |||
| */ | |||
| #define __HAL_RCC_SYSCLK_CONFIG(__RCC_SYSCLKSOURCE__) MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, (__RCC_SYSCLKSOURCE__)) | |||
| @@ -1044,7 +1080,8 @@ typedef struct | |||
| * - RCC_SYSCLKSOURCE_STATUS_HSI: HSI used as system clock. | |||
| * - RCC_SYSCLKSOURCE_STATUS_HSE: HSE used as system clock. | |||
| * - RCC_SYSCLKSOURCE_STATUS_PLLCLK: PLL used as system clock. | |||
| * - RCC_SYSCLKSOURCE_STATUS_PLLRCLK: PLLR used as system clock. | |||
| * - RCC_SYSCLKSOURCE_STATUS_PLLRCLK: PLLR used as system clock. This parameter | |||
| * is available only for STM32F446xx devices. | |||
| */ | |||
| #define __HAL_RCC_GET_SYSCLK_SOURCE() ((uint32_t)(RCC->CFGR & RCC_CFGR_SWS)) | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_rng.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of RNG HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -47,7 +47,7 @@ | |||
| defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ | |||
| defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F469xx) ||\ | |||
| defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) ||\ | |||
| defined(STM32F412Cx) | |||
| defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| @@ -357,7 +357,7 @@ HAL_RNG_StateTypeDef HAL_RNG_GetState(RNG_HandleTypeDef *hrng); | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\ | |||
| STM32F429xx || STM32F439xx || STM32F410xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ | |||
| STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #ifdef __cplusplus | |||
| } | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_rtc.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of RTC HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_rtc_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of RTC HAL Extension module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -137,7 +137,10 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| #define RTC_TAMPER_1 RTC_TAFCR_TAMP1E | |||
| #if !defined(STM32F412Zx) && !defined(STM32F412Vx) && !defined(STM32F412Rx) && !defined(STM32F412Cx) && !defined(STM32F413xx) && !defined(STM32F423xx) | |||
| #define RTC_TAMPER_2 RTC_TAFCR_TAMP2E | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -145,8 +148,12 @@ typedef struct | |||
| /** @defgroup RTCEx_Tamper_Pins_Selection RTC tamper Pins Selection | |||
| * @{ | |||
| */ | |||
| #define RTC_TAMPERPIN_DEFAULT ((uint32_t)0x00000000U) | |||
| #if !defined(STM32F412Zx) && !defined(STM32F412Vx) && !defined(STM32F412Rx) && !defined(STM32F412Cx) && !defined(STM32F413xx) && !defined(STM32F423xx) | |||
| #define RTC_TAMPERPIN_POS1 ((uint32_t)0x00010000U) | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -155,7 +162,10 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| #define RTC_TIMESTAMPPIN_DEFAULT ((uint32_t)0x00000000U) | |||
| #if !defined(STM32F412Zx) && !defined(STM32F412Vx) && !defined(STM32F412Rx) && !defined(STM32F412Cx) && !defined(STM32F413xx) && !defined(STM32F423xx) | |||
| #define RTC_TIMESTAMPPIN_POS1 ((uint32_t)0x00020000U) | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -587,6 +597,7 @@ typedef struct | |||
| */ | |||
| #define __HAL_RTC_TAMPER1_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAFCR &= ~(RTC_TAFCR_TAMP1E)) | |||
| #if !defined(STM32F412Zx) && !defined(STM32F412Vx) && !defined(STM32F412Rx) && !defined(STM32F412Cx) && !defined(STM32F413xx) && !defined(STM32F423xx) | |||
| /** | |||
| * @brief Enable the RTC Tamper2 input detection. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| @@ -600,6 +611,7 @@ typedef struct | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_TAMPER2_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAFCR &= ~(RTC_TAFCR_TAMP2E)) | |||
| #endif | |||
| /** | |||
| * @brief Check whether the specified RTC Tamper interrupt has occurred or not. | |||
| @@ -923,14 +935,26 @@ HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t | |||
| ((BKP) == RTC_BKP_DR19)) | |||
| #define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \ | |||
| ((EDGE) == RTC_TIMESTAMPEDGE_FALLING)) | |||
| #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define IS_RTC_TAMPER(TAMPER) ((((TAMPER) & ((uint32_t)!(RTC_TAFCR_TAMP1E ))) == 0x00U) && ((TAMPER) != (uint32_t)RESET)) | |||
| #else | |||
| #define IS_RTC_TAMPER(TAMPER) ((((TAMPER) & ((uint32_t)!(RTC_TAFCR_TAMP1E | RTC_TAFCR_TAMP2E))) == 0x00U) && ((TAMPER) != (uint32_t)RESET)) | |||
| #endif | |||
| #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define IS_RTC_TAMPER_PIN(PIN) ((PIN) == RTC_TAMPERPIN_DEFAULT) | |||
| #else | |||
| #define IS_RTC_TAMPER_PIN(PIN) (((PIN) == RTC_TAMPERPIN_DEFAULT) || \ | |||
| ((PIN) == RTC_TAMPERPIN_POS1)) | |||
| #endif | |||
| #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define IS_RTC_TIMESTAMP_PIN(PIN) ((PIN) == RTC_TIMESTAMPPIN_DEFAULT) | |||
| #else | |||
| #define IS_RTC_TIMESTAMP_PIN(PIN) (((PIN) == RTC_TIMESTAMPPIN_DEFAULT) || \ | |||
| ((PIN) == RTC_TIMESTAMPPIN_POS1)) | |||
| #endif | |||
| #define IS_RTC_TAMPER_TRIGGER(TRIGGER) (((TRIGGER) == RTC_TAMPERTRIGGER_RISINGEDGE) || \ | |||
| ((TRIGGER) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \ | |||
| ((TRIGGER) == RTC_TAMPERTRIGGER_LOWLEVEL) || \ | |||
| @@ -0,0 +1,866 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_sai.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of SAI HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_SAI_H | |||
| #define __STM32F4xx_HAL_SAI_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ | |||
| defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F413xx) || \ | |||
| defined(STM32F423xx) | |||
| /** @addtogroup SAI | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup SAI_Exported_Types SAI Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief HAL State structures definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_SAI_STATE_RESET = 0x00U, /*!< SAI not yet initialized or disabled */ | |||
| HAL_SAI_STATE_READY = 0x01U, /*!< SAI initialized and ready for use */ | |||
| HAL_SAI_STATE_BUSY = 0x02U, /*!< SAI internal process is ongoing */ | |||
| HAL_SAI_STATE_BUSY_TX = 0x12U, /*!< Data transmission process is ongoing */ | |||
| HAL_SAI_STATE_BUSY_RX = 0x22U, /*!< Data reception process is ongoing */ | |||
| HAL_SAI_STATE_TIMEOUT = 0x03U, /*!< SAI timeout state */ | |||
| HAL_SAI_STATE_ERROR = 0x04U /*!< SAI error state */ | |||
| }HAL_SAI_StateTypeDef; | |||
| /** | |||
| * @brief SAI Callback prototype | |||
| */ | |||
| typedef void (*SAIcallback)(void); | |||
| /** @defgroup SAI_Init_Structure_definition SAI Init Structure definition | |||
| * @brief SAI Init Structure definition | |||
| * @{ | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t AudioMode; /*!< Specifies the SAI Block audio Mode. | |||
| This parameter can be a value of @ref SAI_Block_Mode */ | |||
| uint32_t Synchro; /*!< Specifies SAI Block synchronization | |||
| This parameter can be a value of @ref SAI_Block_Synchronization */ | |||
| uint32_t SynchroExt; /*!< Specifies SAI external output synchronization, this setup is common | |||
| for BlockA and BlockB | |||
| This parameter can be a value of @ref SAI_Block_SyncExt | |||
| @note: If both audio blocks of same SAI are used, this parameter has | |||
| to be set to the same value for each audio block */ | |||
| uint32_t OutputDrive; /*!< Specifies when SAI Block outputs are driven. | |||
| This parameter can be a value of @ref SAI_Block_Output_Drive | |||
| @note this value has to be set before enabling the audio block | |||
| but after the audio block configuration. */ | |||
| uint32_t NoDivider; /*!< Specifies whether master clock will be divided or not. | |||
| This parameter can be a value of @ref SAI_Block_NoDivider | |||
| @note If bit NODIV in the SAI_xCR1 register is cleared, the frame length | |||
| should be aligned to a number equal to a power of 2, from 8 to 256. | |||
| If bit NODIV in the SAI_xCR1 register is set, the frame length can | |||
| take any of the values without constraint since the input clock of | |||
| the audio block should be equal to the bit clock. | |||
| There is no MCLK_x clock which can be output. */ | |||
| uint32_t FIFOThreshold; /*!< Specifies SAI Block FIFO threshold. | |||
| This parameter can be a value of @ref SAI_Block_Fifo_Threshold */ | |||
| uint32_t ClockSource; /*!< Specifies the SAI Block x Clock source. | |||
| This parameter is not used for STM32F446xx devices. */ | |||
| uint32_t AudioFrequency; /*!< Specifies the audio frequency sampling. | |||
| This parameter can be a value of @ref SAI_Audio_Frequency */ | |||
| uint32_t Mckdiv; /*!< Specifies the master clock divider, the parameter will be used if for | |||
| AudioFrequency the user choice | |||
| This parameter must be a number between Min_Data = 0 and Max_Data = 15 */ | |||
| uint32_t MonoStereoMode; /*!< Specifies if the mono or stereo mode is selected. | |||
| This parameter can be a value of @ref SAI_Mono_Stereo_Mode */ | |||
| uint32_t CompandingMode; /*!< Specifies the companding mode type. | |||
| This parameter can be a value of @ref SAI_Block_Companding_Mode */ | |||
| uint32_t TriState; /*!< Specifies the companding mode type. | |||
| This parameter can be a value of @ref SAI_TRIState_Management */ | |||
| /* This part of the structure is automatically filled if your are using the high level intialisation | |||
| function HAL_SAI_InitProtocol */ | |||
| uint32_t Protocol; /*!< Specifies the SAI Block protocol. | |||
| This parameter can be a value of @ref SAI_Block_Protocol */ | |||
| uint32_t DataSize; /*!< Specifies the SAI Block data size. | |||
| This parameter can be a value of @ref SAI_Block_Data_Size */ | |||
| uint32_t FirstBit; /*!< Specifies whether data transfers start from MSB or LSB bit. | |||
| This parameter can be a value of @ref SAI_Block_MSB_LSB_transmission */ | |||
| uint32_t ClockStrobing; /*!< Specifies the SAI Block clock strobing edge sensitivity. | |||
| This parameter can be a value of @ref SAI_Block_Clock_Strobing */ | |||
| }SAI_InitTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Frame_Structure_definition SAI Frame Structure definition | |||
| * @brief SAI Frame Init structure definition | |||
| * @{ | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t FrameLength; /*!< Specifies the Frame length, the number of SCK clocks for each audio frame. | |||
| This parameter must be a number between Min_Data = 8 and Max_Data = 256. | |||
| @note If master clock MCLK_x pin is declared as an output, the frame length | |||
| should be aligned to a number equal to power of 2 in order to keep | |||
| in an audio frame, an integer number of MCLK pulses by bit Clock. */ | |||
| uint32_t ActiveFrameLength; /*!< Specifies the Frame synchronization active level length. | |||
| This Parameter specifies the length in number of bit clock (SCK + 1) | |||
| of the active level of FS signal in audio frame. | |||
| This parameter must be a number between Min_Data = 1 and Max_Data = 128 */ | |||
| uint32_t FSDefinition; /*!< Specifies the Frame synchronization definition. | |||
| This parameter can be a value of @ref SAI_Block_FS_Definition */ | |||
| uint32_t FSPolarity; /*!< Specifies the Frame synchronization Polarity. | |||
| This parameter can be a value of @ref SAI_Block_FS_Polarity */ | |||
| uint32_t FSOffset; /*!< Specifies the Frame synchronization Offset. | |||
| This parameter can be a value of @ref SAI_Block_FS_Offset */ | |||
| }SAI_FrameInitTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Slot_Structure_definition SAI Slot Structure definition | |||
| * @brief SAI Block Slot Init Structure definition | |||
| * @{ | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t FirstBitOffset; /*!< Specifies the position of first data transfer bit in the slot. | |||
| This parameter must be a number between Min_Data = 0 and Max_Data = 24 */ | |||
| uint32_t SlotSize; /*!< Specifies the Slot Size. | |||
| This parameter can be a value of @ref SAI_Block_Slot_Size */ | |||
| uint32_t SlotNumber; /*!< Specifies the number of slot in the audio frame. | |||
| This parameter must be a number between Min_Data = 1 and Max_Data = 16 */ | |||
| uint32_t SlotActive; /*!< Specifies the slots in audio frame that will be activated. | |||
| This parameter can be a value of @ref SAI_Block_Slot_Active */ | |||
| }SAI_SlotInitTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Handle_Structure_definition SAI Handle Structure definition | |||
| * @brief SAI handle Structure definition | |||
| * @{ | |||
| */ | |||
| typedef struct __SAI_HandleTypeDef | |||
| { | |||
| SAI_Block_TypeDef *Instance; /*!< SAI Blockx registers base address */ | |||
| SAI_InitTypeDef Init; /*!< SAI communication parameters */ | |||
| SAI_FrameInitTypeDef FrameInit; /*!< SAI Frame configuration parameters */ | |||
| SAI_SlotInitTypeDef SlotInit; /*!< SAI Slot configuration parameters */ | |||
| uint8_t *pBuffPtr; /*!< Pointer to SAI transfer Buffer */ | |||
| uint16_t XferSize; /*!< SAI transfer size */ | |||
| uint16_t XferCount; /*!< SAI transfer counter */ | |||
| DMA_HandleTypeDef *hdmatx; /*!< SAI Tx DMA handle parameters */ | |||
| DMA_HandleTypeDef *hdmarx; /*!< SAI Rx DMA handle parameters */ | |||
| SAIcallback mutecallback;/*!< SAI mute callback */ | |||
| void (*InterruptServiceRoutine)(struct __SAI_HandleTypeDef *hsai); /* function pointer for IRQ handler */ | |||
| HAL_LockTypeDef Lock; /*!< SAI locking object */ | |||
| __IO HAL_SAI_StateTypeDef State; /*!< SAI communication state */ | |||
| __IO uint32_t ErrorCode; /*!< SAI Error code */ | |||
| }SAI_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup SAI_Exported_Constants SAI Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup SAI_Error_Code SAI Error Code | |||
| * @{ | |||
| */ | |||
| #define HAL_SAI_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */ | |||
| #define HAL_SAI_ERROR_OVR ((uint32_t)0x00000001U) /*!< Overrun Error */ | |||
| #define HAL_SAI_ERROR_UDR ((uint32_t)0x00000002U) /*!< Underrun error */ | |||
| #define HAL_SAI_ERROR_AFSDET ((uint32_t)0x00000004U) /*!< Anticipated Frame synchronisation detection */ | |||
| #define HAL_SAI_ERROR_LFSDET ((uint32_t)0x00000008U) /*!< Late Frame synchronisation detection */ | |||
| #define HAL_SAI_ERROR_CNREADY ((uint32_t)0x00000010U) /*!< codec not ready */ | |||
| #define HAL_SAI_ERROR_WCKCFG ((uint32_t)0x00000020U) /*!< Wrong clock configuration */ | |||
| #define HAL_SAI_ERROR_TIMEOUT ((uint32_t)0x00000040U) /*!< Timeout error */ | |||
| #define HAL_SAI_ERROR_DMA ((uint32_t)0x00000080U) /*!< DMA error */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_SyncExt SAI External synchronisation | |||
| * @{ | |||
| */ | |||
| #define SAI_SYNCEXT_DISABLE 0U | |||
| #define SAI_SYNCEXT_OUTBLOCKA_ENABLE 1U | |||
| #define SAI_SYNCEXT_OUTBLOCKB_ENABLE 2U | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Protocol SAI Supported protocol | |||
| * @{ | |||
| */ | |||
| #define SAI_I2S_STANDARD 0U | |||
| #define SAI_I2S_MSBJUSTIFIED 1U | |||
| #define SAI_I2S_LSBJUSTIFIED 2U | |||
| #define SAI_PCM_LONG 3U | |||
| #define SAI_PCM_SHORT 4U | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Protocol_DataSize SAI protocol data size | |||
| * @{ | |||
| */ | |||
| #define SAI_PROTOCOL_DATASIZE_16BIT 0U | |||
| #define SAI_PROTOCOL_DATASIZE_16BITEXTENDED 1U | |||
| #define SAI_PROTOCOL_DATASIZE_24BIT 2U | |||
| #define SAI_PROTOCOL_DATASIZE_32BIT 3U | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Audio_Frequency SAI Audio Frequency | |||
| * @{ | |||
| */ | |||
| #define SAI_AUDIO_FREQUENCY_192K ((uint32_t)192000U) | |||
| #define SAI_AUDIO_FREQUENCY_96K ((uint32_t)96000U) | |||
| #define SAI_AUDIO_FREQUENCY_48K ((uint32_t)48000U) | |||
| #define SAI_AUDIO_FREQUENCY_44K ((uint32_t)44100U) | |||
| #define SAI_AUDIO_FREQUENCY_32K ((uint32_t)32000U) | |||
| #define SAI_AUDIO_FREQUENCY_22K ((uint32_t)22050U) | |||
| #define SAI_AUDIO_FREQUENCY_16K ((uint32_t)16000U) | |||
| #define SAI_AUDIO_FREQUENCY_11K ((uint32_t)11025U) | |||
| #define SAI_AUDIO_FREQUENCY_8K ((uint32_t)8000U) | |||
| #define SAI_AUDIO_FREQUENCY_MCKDIV ((uint32_t)0U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_Mode SAI Block Mode | |||
| * @{ | |||
| */ | |||
| #define SAI_MODEMASTER_TX ((uint32_t)0x00000000U) | |||
| #define SAI_MODEMASTER_RX ((uint32_t)SAI_xCR1_MODE_0) | |||
| #define SAI_MODESLAVE_TX ((uint32_t)SAI_xCR1_MODE_1) | |||
| #define SAI_MODESLAVE_RX ((uint32_t)(SAI_xCR1_MODE_1 | SAI_xCR1_MODE_0)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_Protocol SAI Block Protocol | |||
| * @{ | |||
| */ | |||
| #define SAI_FREE_PROTOCOL ((uint32_t)0x00000000U) | |||
| #define SAI_SPDIF_PROTOCOL ((uint32_t)SAI_xCR1_PRTCFG_0) | |||
| #define SAI_AC97_PROTOCOL ((uint32_t)SAI_xCR1_PRTCFG_1) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_Data_Size SAI Block Data Size | |||
| * @{ | |||
| */ | |||
| #define SAI_DATASIZE_8 ((uint32_t)SAI_xCR1_DS_1) | |||
| #define SAI_DATASIZE_10 ((uint32_t)(SAI_xCR1_DS_1 | SAI_xCR1_DS_0)) | |||
| #define SAI_DATASIZE_16 ((uint32_t)SAI_xCR1_DS_2) | |||
| #define SAI_DATASIZE_20 ((uint32_t)(SAI_xCR1_DS_2 | SAI_xCR1_DS_0)) | |||
| #define SAI_DATASIZE_24 ((uint32_t)(SAI_xCR1_DS_2 | SAI_xCR1_DS_1)) | |||
| #define SAI_DATASIZE_32 ((uint32_t)(SAI_xCR1_DS_2 | SAI_xCR1_DS_1 | SAI_xCR1_DS_0)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_MSB_LSB_transmission SAI Block MSB LSB transmission | |||
| * @{ | |||
| */ | |||
| #define SAI_FIRSTBIT_MSB ((uint32_t)0x00000000U) | |||
| #define SAI_FIRSTBIT_LSB ((uint32_t)SAI_xCR1_LSBFIRST) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_Clock_Strobing SAI Block Clock Strobing | |||
| * @{ | |||
| */ | |||
| #define SAI_CLOCKSTROBING_FALLINGEDGE 0U | |||
| #define SAI_CLOCKSTROBING_RISINGEDGE 1U | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_Synchronization SAI Block Synchronization | |||
| * @{ | |||
| */ | |||
| #define SAI_ASYNCHRONOUS 0U /*!< Asynchronous */ | |||
| #define SAI_SYNCHRONOUS 1U /*!< Synchronous with other block of same SAI */ | |||
| #define SAI_SYNCHRONOUS_EXT_SAI1 2U /*!< Synchronous with other SAI, SAI1 */ | |||
| #define SAI_SYNCHRONOUS_EXT_SAI2 3U /*!< Synchronous with other SAI, SAI2 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_Output_Drive SAI Block Output Drive | |||
| * @{ | |||
| */ | |||
| #define SAI_OUTPUTDRIVE_DISABLE ((uint32_t)0x00000000U) | |||
| #define SAI_OUTPUTDRIVE_ENABLE ((uint32_t)SAI_xCR1_OUTDRIV) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_NoDivider SAI Block NoDivider | |||
| * @{ | |||
| */ | |||
| #define SAI_MASTERDIVIDER_ENABLE ((uint32_t)0x00000000U) | |||
| #define SAI_MASTERDIVIDER_DISABLE ((uint32_t)SAI_xCR1_NODIV) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_FS_Definition SAI Block FS Definition | |||
| * @{ | |||
| */ | |||
| #define SAI_FS_STARTFRAME ((uint32_t)0x00000000U) | |||
| #define SAI_FS_CHANNEL_IDENTIFICATION ((uint32_t)SAI_xFRCR_FSDEF) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_FS_Polarity SAI Block FS Polarity | |||
| * @{ | |||
| */ | |||
| #define SAI_FS_ACTIVE_LOW ((uint32_t)0x00000000U) | |||
| #define SAI_FS_ACTIVE_HIGH ((uint32_t)SAI_xFRCR_FSPOL) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_FS_Offset SAI Block FS Offset | |||
| * @{ | |||
| */ | |||
| #define SAI_FS_FIRSTBIT ((uint32_t)0x00000000U) | |||
| #define SAI_FS_BEFOREFIRSTBIT ((uint32_t)SAI_xFRCR_FSOFF) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_Slot_Size SAI Block Slot Size | |||
| * @{ | |||
| */ | |||
| #define SAI_SLOTSIZE_DATASIZE ((uint32_t)0x00000000U) | |||
| #define SAI_SLOTSIZE_16B ((uint32_t)SAI_xSLOTR_SLOTSZ_0) | |||
| #define SAI_SLOTSIZE_32B ((uint32_t)SAI_xSLOTR_SLOTSZ_1) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_Slot_Active SAI Block Slot Active | |||
| * @{ | |||
| */ | |||
| #define SAI_SLOT_NOTACTIVE ((uint32_t)0x00000000U) | |||
| #define SAI_SLOTACTIVE_0 ((uint32_t)0x00000001U) | |||
| #define SAI_SLOTACTIVE_1 ((uint32_t)0x00000002U) | |||
| #define SAI_SLOTACTIVE_2 ((uint32_t)0x00000004U) | |||
| #define SAI_SLOTACTIVE_3 ((uint32_t)0x00000008U) | |||
| #define SAI_SLOTACTIVE_4 ((uint32_t)0x00000010U) | |||
| #define SAI_SLOTACTIVE_5 ((uint32_t)0x00000020U) | |||
| #define SAI_SLOTACTIVE_6 ((uint32_t)0x00000040U) | |||
| #define SAI_SLOTACTIVE_7 ((uint32_t)0x00000080U) | |||
| #define SAI_SLOTACTIVE_8 ((uint32_t)0x00000100U) | |||
| #define SAI_SLOTACTIVE_9 ((uint32_t)0x00000200U) | |||
| #define SAI_SLOTACTIVE_10 ((uint32_t)0x00000400U) | |||
| #define SAI_SLOTACTIVE_11 ((uint32_t)0x00000800U) | |||
| #define SAI_SLOTACTIVE_12 ((uint32_t)0x00001000U) | |||
| #define SAI_SLOTACTIVE_13 ((uint32_t)0x00002000U) | |||
| #define SAI_SLOTACTIVE_14 ((uint32_t)0x00004000U) | |||
| #define SAI_SLOTACTIVE_15 ((uint32_t)0x00008000U) | |||
| #define SAI_SLOTACTIVE_ALL ((uint32_t)0x0000FFFFU) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Mono_Stereo_Mode SAI Mono Stereo Mode | |||
| * @{ | |||
| */ | |||
| #define SAI_STEREOMODE ((uint32_t)0x00000000U) | |||
| #define SAI_MONOMODE ((uint32_t)SAI_xCR1_MONO) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_TRIState_Management SAI TRIState Management | |||
| * @{ | |||
| */ | |||
| #define SAI_OUTPUT_NOTRELEASED ((uint32_t)0x00000000U) | |||
| #define SAI_OUTPUT_RELEASED ((uint32_t)SAI_xCR2_TRIS) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_Fifo_Threshold SAI Block Fifo Threshold | |||
| * @{ | |||
| */ | |||
| #define SAI_FIFOTHRESHOLD_EMPTY ((uint32_t)0x00000000U) | |||
| #define SAI_FIFOTHRESHOLD_1QF ((uint32_t)(SAI_xCR2_FTH_0)) | |||
| #define SAI_FIFOTHRESHOLD_HF ((uint32_t)(SAI_xCR2_FTH_1)) | |||
| #define SAI_FIFOTHRESHOLD_3QF ((uint32_t)(SAI_xCR2_FTH_1 | SAI_xCR2_FTH_0)) | |||
| #define SAI_FIFOTHRESHOLD_FULL ((uint32_t)(SAI_xCR2_FTH_2)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_Companding_Mode SAI Block Companding Mode | |||
| * @{ | |||
| */ | |||
| #define SAI_NOCOMPANDING ((uint32_t)0x00000000U) | |||
| #define SAI_ULAW_1CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1)) | |||
| #define SAI_ALAW_1CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1 | SAI_xCR2_COMP_0)) | |||
| #define SAI_ULAW_2CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1 | SAI_xCR2_CPL)) | |||
| #define SAI_ALAW_2CPL_COMPANDING ((uint32_t)(SAI_xCR2_COMP_1 | SAI_xCR2_COMP_0 | SAI_xCR2_CPL)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_Mute_Value SAI Block Mute Value | |||
| * @{ | |||
| */ | |||
| #define SAI_ZERO_VALUE ((uint32_t)0x00000000U) | |||
| #define SAI_LAST_SENT_VALUE ((uint32_t)SAI_xCR2_MUTEVAL) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_Interrupts_Definition SAI Block Interrupts Definition | |||
| * @{ | |||
| */ | |||
| #define SAI_IT_OVRUDR ((uint32_t)SAI_xIMR_OVRUDRIE) | |||
| #define SAI_IT_MUTEDET ((uint32_t)SAI_xIMR_MUTEDETIE) | |||
| #define SAI_IT_WCKCFG ((uint32_t)SAI_xIMR_WCKCFGIE) | |||
| #define SAI_IT_FREQ ((uint32_t)SAI_xIMR_FREQIE) | |||
| #define SAI_IT_CNRDY ((uint32_t)SAI_xIMR_CNRDYIE) | |||
| #define SAI_IT_AFSDET ((uint32_t)SAI_xIMR_AFSDETIE) | |||
| #define SAI_IT_LFSDET ((uint32_t)SAI_xIMR_LFSDETIE) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_Flags_Definition SAI Block Flags Definition | |||
| * @{ | |||
| */ | |||
| #define SAI_FLAG_OVRUDR ((uint32_t)SAI_xSR_OVRUDR) | |||
| #define SAI_FLAG_MUTEDET ((uint32_t)SAI_xSR_MUTEDET) | |||
| #define SAI_FLAG_WCKCFG ((uint32_t)SAI_xSR_WCKCFG) | |||
| #define SAI_FLAG_FREQ ((uint32_t)SAI_xSR_FREQ) | |||
| #define SAI_FLAG_CNRDY ((uint32_t)SAI_xSR_CNRDY) | |||
| #define SAI_FLAG_AFSDET ((uint32_t)SAI_xSR_AFSDET) | |||
| #define SAI_FLAG_LFSDET ((uint32_t)SAI_xSR_LFSDET) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_Fifo_Status_Level SAI Block Fifo Status Level | |||
| * @{ | |||
| */ | |||
| #define SAI_FIFOSTATUS_EMPTY ((uint32_t)0x00000000U) | |||
| #define SAI_FIFOSTATUS_LESS1QUARTERFULL ((uint32_t)0x00010000U) | |||
| #define SAI_FIFOSTATUS_1QUARTERFULL ((uint32_t)0x00020000U) | |||
| #define SAI_FIFOSTATUS_HALFFULL ((uint32_t)0x00030000U) | |||
| #define SAI_FIFOSTATUS_3QUARTERFULL ((uint32_t)0x00040000U) | |||
| #define SAI_FIFOSTATUS_FULL ((uint32_t)0x00050000U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup SAI_Exported_Macros SAI Exported Macros | |||
| * @brief macros to handle interrupts and specific configurations | |||
| * @{ | |||
| */ | |||
| /** @brief Reset SAI handle state | |||
| * @param __HANDLE__: specifies the SAI Handle. | |||
| * @retval NoneS | |||
| */ | |||
| #define __HAL_SAI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SAI_STATE_RESET) | |||
| /** @brief Enable or disable the specified SAI interrupts. | |||
| * @param __HANDLE__: specifies the SAI Handle. | |||
| * @param __INTERRUPT__: specifies the interrupt source to enable or disable. | |||
| * This parameter can be one of the following values: | |||
| * @arg SAI_IT_OVRUDR: Overrun underrun interrupt enable | |||
| * @arg SAI_IT_MUTEDET: Mute detection interrupt enable | |||
| * @arg SAI_IT_WCKCFG: Wrong Clock Configuration interrupt enable | |||
| * @arg SAI_IT_FREQ: FIFO request interrupt enable | |||
| * @arg SAI_IT_CNRDY: Codec not ready interrupt enable | |||
| * @arg SAI_IT_AFSDET: Anticipated frame synchronization detection interrupt enable | |||
| * @arg SAI_IT_LFSDET: Late frame synchronization detection interrupt enable | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SAI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IMR |= (__INTERRUPT__)) | |||
| #define __HAL_SAI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IMR &= (~(__INTERRUPT__))) | |||
| /** @brief Check if the specified SAI interrupt source is enabled or disabled. | |||
| * @param __HANDLE__: specifies the SAI Handle. | |||
| * This parameter can be SAI where x: 1, 2, or 3 to select the SAI peripheral. | |||
| * @param __INTERRUPT__: specifies the SAI interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg SAI_IT_OVRUDR: Overrun underrun interrupt enable | |||
| * @arg SAI_IT_MUTEDET: Mute detection interrupt enable | |||
| * @arg SAI_IT_WCKCFG: Wrong Clock Configuration interrupt enable | |||
| * @arg SAI_IT_FREQ: FIFO request interrupt enable | |||
| * @arg SAI_IT_CNRDY: Codec not ready interrupt enable | |||
| * @arg SAI_IT_AFSDET: Anticipated frame synchronization detection interrupt enable | |||
| * @arg SAI_IT_LFSDET: Late frame synchronization detection interrupt enable | |||
| * @retval The new state of __INTERRUPT__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_SAI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IMR & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) | |||
| /** @brief Check whether the specified SAI flag is set or not. | |||
| * @param __HANDLE__: specifies the SAI Handle. | |||
| * @param __FLAG__: specifies the flag to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg SAI_FLAG_OVRUDR: Overrun underrun flag. | |||
| * @arg SAI_FLAG_MUTEDET: Mute detection flag. | |||
| * @arg SAI_FLAG_WCKCFG: Wrong Clock Configuration flag. | |||
| * @arg SAI_FLAG_FREQ: FIFO request flag. | |||
| * @arg SAI_FLAG_CNRDY: Codec not ready flag. | |||
| * @arg SAI_FLAG_AFSDET: Anticipated frame synchronization detection flag. | |||
| * @arg SAI_FLAG_LFSDET: Late frame synchronization detection flag. | |||
| * @retval The new state of __FLAG__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_SAI_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__)) | |||
| /** @brief Clear the specified SAI pending flag. | |||
| * @param __HANDLE__: specifies the SAI Handle. | |||
| * @param __FLAG__: specifies the flag to check. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg SAI_FLAG_OVRUDR: Clear Overrun underrun | |||
| * @arg SAI_FLAG_MUTEDET: Clear Mute detection | |||
| * @arg SAI_FLAG_WCKCFG: Clear Wrong Clock Configuration | |||
| * @arg SAI_FLAG_FREQ: Clear FIFO request | |||
| * @arg SAI_FLAG_CNRDY: Clear Codec not ready | |||
| * @arg SAI_FLAG_AFSDET: Clear Anticipated frame synchronization detection | |||
| * @arg SAI_FLAG_LFSDET: Clear Late frame synchronization detection | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SAI_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CLRFR = (__FLAG__)) | |||
| /** @brief Enable SAI | |||
| * @param __HANDLE__: specifies the SAI Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SAI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= SAI_xCR1_SAIEN) | |||
| /** @brief Disable SAI | |||
| * @param __HANDLE__: specifies the SAI Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SAI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~SAI_xCR1_SAIEN) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Include RCC SAI Extension module */ | |||
| #include "stm32f4xx_hal_sai_ex.h" | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup SAI_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /* Initialization/de-initialization functions **********************************/ | |||
| /** @addtogroup SAI_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_SAI_InitProtocol(SAI_HandleTypeDef *hsai, uint32_t protocol, uint32_t datasize, uint32_t nbslot); | |||
| HAL_StatusTypeDef HAL_SAI_Init(SAI_HandleTypeDef *hsai); | |||
| HAL_StatusTypeDef HAL_SAI_DeInit (SAI_HandleTypeDef *hsai); | |||
| void HAL_SAI_MspInit(SAI_HandleTypeDef *hsai); | |||
| void HAL_SAI_MspDeInit(SAI_HandleTypeDef *hsai); | |||
| /** | |||
| * @} | |||
| */ | |||
| /* I/O operation functions *****************************************************/ | |||
| /** @addtogroup SAI_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| /* Blocking mode: Polling */ | |||
| HAL_StatusTypeDef HAL_SAI_Transmit(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_SAI_Receive(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size, uint32_t Timeout); | |||
| /* Non-Blocking mode: Interrupt */ | |||
| HAL_StatusTypeDef HAL_SAI_Transmit_IT(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_SAI_Receive_IT(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size); | |||
| /* Non-Blocking mode: DMA */ | |||
| HAL_StatusTypeDef HAL_SAI_Transmit_DMA(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_SAI_Receive_DMA(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_SAI_DMAPause(SAI_HandleTypeDef *hsai); | |||
| HAL_StatusTypeDef HAL_SAI_DMAResume(SAI_HandleTypeDef *hsai); | |||
| HAL_StatusTypeDef HAL_SAI_DMAStop(SAI_HandleTypeDef *hsai); | |||
| /* Abort function */ | |||
| HAL_StatusTypeDef HAL_SAI_Abort(SAI_HandleTypeDef *hsai); | |||
| /* Mute management */ | |||
| HAL_StatusTypeDef HAL_SAI_EnableTxMuteMode(SAI_HandleTypeDef *hsai, uint16_t val); | |||
| HAL_StatusTypeDef HAL_SAI_DisableTxMuteMode(SAI_HandleTypeDef *hsai); | |||
| HAL_StatusTypeDef HAL_SAI_EnableRxMuteMode(SAI_HandleTypeDef *hsai, SAIcallback callback, uint16_t counter); | |||
| HAL_StatusTypeDef HAL_SAI_DisableRxMuteMode(SAI_HandleTypeDef *hsai); | |||
| /* SAI IRQHandler and Callbacks used in non blocking modes (Interrupt and DMA) */ | |||
| void HAL_SAI_IRQHandler(SAI_HandleTypeDef *hsai); | |||
| void HAL_SAI_TxHalfCpltCallback(SAI_HandleTypeDef *hsai); | |||
| void HAL_SAI_TxCpltCallback(SAI_HandleTypeDef *hsai); | |||
| void HAL_SAI_RxHalfCpltCallback(SAI_HandleTypeDef *hsai); | |||
| void HAL_SAI_RxCpltCallback(SAI_HandleTypeDef *hsai); | |||
| void HAL_SAI_ErrorCallback(SAI_HandleTypeDef *hsai); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup SAI_Exported_Functions_Group3 | |||
| * @{ | |||
| */ | |||
| /* Peripheral State functions ************************************************/ | |||
| HAL_SAI_StateTypeDef HAL_SAI_GetState(SAI_HandleTypeDef *hsai); | |||
| uint32_t HAL_SAI_GetError(SAI_HandleTypeDef *hsai); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @addtogroup SAI_Private_Macros | |||
| * @{ | |||
| */ | |||
| #define IS_SAI_BLOCK_SYNCEXT(STATE) (((STATE) == SAI_SYNCEXT_DISABLE) ||\ | |||
| ((STATE) == SAI_SYNCEXT_OUTBLOCKA_ENABLE) ||\ | |||
| ((STATE) == SAI_SYNCEXT_OUTBLOCKB_ENABLE)) | |||
| #define IS_SAI_SUPPORTED_PROTOCOL(PROTOCOL) (((PROTOCOL) == SAI_I2S_STANDARD) ||\ | |||
| ((PROTOCOL) == SAI_I2S_MSBJUSTIFIED) ||\ | |||
| ((PROTOCOL) == SAI_I2S_LSBJUSTIFIED) ||\ | |||
| ((PROTOCOL) == SAI_PCM_LONG) ||\ | |||
| ((PROTOCOL) == SAI_PCM_SHORT)) | |||
| #define IS_SAI_PROTOCOL_DATASIZE(DATASIZE) (((DATASIZE) == SAI_PROTOCOL_DATASIZE_16BIT) ||\ | |||
| ((DATASIZE) == SAI_PROTOCOL_DATASIZE_16BITEXTENDED) ||\ | |||
| ((DATASIZE) == SAI_PROTOCOL_DATASIZE_24BIT) ||\ | |||
| ((DATASIZE) == SAI_PROTOCOL_DATASIZE_32BIT)) | |||
| #define IS_SAI_AUDIO_FREQUENCY(AUDIO) (((AUDIO) == SAI_AUDIO_FREQUENCY_192K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_96K) || \ | |||
| ((AUDIO) == SAI_AUDIO_FREQUENCY_48K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_44K) || \ | |||
| ((AUDIO) == SAI_AUDIO_FREQUENCY_32K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_22K) || \ | |||
| ((AUDIO) == SAI_AUDIO_FREQUENCY_16K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_11K) || \ | |||
| ((AUDIO) == SAI_AUDIO_FREQUENCY_8K) || ((AUDIO) == SAI_AUDIO_FREQUENCY_MCKDIV)) | |||
| #define IS_SAI_BLOCK_MODE(MODE) (((MODE) == SAI_MODEMASTER_TX) || \ | |||
| ((MODE) == SAI_MODEMASTER_RX) || \ | |||
| ((MODE) == SAI_MODESLAVE_TX) || \ | |||
| ((MODE) == SAI_MODESLAVE_RX)) | |||
| #define IS_SAI_BLOCK_PROTOCOL(PROTOCOL) (((PROTOCOL) == SAI_FREE_PROTOCOL) || \ | |||
| ((PROTOCOL) == SAI_AC97_PROTOCOL) || \ | |||
| ((PROTOCOL) == SAI_SPDIF_PROTOCOL)) | |||
| #define IS_SAI_BLOCK_DATASIZE(DATASIZE) (((DATASIZE) == SAI_DATASIZE_8) || \ | |||
| ((DATASIZE) == SAI_DATASIZE_10) || \ | |||
| ((DATASIZE) == SAI_DATASIZE_16) || \ | |||
| ((DATASIZE) == SAI_DATASIZE_20) || \ | |||
| ((DATASIZE) == SAI_DATASIZE_24) || \ | |||
| ((DATASIZE) == SAI_DATASIZE_32)) | |||
| #define IS_SAI_BLOCK_FIRST_BIT(BIT) (((BIT) == SAI_FIRSTBIT_MSB) || \ | |||
| ((BIT) == SAI_FIRSTBIT_LSB)) | |||
| #define IS_SAI_BLOCK_CLOCK_STROBING(CLOCK) (((CLOCK) == SAI_CLOCKSTROBING_FALLINGEDGE) || \ | |||
| ((CLOCK) == SAI_CLOCKSTROBING_RISINGEDGE)) | |||
| #define IS_SAI_BLOCK_SYNCHRO(SYNCHRO) (((SYNCHRO) == SAI_ASYNCHRONOUS) || \ | |||
| ((SYNCHRO) == SAI_SYNCHRONOUS) || \ | |||
| ((SYNCHRO) == SAI_SYNCHRONOUS_EXT_SAI1) ||\ | |||
| ((SYNCHRO) == SAI_SYNCHRONOUS_EXT_SAI2)) | |||
| #define IS_SAI_BLOCK_OUTPUT_DRIVE(DRIVE) (((DRIVE) == SAI_OUTPUTDRIVE_DISABLE) || \ | |||
| ((DRIVE) == SAI_OUTPUTDRIVE_ENABLE)) | |||
| #define IS_SAI_BLOCK_NODIVIDER(NODIVIDER) (((NODIVIDER) == SAI_MASTERDIVIDER_ENABLE) || \ | |||
| ((NODIVIDER) == SAI_MASTERDIVIDER_DISABLE)) | |||
| #define IS_SAI_BLOCK_MUTE_COUNTER(COUNTER) ((COUNTER) <= 63U) | |||
| #define IS_SAI_BLOCK_MUTE_VALUE(VALUE) (((VALUE) == SAI_ZERO_VALUE) || \ | |||
| ((VALUE) == SAI_LAST_SENT_VALUE)) | |||
| #define IS_SAI_BLOCK_COMPANDING_MODE(MODE) (((MODE) == SAI_NOCOMPANDING) || \ | |||
| ((MODE) == SAI_ULAW_1CPL_COMPANDING) || \ | |||
| ((MODE) == SAI_ALAW_1CPL_COMPANDING) || \ | |||
| ((MODE) == SAI_ULAW_2CPL_COMPANDING) || \ | |||
| ((MODE) == SAI_ALAW_2CPL_COMPANDING)) | |||
| #define IS_SAI_BLOCK_FIFO_THRESHOLD(THRESHOLD) (((THRESHOLD) == SAI_FIFOTHRESHOLD_EMPTY) || \ | |||
| ((THRESHOLD) == SAI_FIFOTHRESHOLD_1QF) || \ | |||
| ((THRESHOLD) == SAI_FIFOTHRESHOLD_HF) || \ | |||
| ((THRESHOLD) == SAI_FIFOTHRESHOLD_3QF) || \ | |||
| ((THRESHOLD) == SAI_FIFOTHRESHOLD_FULL)) | |||
| #define IS_SAI_BLOCK_TRISTATE_MANAGEMENT(STATE) (((STATE) == SAI_OUTPUT_NOTRELEASED) ||\ | |||
| ((STATE) == SAI_OUTPUT_RELEASED)) | |||
| #define IS_SAI_MONO_STEREO_MODE(MODE) (((MODE) == SAI_MONOMODE) ||\ | |||
| ((MODE) == SAI_STEREOMODE)) | |||
| #define IS_SAI_SLOT_ACTIVE(ACTIVE) ((ACTIVE) <= SAI_SLOTACTIVE_ALL) | |||
| #define IS_SAI_BLOCK_SLOT_NUMBER(NUMBER) ((1U <= (NUMBER)) && ((NUMBER) <= 16U)) | |||
| #define IS_SAI_BLOCK_SLOT_SIZE(SIZE) (((SIZE) == SAI_SLOTSIZE_DATASIZE) || \ | |||
| ((SIZE) == SAI_SLOTSIZE_16B) || \ | |||
| ((SIZE) == SAI_SLOTSIZE_32B)) | |||
| #define IS_SAI_BLOCK_FIRSTBIT_OFFSET(OFFSET) ((OFFSET) <= 24U) | |||
| #define IS_SAI_BLOCK_FS_OFFSET(OFFSET) (((OFFSET) == SAI_FS_FIRSTBIT) || \ | |||
| ((OFFSET) == SAI_FS_BEFOREFIRSTBIT)) | |||
| #define IS_SAI_BLOCK_FS_POLARITY(POLARITY) (((POLARITY) == SAI_FS_ACTIVE_LOW) || \ | |||
| ((POLARITY) == SAI_FS_ACTIVE_HIGH)) | |||
| #define IS_SAI_BLOCK_FS_DEFINITION(DEFINITION) (((DEFINITION) == SAI_FS_STARTFRAME) || \ | |||
| ((DEFINITION) == SAI_FS_CHANNEL_IDENTIFICATION)) | |||
| #define IS_SAI_BLOCK_MASTER_DIVIDER(DIVIDER) ((DIVIDER) <= 15U) | |||
| #define IS_SAI_BLOCK_FRAME_LENGTH(LENGTH) ((8U <= (LENGTH)) && ((LENGTH) <= 256U)) | |||
| #define IS_SAI_BLOCK_ACTIVE_FRAME(LENGTH) ((1U <= (LENGTH)) && ((LENGTH) <= 128U)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup SAI_Private_Functions SAI Private Functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_SAI_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,134 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_sai_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of SAI Extension HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_SAI_EX_H | |||
| #define __STM32F4xx_HAL_SAI_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup SAIEx | |||
| * @{ | |||
| */ | |||
| #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ | |||
| defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F413xx) || \ | |||
| defined(STM32F423xx) | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup SAI_Clock_Source SAI Clock Source | |||
| * @{ | |||
| */ | |||
| #if defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define SAI_CLKSOURCE_PLLI2S ((uint32_t)0x00000000U) | |||
| #define SAI_CLKSOURCE_EXT ((uint32_t)0x00100000U) | |||
| #define SAI_CLKSOURCE_PLLR ((uint32_t)0x00200000U) | |||
| #define SAI_CLKSOURCE_HS ((uint32_t)0x00300000U) | |||
| #else | |||
| #define SAI_CLKSOURCE_PLLSAI ((uint32_t)0x00000000U) | |||
| #define SAI_CLKSOURCE_PLLI2S ((uint32_t)0x00100000U) | |||
| #define SAI_CLKSOURCE_EXT ((uint32_t)0x00200000U) | |||
| #define SAI_CLKSOURCE_NA ((uint32_t)0x00400000U) /*!< No applicable for STM32F446xx */ | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup SAIEx_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup SAIEx_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| /* Extended features functions ************************************************/ | |||
| void SAI_BlockSynchroConfig(SAI_HandleTypeDef *hsai); | |||
| uint32_t SAI_GetInputClock(SAI_HandleTypeDef *hsai); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| #if defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define IS_SAI_CLK_SOURCE(SOURCE) (((SOURCE) == SAI_CLKSOURCE_PLLI2S) ||\ | |||
| ((SOURCE) == SAI_CLKSOURCE_EXT)||\ | |||
| ((SOURCE) == SAI_CLKSOURCE_PLLR)||\ | |||
| ((SOURCE) == SAI_CLKSOURCE_HS)) | |||
| #else | |||
| #define IS_SAI_CLK_SOURCE(SOURCE) (((SOURCE) == SAI_CLKSOURCE_PLLSAI) ||\ | |||
| ((SOURCE) == SAI_CLKSOURCE_EXT)||\ | |||
| ((SOURCE) == SAI_CLKSOURCE_PLLI2S)||\ | |||
| ((SOURCE) == SAI_CLKSOURCE_NA)) | |||
| #endif | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_SAI_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_sd.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of SD HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -46,7 +46,7 @@ | |||
| defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \ | |||
| defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_ll_sdmmc.h" | |||
| @@ -785,7 +785,7 @@ HAL_SD_TransferStateTypedef HAL_SD_GetStatus(SD_HandleTypeDef *hsd); | |||
| */ | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || | |||
| STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || | |||
| STM32F412Rx || STM32F412Cx */ | |||
| STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| @@ -0,0 +1,197 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_sdram.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of SDRAM HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_SDRAM_H | |||
| #define __STM32F4xx_HAL_SDRAM_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ | |||
| defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_ll_fmc.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup SDRAM | |||
| * @{ | |||
| */ | |||
| /* Exported typedef ----------------------------------------------------------*/ | |||
| /** @defgroup SDRAM_Exported_Types SDRAM Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief HAL SDRAM State structure definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_SDRAM_STATE_RESET = 0x00U, /*!< SDRAM not yet initialized or disabled */ | |||
| HAL_SDRAM_STATE_READY = 0x01U, /*!< SDRAM initialized and ready for use */ | |||
| HAL_SDRAM_STATE_BUSY = 0x02U, /*!< SDRAM internal process is ongoing */ | |||
| HAL_SDRAM_STATE_ERROR = 0x03U, /*!< SDRAM error state */ | |||
| HAL_SDRAM_STATE_WRITE_PROTECTED = 0x04U, /*!< SDRAM device write protected */ | |||
| HAL_SDRAM_STATE_PRECHARGED = 0x05U /*!< SDRAM device precharged */ | |||
| }HAL_SDRAM_StateTypeDef; | |||
| /** | |||
| * @brief SDRAM handle Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| FMC_SDRAM_TypeDef *Instance; /*!< Register base address */ | |||
| FMC_SDRAM_InitTypeDef Init; /*!< SDRAM device configuration parameters */ | |||
| __IO HAL_SDRAM_StateTypeDef State; /*!< SDRAM access state */ | |||
| HAL_LockTypeDef Lock; /*!< SDRAM locking object */ | |||
| DMA_HandleTypeDef *hdma; /*!< Pointer DMA handler */ | |||
| }SDRAM_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup SDRAM_Exported_Macros SDRAM Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset SDRAM handle state | |||
| * @param __HANDLE__: specifies the SDRAM handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SDRAM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SDRAM_STATE_RESET) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup SDRAM_Exported_Functions SDRAM Exported Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup SDRAM_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| /* Initialization/de-initialization functions *********************************/ | |||
| HAL_StatusTypeDef HAL_SDRAM_Init(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_TimingTypeDef *Timing); | |||
| HAL_StatusTypeDef HAL_SDRAM_DeInit(SDRAM_HandleTypeDef *hsdram); | |||
| void HAL_SDRAM_MspInit(SDRAM_HandleTypeDef *hsdram); | |||
| void HAL_SDRAM_MspDeInit(SDRAM_HandleTypeDef *hsdram); | |||
| void HAL_SDRAM_IRQHandler(SDRAM_HandleTypeDef *hsdram); | |||
| void HAL_SDRAM_RefreshErrorCallback(SDRAM_HandleTypeDef *hsdram); | |||
| void HAL_SDRAM_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma); | |||
| void HAL_SDRAM_DMA_XferErrorCallback(DMA_HandleTypeDef *hdma); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup SDRAM_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| /* I/O operation functions ****************************************************/ | |||
| HAL_StatusTypeDef HAL_SDRAM_Read_8b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint8_t *pDstBuffer, uint32_t BufferSize); | |||
| HAL_StatusTypeDef HAL_SDRAM_Write_8b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint8_t *pSrcBuffer, uint32_t BufferSize); | |||
| HAL_StatusTypeDef HAL_SDRAM_Read_16b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint16_t *pDstBuffer, uint32_t BufferSize); | |||
| HAL_StatusTypeDef HAL_SDRAM_Write_16b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint16_t *pSrcBuffer, uint32_t BufferSize); | |||
| HAL_StatusTypeDef HAL_SDRAM_Read_32b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize); | |||
| HAL_StatusTypeDef HAL_SDRAM_Write_32b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize); | |||
| HAL_StatusTypeDef HAL_SDRAM_Read_DMA(SDRAM_HandleTypeDef *hsdram, uint32_t * pAddress, uint32_t *pDstBuffer, uint32_t BufferSize); | |||
| HAL_StatusTypeDef HAL_SDRAM_Write_DMA(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup SDRAM_Exported_Functions_Group3 | |||
| * @{ | |||
| */ | |||
| /* SDRAM Control functions *****************************************************/ | |||
| HAL_StatusTypeDef HAL_SDRAM_WriteProtection_Enable(SDRAM_HandleTypeDef *hsdram); | |||
| HAL_StatusTypeDef HAL_SDRAM_WriteProtection_Disable(SDRAM_HandleTypeDef *hsdram); | |||
| HAL_StatusTypeDef HAL_SDRAM_SendCommand(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_CommandTypeDef *Command, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_SDRAM_ProgramRefreshRate(SDRAM_HandleTypeDef *hsdram, uint32_t RefreshRate); | |||
| HAL_StatusTypeDef HAL_SDRAM_SetAutoRefreshNumber(SDRAM_HandleTypeDef *hsdram, uint32_t AutoRefreshNumber); | |||
| uint32_t HAL_SDRAM_GetModeStatus(SDRAM_HandleTypeDef *hsdram); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup SDRAM_Exported_Functions_Group4 | |||
| * @{ | |||
| */ | |||
| /* SDRAM State functions ********************************************************/ | |||
| HAL_SDRAM_StateTypeDef HAL_SDRAM_GetState(SDRAM_HandleTypeDef *hsdram); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_SDRAM_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,687 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_smartcard.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of SMARTCARD HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_SMARTCARD_H | |||
| #define __STM32F4xx_HAL_SMARTCARD_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup SMARTCARD | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup SMARTCARD_Exported_Types SMARTCARD Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief SMARTCARD Init Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t BaudRate; /*!< This member configures the SmartCard communication baud rate. | |||
| The baud rate is computed using the following formula: | |||
| - IntegerDivider = ((PCLKx) / (8 * (hirda->Init.BaudRate))) | |||
| - FractionalDivider = ((IntegerDivider - ((uint32_t) IntegerDivider)) * 8) + 0.5 */ | |||
| uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. | |||
| This parameter can be a value of @ref SMARTCARD_Word_Length */ | |||
| uint32_t StopBits; /*!< Specifies the number of stop bits transmitted. | |||
| This parameter can be a value of @ref SMARTCARD_Stop_Bits */ | |||
| uint32_t Parity; /*!< Specifies the parity mode. | |||
| This parameter can be a value of @ref SMARTCARD_Parity | |||
| @note When parity is enabled, the computed parity is inserted | |||
| at the MSB position of the transmitted data (9th bit when | |||
| the word length is set to 9 data bits; 8th bit when the | |||
| word length is set to 8 data bits).*/ | |||
| uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled. | |||
| This parameter can be a value of @ref SMARTCARD_Mode */ | |||
| uint32_t CLKPolarity; /*!< Specifies the steady state of the serial clock. | |||
| This parameter can be a value of @ref SMARTCARD_Clock_Polarity */ | |||
| uint32_t CLKPhase; /*!< Specifies the clock transition on which the bit capture is made. | |||
| This parameter can be a value of @ref SMARTCARD_Clock_Phase */ | |||
| uint32_t CLKLastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted | |||
| data bit (MSB) has to be output on the SCLK pin in synchronous mode. | |||
| This parameter can be a value of @ref SMARTCARD_Last_Bit */ | |||
| uint32_t Prescaler; /*!< Specifies the SmartCard Prescaler value used for dividing the system clock | |||
| to provide the smartcard clock. The value given in the register (5 significant bits) | |||
| is multiplied by 2 to give the division factor of the source clock frequency. | |||
| This parameter can be a value of @ref SMARTCARD_Prescaler */ | |||
| uint32_t GuardTime; /*!< Specifies the SmartCard Guard Time value in terms of number of baud clocks */ | |||
| uint32_t NACKState; /*!< Specifies the SmartCard NACK Transmission state. | |||
| This parameter can be a value of @ref SMARTCARD_NACK_State */ | |||
| }SMARTCARD_InitTypeDef; | |||
| /** | |||
| * @brief HAL SMARTCARD State structures definition | |||
| * @note HAL SMARTCARD State value is a combination of 2 different substates: gState and RxState. | |||
| * - gState contains SMARTCARD state information related to global Handle management | |||
| * and also information related to Tx operations. | |||
| * gState value coding follow below described bitmap : | |||
| * b7-b6 Error information | |||
| * 00 : No Error | |||
| * 01 : (Not Used) | |||
| * 10 : Timeout | |||
| * 11 : Error | |||
| * b5 IP initilisation status | |||
| * 0 : Reset (IP not initialized) | |||
| * 1 : Init done (IP not initialized. HAL SMARTCARD Init function already called) | |||
| * b4-b3 (not used) | |||
| * xx : Should be set to 00 | |||
| * b2 Intrinsic process state | |||
| * 0 : Ready | |||
| * 1 : Busy (IP busy with some configuration or internal operations) | |||
| * b1 (not used) | |||
| * x : Should be set to 0 | |||
| * b0 Tx state | |||
| * 0 : Ready (no Tx operation ongoing) | |||
| * 1 : Busy (Tx operation ongoing) | |||
| * - RxState contains information related to Rx operations. | |||
| * RxState value coding follow below described bitmap : | |||
| * b7-b6 (not used) | |||
| * xx : Should be set to 00 | |||
| * b5 IP initilisation status | |||
| * 0 : Reset (IP not initialized) | |||
| * 1 : Init done (IP not initialized) | |||
| * b4-b2 (not used) | |||
| * xxx : Should be set to 000 | |||
| * b1 Rx state | |||
| * 0 : Ready (no Rx operation ongoing) | |||
| * 1 : Busy (Rx operation ongoing) | |||
| * b0 (not used) | |||
| * x : Should be set to 0. | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_SMARTCARD_STATE_RESET = 0x00U, /*!< Peripheral is not yet Initialized | |||
| Value is allowed for gState and RxState */ | |||
| HAL_SMARTCARD_STATE_READY = 0x20U, /*!< Peripheral Initialized and ready for use | |||
| Value is allowed for gState and RxState */ | |||
| HAL_SMARTCARD_STATE_BUSY = 0x24U, /*!< an internal process is ongoing | |||
| Value is allowed for gState only */ | |||
| HAL_SMARTCARD_STATE_BUSY_TX = 0x21U, /*!< Data Transmission process is ongoing | |||
| Value is allowed for gState only */ | |||
| HAL_SMARTCARD_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing | |||
| Value is allowed for RxState only */ | |||
| HAL_SMARTCARD_STATE_BUSY_TX_RX = 0x23U, /*!< Data Transmission and Reception process is ongoing | |||
| Not to be used for neither gState nor RxState. | |||
| Value is result of combination (Or) between gState and RxState values */ | |||
| HAL_SMARTCARD_STATE_TIMEOUT = 0xA0U, /*!< Timeout state | |||
| Value is allowed for gState only */ | |||
| HAL_SMARTCARD_STATE_ERROR = 0xE0U /*!< Error | |||
| Value is allowed for gState only */ | |||
| }HAL_SMARTCARD_StateTypeDef; | |||
| /** | |||
| * @brief SMARTCARD handle Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| USART_TypeDef *Instance; /* USART registers base address */ | |||
| SMARTCARD_InitTypeDef Init; /* SmartCard communication parameters */ | |||
| uint8_t *pTxBuffPtr; /* Pointer to SmartCard Tx transfer Buffer */ | |||
| uint16_t TxXferSize; /* SmartCard Tx Transfer size */ | |||
| __IO uint16_t TxXferCount; /* SmartCard Tx Transfer Counter */ | |||
| uint8_t *pRxBuffPtr; /* Pointer to SmartCard Rx transfer Buffer */ | |||
| uint16_t RxXferSize; /* SmartCard Rx Transfer size */ | |||
| __IO uint16_t RxXferCount; /* SmartCard Rx Transfer Counter */ | |||
| DMA_HandleTypeDef *hdmatx; /* SmartCard Tx DMA Handle parameters */ | |||
| DMA_HandleTypeDef *hdmarx; /* SmartCard Rx DMA Handle parameters */ | |||
| HAL_LockTypeDef Lock; /* Locking object */ | |||
| __IO HAL_SMARTCARD_StateTypeDef gState; /* SmartCard state information related to global Handle management | |||
| and also related to Tx operations. | |||
| This parameter can be a value of @ref HAL_SMARTCARD_StateTypeDef */ | |||
| __IO HAL_SMARTCARD_StateTypeDef RxState; /* SmartCard state information related to Rx operations. | |||
| This parameter can be a value of @ref HAL_SMARTCARD_StateTypeDef */ | |||
| __IO uint32_t ErrorCode; /* SmartCard Error code */ | |||
| }SMARTCARD_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup SMARTCARD_Exported_Constants SMARTCARD Exported constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup SMARTCARD_Error_Code SMARTCARD Error Code | |||
| * @brief SMARTCARD Error Code | |||
| * @{ | |||
| */ | |||
| #define HAL_SMARTCARD_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */ | |||
| #define HAL_SMARTCARD_ERROR_PE ((uint32_t)0x00000001U) /*!< Parity error */ | |||
| #define HAL_SMARTCARD_ERROR_NE ((uint32_t)0x00000002U) /*!< Noise error */ | |||
| #define HAL_SMARTCARD_ERROR_FE ((uint32_t)0x00000004U) /*!< Frame error */ | |||
| #define HAL_SMARTCARD_ERROR_ORE ((uint32_t)0x00000008U) /*!< Overrun error */ | |||
| #define HAL_SMARTCARD_ERROR_DMA ((uint32_t)0x00000010U) /*!< DMA transfer error */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SMARTCARD_Word_Length SMARTCARD Word Length | |||
| * @{ | |||
| */ | |||
| #define SMARTCARD_WORDLENGTH_9B ((uint32_t)USART_CR1_M) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SMARTCARD_Stop_Bits SMARTCARD Number of Stop Bits | |||
| * @{ | |||
| */ | |||
| #define SMARTCARD_STOPBITS_0_5 ((uint32_t)USART_CR2_STOP_0) | |||
| #define SMARTCARD_STOPBITS_1_5 ((uint32_t)(USART_CR2_STOP_0 | USART_CR2_STOP_1)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SMARTCARD_Parity SMARTCARD Parity | |||
| * @{ | |||
| */ | |||
| #define SMARTCARD_PARITY_EVEN ((uint32_t)USART_CR1_PCE) | |||
| #define SMARTCARD_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SMARTCARD_Mode SMARTCARD Mode | |||
| * @{ | |||
| */ | |||
| #define SMARTCARD_MODE_RX ((uint32_t)USART_CR1_RE) | |||
| #define SMARTCARD_MODE_TX ((uint32_t)USART_CR1_TE) | |||
| #define SMARTCARD_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SMARTCARD_Clock_Polarity SMARTCARD Clock Polarity | |||
| * @{ | |||
| */ | |||
| #define SMARTCARD_POLARITY_LOW ((uint32_t)0x00000000U) | |||
| #define SMARTCARD_POLARITY_HIGH ((uint32_t)USART_CR2_CPOL) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SMARTCARD_Clock_Phase SMARTCARD Clock Phase | |||
| * @{ | |||
| */ | |||
| #define SMARTCARD_PHASE_1EDGE ((uint32_t)0x00000000U) | |||
| #define SMARTCARD_PHASE_2EDGE ((uint32_t)USART_CR2_CPHA) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SMARTCARD_Last_Bit SMARTCARD Last Bit | |||
| * @{ | |||
| */ | |||
| #define SMARTCARD_LASTBIT_DISABLE ((uint32_t)0x00000000U) | |||
| #define SMARTCARD_LASTBIT_ENABLE ((uint32_t)USART_CR2_LBCL) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SMARTCARD_NACK_State SMARTCARD NACK State | |||
| * @{ | |||
| */ | |||
| #define SMARTCARD_NACK_ENABLE ((uint32_t)USART_CR3_NACK) | |||
| #define SMARTCARD_NACK_DISABLE ((uint32_t)0x00000000U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SMARTCARD_DMA_Requests SMARTCARD DMA requests | |||
| * @{ | |||
| */ | |||
| #define SMARTCARD_DMAREQ_TX ((uint32_t)USART_CR3_DMAT) | |||
| #define SMARTCARD_DMAREQ_RX ((uint32_t)USART_CR3_DMAR) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SMARTCARD_Prescaler SMARTCARD Prescaler | |||
| * @{ | |||
| */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV2 ((uint32_t)0x00000001U) /*!< SYSCLK divided by 2 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV4 ((uint32_t)0x00000002U) /*!< SYSCLK divided by 4 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV6 ((uint32_t)0x00000003U) /*!< SYSCLK divided by 6 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV8 ((uint32_t)0x00000004U) /*!< SYSCLK divided by 8 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV10 ((uint32_t)0x00000005U) /*!< SYSCLK divided by 10 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV12 ((uint32_t)0x00000006U) /*!< SYSCLK divided by 12 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV14 ((uint32_t)0x00000007U) /*!< SYSCLK divided by 14 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV16 ((uint32_t)0x00000008U) /*!< SYSCLK divided by 16 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV18 ((uint32_t)0x00000009U) /*!< SYSCLK divided by 18 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV20 ((uint32_t)0x0000000AU) /*!< SYSCLK divided by 20 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV22 ((uint32_t)0x0000000BU) /*!< SYSCLK divided by 22 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV24 ((uint32_t)0x0000000CU) /*!< SYSCLK divided by 24 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV26 ((uint32_t)0x0000000DU) /*!< SYSCLK divided by 26 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV28 ((uint32_t)0x0000000EU) /*!< SYSCLK divided by 28 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV30 ((uint32_t)0x0000000FU) /*!< SYSCLK divided by 30 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV32 ((uint32_t)0x00000010U) /*!< SYSCLK divided by 32 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV34 ((uint32_t)0x00000011U) /*!< SYSCLK divided by 34 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV36 ((uint32_t)0x00000012U) /*!< SYSCLK divided by 36 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV38 ((uint32_t)0x00000013U) /*!< SYSCLK divided by 38 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV40 ((uint32_t)0x00000014U) /*!< SYSCLK divided by 40 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV42 ((uint32_t)0x00000015U) /*!< SYSCLK divided by 42 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV44 ((uint32_t)0x00000016U) /*!< SYSCLK divided by 44 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV46 ((uint32_t)0x00000017U) /*!< SYSCLK divided by 46 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV48 ((uint32_t)0x00000018U) /*!< SYSCLK divided by 48 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV50 ((uint32_t)0x00000019U) /*!< SYSCLK divided by 50 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV52 ((uint32_t)0x0000001AU) /*!< SYSCLK divided by 52 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV54 ((uint32_t)0x0000001BU) /*!< SYSCLK divided by 54 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV56 ((uint32_t)0x0000001CU) /*!< SYSCLK divided by 56 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV58 ((uint32_t)0x0000001DU) /*!< SYSCLK divided by 58 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV60 ((uint32_t)0x0000001EU) /*!< SYSCLK divided by 60 */ | |||
| #define SMARTCARD_PRESCALER_SYSCLK_DIV62 ((uint32_t)0x0000001FU) /*!< SYSCLK divided by 62 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SmartCard_Flags SMARTCARD Flags | |||
| * Elements values convention: 0xXXXX | |||
| * - 0xXXXX : Flag mask in the SR register | |||
| * @{ | |||
| */ | |||
| #define SMARTCARD_FLAG_TXE ((uint32_t)0x00000080U) | |||
| #define SMARTCARD_FLAG_TC ((uint32_t)0x00000040U) | |||
| #define SMARTCARD_FLAG_RXNE ((uint32_t)0x00000020U) | |||
| #define SMARTCARD_FLAG_IDLE ((uint32_t)0x00000010U) | |||
| #define SMARTCARD_FLAG_ORE ((uint32_t)0x00000008U) | |||
| #define SMARTCARD_FLAG_NE ((uint32_t)0x00000004U) | |||
| #define SMARTCARD_FLAG_FE ((uint32_t)0x00000002U) | |||
| #define SMARTCARD_FLAG_PE ((uint32_t)0x00000001U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SmartCard_Interrupt_definition SMARTCARD Interrupts Definition | |||
| * Elements values convention: 0xY000XXXX | |||
| * - XXXX : Interrupt mask in the XX register | |||
| * - Y : Interrupt source register (2bits) | |||
| * - 01: CR1 register | |||
| * - 10: CR3 register | |||
| * @{ | |||
| */ | |||
| #define SMARTCARD_IT_PE ((uint32_t)(SMARTCARD_CR1_REG_INDEX << 28U | USART_CR1_PEIE)) | |||
| #define SMARTCARD_IT_TXE ((uint32_t)(SMARTCARD_CR1_REG_INDEX << 28U | USART_CR1_TXEIE)) | |||
| #define SMARTCARD_IT_TC ((uint32_t)(SMARTCARD_CR1_REG_INDEX << 28U | USART_CR1_TCIE)) | |||
| #define SMARTCARD_IT_RXNE ((uint32_t)(SMARTCARD_CR1_REG_INDEX << 28U | USART_CR1_RXNEIE)) | |||
| #define SMARTCARD_IT_IDLE ((uint32_t)(SMARTCARD_CR1_REG_INDEX << 28U | USART_CR1_IDLEIE)) | |||
| #define SMARTCARD_IT_ERR ((uint32_t)(SMARTCARD_CR3_REG_INDEX << 28U | USART_CR3_EIE)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup SMARTCARD_Exported_Macros SMARTCARD Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset SMARTCARD handle gstate & RxState | |||
| * @param __HANDLE__: specifies the SMARTCARD Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SMARTCARD_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->gState = HAL_SMARTCARD_STATE_RESET; \ | |||
| (__HANDLE__)->RxState = HAL_SMARTCARD_STATE_RESET; \ | |||
| } while(0) | |||
| /** @brief Flushs the Smartcard DR register | |||
| * @param __HANDLE__: specifies the SMARTCARD Handle. | |||
| */ | |||
| #define __HAL_SMARTCARD_FLUSH_DRREGISTER(__HANDLE__) ((__HANDLE__)->Instance->DR) | |||
| /** @brief Checks whether the specified Smartcard flag is set or not. | |||
| * @param __HANDLE__: specifies the SMARTCARD Handle. | |||
| * @param __FLAG__: specifies the flag to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg SMARTCARD_FLAG_TXE: Transmit data register empty flag | |||
| * @arg SMARTCARD_FLAG_TC: Transmission Complete flag | |||
| * @arg SMARTCARD_FLAG_RXNE: Receive data register not empty flag | |||
| * @arg SMARTCARD_FLAG_IDLE: Idle Line detection flag | |||
| * @arg SMARTCARD_FLAG_ORE: Overrun Error flag | |||
| * @arg SMARTCARD_FLAG_NE: Noise Error flag | |||
| * @arg SMARTCARD_FLAG_FE: Framing Error flag | |||
| * @arg SMARTCARD_FLAG_PE: Parity Error flag | |||
| * @retval The new state of __FLAG__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_SMARTCARD_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) | |||
| /** @brief Clears the specified Smartcard pending flags. | |||
| * @param __HANDLE__: specifies the SMARTCARD Handle. | |||
| * @param __FLAG__: specifies the flag to check. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg SMARTCARD_FLAG_TC: Transmission Complete flag. | |||
| * @arg SMARTCARD_FLAG_RXNE: Receive data register not empty flag. | |||
| * | |||
| * @note PE (Parity error), FE (Framing error), NE (Noise error) and ORE (Overrun | |||
| * error) flags are cleared by software sequence: a read operation to | |||
| * USART_SR register followed by a read operation to USART_DR register. | |||
| * @note RXNE flag can be also cleared by a read to the USART_DR register. | |||
| * @note TC flag can be also cleared by software sequence: a read operation to | |||
| * USART_SR register followed by a write operation to USART_DR register. | |||
| * @note TXE flag is cleared only by a write to the USART_DR register. | |||
| */ | |||
| #define __HAL_SMARTCARD_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__)) | |||
| /** @brief Clear the SMARTCARD PE pending flag. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or | |||
| * SMARTCARD peripheral. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SMARTCARD_CLEAR_PEFLAG(__HANDLE__) \ | |||
| do{ \ | |||
| __IO uint32_t tmpreg = 0x00U; \ | |||
| tmpreg = (__HANDLE__)->Instance->SR; \ | |||
| tmpreg = (__HANDLE__)->Instance->DR; \ | |||
| UNUSED(tmpreg); \ | |||
| } while(0) | |||
| /** @brief Clear the SMARTCARD FE pending flag. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or | |||
| * SMARTCARD peripheral. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SMARTCARD_CLEAR_FEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_PEFLAG(__HANDLE__) | |||
| /** @brief Clear the SMARTCARD NE pending flag. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or | |||
| * SMARTCARD peripheral. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SMARTCARD_CLEAR_NEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_PEFLAG(__HANDLE__) | |||
| /** @brief Clear the SMARTCARD ORE pending flag. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or | |||
| * SMARTCARD peripheral. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SMARTCARD_CLEAR_OREFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_PEFLAG(__HANDLE__) | |||
| /** @brief Clear the SMARTCARD IDLE pending flag. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3, 4, 5, 6, 7 or 8 to select the USART or | |||
| * SMARTCARD peripheral. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SMARTCARD_CLEAR_IDLEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_PEFLAG(__HANDLE__) | |||
| /** @brief Enables or disables the specified SmartCard interrupts. | |||
| * @param __HANDLE__: specifies the SMARTCARD Handle. | |||
| * @param __INTERRUPT__: specifies the SMARTCARD interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt | |||
| * @arg SMARTCARD_IT_TC: Transmission complete interrupt | |||
| * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt | |||
| * @arg SMARTCARD_IT_IDLE: Idle line detection interrupt | |||
| * @arg SMARTCARD_IT_PE: Parity Error interrupt | |||
| * @arg SMARTCARD_IT_ERR: Error interrupt(Frame error, noise error, overrun error) | |||
| */ | |||
| #define __HAL_SMARTCARD_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28U) == 1U)? ((__HANDLE__)->Instance->CR1 |= ((__INTERRUPT__) & SMARTCARD_IT_MASK)): \ | |||
| ((__HANDLE__)->Instance->CR3 |= ((__INTERRUPT__) & SMARTCARD_IT_MASK))) | |||
| #define __HAL_SMARTCARD_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28U) == 1U)? ((__HANDLE__)->Instance->CR1 &= ~((__INTERRUPT__) & SMARTCARD_IT_MASK)): \ | |||
| ((__HANDLE__)->Instance->CR3 &= ~ ((__INTERRUPT__) & SMARTCARD_IT_MASK))) | |||
| /** @brief Checks whether the specified SmartCard interrupt has occurred or not. | |||
| * @param __HANDLE__: specifies the SmartCard Handle. | |||
| * @param __IT__: specifies the SMARTCARD interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt | |||
| * @arg SMARTCARD_IT_TC: Transmission complete interrupt | |||
| * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt | |||
| * @arg SMARTCARD_IT_IDLE: Idle line detection interrupt | |||
| * @arg SMARTCARD_IT_ERR: Error interrupt | |||
| * @arg SMARTCARD_IT_PE: Parity Error interrupt | |||
| * @retval The new state of __IT__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_SMARTCARD_GET_IT_SOURCE(__HANDLE__, __IT__) (((((__IT__) >> 28U) == 1U)? (__HANDLE__)->Instance->CR1: (__HANDLE__)->Instance->CR3) & (((uint32_t)(__IT__)) & SMARTCARD_IT_MASK)) | |||
| /** @brief Macro to enable the SMARTCARD's one bit sample method | |||
| * @param __HANDLE__: specifies the SMARTCARD Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SMARTCARD_ONE_BIT_SAMPLE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT) | |||
| /** @brief Macro to disable the SMARTCARD's one bit sample method | |||
| * @param __HANDLE__: specifies the SMARTCARD Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SMARTCARD_ONE_BIT_SAMPLE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3 &= (uint16_t)~((uint16_t)USART_CR3_ONEBIT)) | |||
| /** @brief Enable the USART associated to the SMARTCARD Handle | |||
| * @param __HANDLE__: specifies the SMARTCARD Handle. | |||
| * SMARTCARD Handle selects the USARTx peripheral (USART availability and x value depending on device). | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SMARTCARD_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE) | |||
| /** @brief Disable the USART associated to the SMARTCARD Handle | |||
| * @param __HANDLE__: specifies the SMARTCARD Handle. | |||
| * SMARTCARD Handle selects the USARTx peripheral (USART availability and x value depending on device). | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SMARTCARD_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE) | |||
| /** @brief Macros to enable or disable the SmartCard DMA request. | |||
| * @param __HANDLE__: specifies the SmartCard Handle. | |||
| * @param __REQUEST__: specifies the SmartCard DMA request. | |||
| * This parameter can be one of the following values: | |||
| * @arg SMARTCARD_DMAREQ_TX: SmartCard DMA transmit request | |||
| * @arg SMARTCARD_DMAREQ_RX: SmartCard DMA receive request | |||
| */ | |||
| #define __HAL_SMARTCARD_DMA_REQUEST_ENABLE(__HANDLE__, __REQUEST__) ((__HANDLE__)->Instance->CR3 |= (__REQUEST__)) | |||
| #define __HAL_SMARTCARD_DMA_REQUEST_DISABLE(__HANDLE__, __REQUEST__) ((__HANDLE__)->Instance->CR3 &= ~(__REQUEST__)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup SMARTCARD_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup SMARTCARD_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| /* Initialization/de-initialization functions **********************************/ | |||
| HAL_StatusTypeDef HAL_SMARTCARD_Init(SMARTCARD_HandleTypeDef *hsc); | |||
| HAL_StatusTypeDef HAL_SMARTCARD_ReInit(SMARTCARD_HandleTypeDef *hsc); | |||
| HAL_StatusTypeDef HAL_SMARTCARD_DeInit(SMARTCARD_HandleTypeDef *hsc); | |||
| void HAL_SMARTCARD_MspInit(SMARTCARD_HandleTypeDef *hsc); | |||
| void HAL_SMARTCARD_MspDeInit(SMARTCARD_HandleTypeDef *hsc); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup SMARTCARD_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| /* IO operation functions *******************************************************/ | |||
| HAL_StatusTypeDef HAL_SMARTCARD_Transmit(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_SMARTCARD_Receive(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_SMARTCARD_Transmit_IT(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_SMARTCARD_Receive_IT(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_SMARTCARD_Transmit_DMA(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_SMARTCARD_Receive_DMA(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size); | |||
| /* Transfer Abort functions */ | |||
| HAL_StatusTypeDef HAL_SMARTCARD_Abort(SMARTCARD_HandleTypeDef *hsc); | |||
| HAL_StatusTypeDef HAL_SMARTCARD_AbortTransmit(SMARTCARD_HandleTypeDef *hsc); | |||
| HAL_StatusTypeDef HAL_SMARTCARD_AbortReceive(SMARTCARD_HandleTypeDef *hsc); | |||
| HAL_StatusTypeDef HAL_SMARTCARD_Abort_IT(SMARTCARD_HandleTypeDef *hsc); | |||
| HAL_StatusTypeDef HAL_SMARTCARD_AbortTransmit_IT(SMARTCARD_HandleTypeDef *hsc); | |||
| HAL_StatusTypeDef HAL_SMARTCARD_AbortReceive_IT(SMARTCARD_HandleTypeDef *hsc); | |||
| void HAL_SMARTCARD_IRQHandler(SMARTCARD_HandleTypeDef *hsc); | |||
| void HAL_SMARTCARD_TxCpltCallback(SMARTCARD_HandleTypeDef *hsc); | |||
| void HAL_SMARTCARD_RxCpltCallback(SMARTCARD_HandleTypeDef *hsc); | |||
| void HAL_SMARTCARD_ErrorCallback(SMARTCARD_HandleTypeDef *hsc); | |||
| void HAL_SMARTCARD_AbortCpltCallback(SMARTCARD_HandleTypeDef *hsc); | |||
| void HAL_SMARTCARD_AbortTransmitCpltCallback(SMARTCARD_HandleTypeDef *hsc); | |||
| void HAL_SMARTCARD_AbortReceiveCpltCallback(SMARTCARD_HandleTypeDef *hsc); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup SMARTCARD_Exported_Functions_Group3 | |||
| * @{ | |||
| */ | |||
| /* Peripheral State functions **************************************************/ | |||
| HAL_SMARTCARD_StateTypeDef HAL_SMARTCARD_GetState(SMARTCARD_HandleTypeDef *hsc); | |||
| uint32_t HAL_SMARTCARD_GetError(SMARTCARD_HandleTypeDef *hsc); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup SMARTCARD_Private_Constants SMARTCARD Private Constants | |||
| * @{ | |||
| */ | |||
| /** @brief SMARTCARD interruptions flag mask | |||
| * | |||
| */ | |||
| #define SMARTCARD_IT_MASK ((uint32_t) USART_CR1_PEIE | USART_CR1_TXEIE | USART_CR1_TCIE | USART_CR1_RXNEIE | \ | |||
| USART_CR1_IDLEIE | USART_CR3_EIE ) | |||
| #define SMARTCARD_DIV(_PCLK_, _BAUD_) (((_PCLK_)*25U)/(4U*(_BAUD_))) | |||
| #define SMARTCARD_DIVMANT(_PCLK_, _BAUD_) (SMARTCARD_DIV((_PCLK_), (_BAUD_))/100U) | |||
| #define SMARTCARD_DIVFRAQ(_PCLK_, _BAUD_) (((SMARTCARD_DIV((_PCLK_), (_BAUD_)) - (SMARTCARD_DIVMANT((_PCLK_), (_BAUD_)) * 100U)) * 16U + 50U) / 100U) | |||
| /* SMARTCARD BRR = mantissa + overflow + fraction | |||
| = (SMARTCARD DIVMANT << 4) + (SMARTCARD DIVFRAQ & 0xF0) + (SMARTCARD DIVFRAQ & 0x0FU) */ | |||
| #define SMARTCARD_BRR(_PCLK_, _BAUD_) (((SMARTCARD_DIVMANT((_PCLK_), (_BAUD_)) << 4U) + \ | |||
| (SMARTCARD_DIVFRAQ((_PCLK_), (_BAUD_)) & 0xF0U)) + \ | |||
| (SMARTCARD_DIVFRAQ((_PCLK_), (_BAUD_)) & 0x0FU)) | |||
| #define SMARTCARD_CR1_REG_INDEX 1U | |||
| #define SMARTCARD_CR3_REG_INDEX 3U | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros --------------------------------------------------------*/ | |||
| /** @defgroup SMARTCARD_Private_Macros SMARTCARD Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_SMARTCARD_WORD_LENGTH(LENGTH) ((LENGTH) == SMARTCARD_WORDLENGTH_9B) | |||
| #define IS_SMARTCARD_STOPBITS(STOPBITS) (((STOPBITS) == SMARTCARD_STOPBITS_0_5) || \ | |||
| ((STOPBITS) == SMARTCARD_STOPBITS_1_5)) | |||
| #define IS_SMARTCARD_PARITY(PARITY) (((PARITY) == SMARTCARD_PARITY_EVEN) || \ | |||
| ((PARITY) == SMARTCARD_PARITY_ODD)) | |||
| #define IS_SMARTCARD_MODE(MODE) ((((MODE) & (uint32_t)0x0000FFF3U) == 0x00U) && ((MODE) != (uint32_t)0x000000U)) | |||
| #define IS_SMARTCARD_POLARITY(CPOL) (((CPOL) == SMARTCARD_POLARITY_LOW) || ((CPOL) == SMARTCARD_POLARITY_HIGH)) | |||
| #define IS_SMARTCARD_PHASE(CPHA) (((CPHA) == SMARTCARD_PHASE_1EDGE) || ((CPHA) == SMARTCARD_PHASE_2EDGE)) | |||
| #define IS_SMARTCARD_LASTBIT(LASTBIT) (((LASTBIT) == SMARTCARD_LASTBIT_DISABLE) || \ | |||
| ((LASTBIT) == SMARTCARD_LASTBIT_ENABLE)) | |||
| #define IS_SMARTCARD_NACK_STATE(NACK) (((NACK) == SMARTCARD_NACK_ENABLE) || \ | |||
| ((NACK) == SMARTCARD_NACK_DISABLE)) | |||
| #define IS_SMARTCARD_BAUDRATE(BAUDRATE) ((BAUDRATE) < 10500001U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup SMARTCARD_Private_Functions SMARTCARD Private Functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_SMARTCARD_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,555 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_spdifrx.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of SPDIFRX HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_SPDIFRX_H | |||
| #define __STM32F4xx_HAL_SPDIFRX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #if defined(STM32F446xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup SPDIFRX | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup SPDIFRX_Exported_Types SPDIFRX Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief SPDIFRX Init structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t InputSelection; /*!< Specifies the SPDIF input selection. | |||
| This parameter can be a value of @ref SPDIFRX_Input_Selection */ | |||
| uint32_t Retries; /*!< Specifies the Maximum allowed re-tries during synchronization phase. | |||
| This parameter can be a value of @ref SPDIFRX_Max_Retries */ | |||
| uint32_t WaitForActivity; /*!< Specifies the wait for activity on SPDIF selected input. | |||
| This parameter can be a value of @ref SPDIFRX_Wait_For_Activity. */ | |||
| uint32_t ChannelSelection; /*!< Specifies whether the control flow will take the channel status from channel A or B. | |||
| This parameter can be a value of @ref SPDIFRX_Channel_Selection */ | |||
| uint32_t DataFormat; /*!< Specifies the Data samples format (LSB, MSB, ...). | |||
| This parameter can be a value of @ref SPDIFRX_Data_Format */ | |||
| uint32_t StereoMode; /*!< Specifies whether the peripheral is in stereo or mono mode. | |||
| This parameter can be a value of @ref SPDIFRX_Stereo_Mode */ | |||
| uint32_t PreambleTypeMask; /*!< Specifies whether The preamble type bits are copied or not into the received frame. | |||
| This parameter can be a value of @ref SPDIFRX_PT_Mask */ | |||
| uint32_t ChannelStatusMask; /*!< Specifies whether the channel status and user bits are copied or not into the received frame. | |||
| This parameter can be a value of @ref SPDIFRX_ChannelStatus_Mask */ | |||
| uint32_t ValidityBitMask; /*!< Specifies whether the validity bit is copied or not into the received frame. | |||
| This parameter can be a value of @ref SPDIFRX_V_Mask */ | |||
| uint32_t ParityErrorMask; /*!< Specifies whether the parity error bit is copied or not into the received frame. | |||
| This parameter can be a value of @ref SPDIFRX_PE_Mask */ | |||
| }SPDIFRX_InitTypeDef; | |||
| /** | |||
| * @brief SPDIFRX SetDataFormat structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t DataFormat; /*!< Specifies the Data samples format (LSB, MSB, ...). | |||
| This parameter can be a value of @ref SPDIFRX_Data_Format */ | |||
| uint32_t StereoMode; /*!< Specifies whether the peripheral is in stereo or mono mode. | |||
| This parameter can be a value of @ref SPDIFRX_Stereo_Mode */ | |||
| uint32_t PreambleTypeMask; /*!< Specifies whether The preamble type bits are copied or not into the received frame. | |||
| This parameter can be a value of @ref SPDIFRX_PT_Mask */ | |||
| uint32_t ChannelStatusMask; /*!< Specifies whether the channel status and user bits are copied or not into the received frame. | |||
| This parameter can be a value of @ref SPDIFRX_ChannelStatus_Mask */ | |||
| uint32_t ValidityBitMask; /*!< Specifies whether the validity bit is copied or not into the received frame. | |||
| This parameter can be a value of @ref SPDIFRX_V_Mask */ | |||
| uint32_t ParityErrorMask; /*!< Specifies whether the parity error bit is copied or not into the received frame. | |||
| This parameter can be a value of @ref SPDIFRX_PE_Mask */ | |||
| }SPDIFRX_SetDataFormatTypeDef; | |||
| /** | |||
| * @brief HAL State structures definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_SPDIFRX_STATE_RESET = 0x00U, /*!< SPDIFRX not yet initialized or disabled */ | |||
| HAL_SPDIFRX_STATE_READY = 0x01U, /*!< SPDIFRX initialized and ready for use */ | |||
| HAL_SPDIFRX_STATE_BUSY = 0x02U, /*!< SPDIFRX internal process is ongoing */ | |||
| HAL_SPDIFRX_STATE_BUSY_RX = 0x03U, /*!< SPDIFRX internal Data Flow RX process is ongoing */ | |||
| HAL_SPDIFRX_STATE_BUSY_CX = 0x04U, /*!< SPDIFRX internal Control Flow RX process is ongoing */ | |||
| HAL_SPDIFRX_STATE_ERROR = 0x07U /*!< SPDIFRX error state */ | |||
| }HAL_SPDIFRX_StateTypeDef; | |||
| /** | |||
| * @brief SPDIFRX handle Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| SPDIFRX_TypeDef *Instance; /* SPDIFRX registers base address */ | |||
| SPDIFRX_InitTypeDef Init; /* SPDIFRX communication parameters */ | |||
| uint32_t *pRxBuffPtr; /* Pointer to SPDIFRX Rx transfer buffer */ | |||
| uint32_t *pCsBuffPtr; /* Pointer to SPDIFRX Cx transfer buffer */ | |||
| __IO uint16_t RxXferSize; /* SPDIFRX Rx transfer size */ | |||
| __IO uint16_t RxXferCount; /* SPDIFRX Rx transfer counter | |||
| (This field is initialized at the | |||
| same value as transfer size at the | |||
| beginning of the transfer and | |||
| decremented when a sample is received. | |||
| NbSamplesReceived = RxBufferSize-RxBufferCount) */ | |||
| __IO uint16_t CsXferSize; /* SPDIFRX Rx transfer size */ | |||
| __IO uint16_t CsXferCount; /* SPDIFRX Rx transfer counter | |||
| (This field is initialized at the | |||
| same value as transfer size at the | |||
| beginning of the transfer and | |||
| decremented when a sample is received. | |||
| NbSamplesReceived = RxBufferSize-RxBufferCount) */ | |||
| DMA_HandleTypeDef *hdmaCsRx; /* SPDIFRX EC60958_channel_status and user_information DMA handle parameters */ | |||
| DMA_HandleTypeDef *hdmaDrRx; /* SPDIFRX Rx DMA handle parameters */ | |||
| __IO HAL_LockTypeDef Lock; /* SPDIFRX locking object */ | |||
| __IO HAL_SPDIFRX_StateTypeDef State; /* SPDIFRX communication state */ | |||
| __IO uint32_t ErrorCode; /* SPDIFRX Error code */ | |||
| }SPDIFRX_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup SPDIFRX_Exported_Constants SPDIFRX Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup SPDIFRX_ErrorCode SPDIFRX Error Code | |||
| * @{ | |||
| */ | |||
| #define HAL_SPDIFRX_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */ | |||
| #define HAL_SPDIFRX_ERROR_TIMEOUT ((uint32_t)0x00000001U) /*!< Timeout error */ | |||
| #define HAL_SPDIFRX_ERROR_OVR ((uint32_t)0x00000002U) /*!< OVR error */ | |||
| #define HAL_SPDIFRX_ERROR_PE ((uint32_t)0x00000004U) /*!< Parity error */ | |||
| #define HAL_SPDIFRX_ERROR_DMA ((uint32_t)0x00000008U) /*!< DMA transfer error */ | |||
| #define HAL_SPDIFRX_ERROR_UNKNOWN ((uint32_t)0x00000010U) /*!< Unknown Error error */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SPDIFRX_Input_Selection SPDIFRX Input Selection | |||
| * @{ | |||
| */ | |||
| #define SPDIFRX_INPUT_IN0 ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_INPUT_IN1 ((uint32_t)0x00010000U) | |||
| #define SPDIFRX_INPUT_IN2 ((uint32_t)0x00020000U) | |||
| #define SPDIFRX_INPUT_IN3 ((uint32_t)0x00030000U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SPDIFRX_Max_Retries SPDIFRX Maximum Retries | |||
| * @{ | |||
| */ | |||
| #define SPDIFRX_MAXRETRIES_NONE ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_MAXRETRIES_3 ((uint32_t)0x00001000U) | |||
| #define SPDIFRX_MAXRETRIES_15 ((uint32_t)0x00002000U) | |||
| #define SPDIFRX_MAXRETRIES_63 ((uint32_t)0x00003000U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SPDIFRX_Wait_For_Activity SPDIFRX Wait For Activity | |||
| * @{ | |||
| */ | |||
| #define SPDIFRX_WAITFORACTIVITY_OFF ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_WAITFORACTIVITY_ON ((uint32_t)SPDIFRX_CR_WFA) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SPDIFRX_PT_Mask SPDIFRX Preamble Type Mask | |||
| * @{ | |||
| */ | |||
| #define SPDIFRX_PREAMBLETYPEMASK_OFF ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_PREAMBLETYPEMASK_ON ((uint32_t)SPDIFRX_CR_PTMSK) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SPDIFRX_ChannelStatus_Mask SPDIFRX Channel Status Mask | |||
| * @{ | |||
| */ | |||
| #define SPDIFRX_CHANNELSTATUS_OFF ((uint32_t)0x00000000U) /* The channel status and user bits are copied into the SPDIF_DR */ | |||
| #define SPDIFRX_CHANNELSTATUS_ON ((uint32_t)SPDIFRX_CR_CUMSK) /* The channel status and user bits are not copied into the SPDIF_DR, zeros are written instead*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SPDIFRX_V_Mask SPDIFRX Validity Mask | |||
| * @{ | |||
| */ | |||
| #define SPDIFRX_VALIDITYMASK_OFF ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_VALIDITYMASK_ON ((uint32_t)SPDIFRX_CR_VMSK) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SPDIFRX_PE_Mask SPDIFRX Parity Error Mask | |||
| * @{ | |||
| */ | |||
| #define SPDIFRX_PARITYERRORMASK_OFF ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_PARITYERRORMASK_ON ((uint32_t)SPDIFRX_CR_PMSK) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SPDIFRX_Channel_Selection SPDIFRX Channel Selection | |||
| * @{ | |||
| */ | |||
| #define SPDIFRX_CHANNEL_A ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_CHANNEL_B ((uint32_t)SPDIFRX_CR_CHSEL) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SPDIFRX_Data_Format SPDIFRX Data Format | |||
| * @{ | |||
| */ | |||
| #define SPDIFRX_DATAFORMAT_LSB ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_DATAFORMAT_MSB ((uint32_t)0x00000010U) | |||
| #define SPDIFRX_DATAFORMAT_32BITS ((uint32_t)0x00000020U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SPDIFRX_Stereo_Mode SPDIFRX Stereo Mode | |||
| * @{ | |||
| */ | |||
| #define SPDIFRX_STEREOMODE_DISABLE ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_STEREOMODE_ENABLE ((uint32_t)SPDIFRX_CR_RXSTEO) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SPDIFRX_State SPDIFRX State | |||
| * @{ | |||
| */ | |||
| #define SPDIFRX_STATE_IDLE ((uint32_t)0xFFFFFFFCU) | |||
| #define SPDIFRX_STATE_SYNC ((uint32_t)0x00000001U) | |||
| #define SPDIFRX_STATE_RCV ((uint32_t)SPDIFRX_CR_SPDIFEN) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SPDIFRX_Interrupts_Definition SPDIFRX Interrupts Definition | |||
| * @{ | |||
| */ | |||
| #define SPDIFRX_IT_RXNE ((uint32_t)SPDIFRX_IMR_RXNEIE) | |||
| #define SPDIFRX_IT_CSRNE ((uint32_t)SPDIFRX_IMR_CSRNEIE) | |||
| #define SPDIFRX_IT_PERRIE ((uint32_t)SPDIFRX_IMR_PERRIE) | |||
| #define SPDIFRX_IT_OVRIE ((uint32_t)SPDIFRX_IMR_OVRIE) | |||
| #define SPDIFRX_IT_SBLKIE ((uint32_t)SPDIFRX_IMR_SBLKIE) | |||
| #define SPDIFRX_IT_SYNCDIE ((uint32_t)SPDIFRX_IMR_SYNCDIE) | |||
| #define SPDIFRX_IT_IFEIE ((uint32_t)SPDIFRX_IMR_IFEIE ) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SPDIFRX_Flags_Definition SPDIFRX Flags Definition | |||
| * @{ | |||
| */ | |||
| #define SPDIFRX_FLAG_RXNE ((uint32_t)SPDIFRX_SR_RXNE) | |||
| #define SPDIFRX_FLAG_CSRNE ((uint32_t)SPDIFRX_SR_CSRNE) | |||
| #define SPDIFRX_FLAG_PERR ((uint32_t)SPDIFRX_SR_PERR) | |||
| #define SPDIFRX_FLAG_OVR ((uint32_t)SPDIFRX_SR_OVR) | |||
| #define SPDIFRX_FLAG_SBD ((uint32_t)SPDIFRX_SR_SBD) | |||
| #define SPDIFRX_FLAG_SYNCD ((uint32_t)SPDIFRX_SR_SYNCD) | |||
| #define SPDIFRX_FLAG_FERR ((uint32_t)SPDIFRX_SR_FERR) | |||
| #define SPDIFRX_FLAG_SERR ((uint32_t)SPDIFRX_SR_SERR) | |||
| #define SPDIFRX_FLAG_TERR ((uint32_t)SPDIFRX_SR_TERR) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macros -----------------------------------------------------------*/ | |||
| /** @defgroup SPDIFRX_Exported_macros SPDIFRX Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset SPDIFRX handle state | |||
| * @param __HANDLE__: SPDIFRX handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SPDIFRX_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = (uint16_t)SPDIFRX_CR_SPDIFEN) | |||
| /** @brief Disable the specified SPDIFRX peripheral (IDLE State). | |||
| * @param __HANDLE__: specifies the SPDIFRX Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SPDIFRX_IDLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= SPDIFRX_STATE_IDLE) | |||
| /** @brief Enable the specified SPDIFRX peripheral (SYNC State). | |||
| * @param __HANDLE__: specifies the SPDIFRX Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SPDIFRX_SYNC(__HANDLE__) ((__HANDLE__)->Instance->CR |= SPDIFRX_STATE_SYNC) | |||
| /** @brief Enable the specified SPDIFRX peripheral (RCV State). | |||
| * @param __HANDLE__: specifies the SPDIFRX Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SPDIFRX_RCV(__HANDLE__) ((__HANDLE__)->Instance->CR |= SPDIFRX_STATE_RCV) | |||
| /** @brief Enable or disable the specified SPDIFRX interrupts. | |||
| * @param __HANDLE__: specifies the SPDIFRX Handle. | |||
| * @param __INTERRUPT__: specifies the interrupt source to enable or disable. | |||
| * This parameter can be one of the following values: | |||
| * @arg SPDIFRX_IT_RXNE | |||
| * @arg SPDIFRX_IT_CSRNE | |||
| * @arg SPDIFRX_IT_PERRIE | |||
| * @arg SPDIFRX_IT_OVRIE | |||
| * @arg SPDIFRX_IT_SBLKIE | |||
| * @arg SPDIFRX_IT_SYNCDIE | |||
| * @arg SPDIFRX_IT_IFEIE | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SPDIFRX_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IMR |= (__INTERRUPT__)) | |||
| #define __HAL_SPDIFRX_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IMR &= (uint16_t)(~(__INTERRUPT__))) | |||
| /** @brief Checks if the specified SPDIFRX interrupt source is enabled or disabled. | |||
| * @param __HANDLE__: specifies the SPDIFRX Handle. | |||
| * @param __INTERRUPT__: specifies the SPDIFRX interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg SPDIFRX_IT_RXNE | |||
| * @arg SPDIFRX_IT_CSRNE | |||
| * @arg SPDIFRX_IT_PERRIE | |||
| * @arg SPDIFRX_IT_OVRIE | |||
| * @arg SPDIFRX_IT_SBLKIE | |||
| * @arg SPDIFRX_IT_SYNCDIE | |||
| * @arg SPDIFRX_IT_IFEIE | |||
| * @retval The new state of __IT__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_SPDIFRX_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IMR & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) | |||
| /** @brief Checks whether the specified SPDIFRX flag is set or not. | |||
| * @param __HANDLE__: specifies the SPDIFRX Handle. | |||
| * @param __FLAG__: specifies the flag to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg SPDIFRX_FLAG_RXNE | |||
| * @arg SPDIFRX_FLAG_CSRNE | |||
| * @arg SPDIFRX_FLAG_PERR | |||
| * @arg SPDIFRX_FLAG_OVR | |||
| * @arg SPDIFRX_FLAG_SBD | |||
| * @arg SPDIFRX_FLAG_SYNCD | |||
| * @arg SPDIFRX_FLAG_FERR | |||
| * @arg SPDIFRX_FLAG_SERR | |||
| * @arg SPDIFRX_FLAG_TERR | |||
| * @retval The new state of __FLAG__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_SPDIFRX_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__)) | |||
| /** @brief Clears the specified SPDIFRX SR flag, in setting the proper IFCR register bit. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * @param __IT_CLEAR__: specifies the interrupt clear register flag that needs to be set | |||
| * to clear the corresponding interrupt | |||
| * This parameter can be one of the following values: | |||
| * @arg SPDIFRX_FLAG_PERR | |||
| * @arg SPDIFRX_FLAG_OVR | |||
| * @arg SPDIFRX_SR_SBD | |||
| * @arg SPDIFRX_SR_SYNCD | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SPDIFRX_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->IFCR = (uint32_t)(__IT_CLEAR__)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup SPDIFRX_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup SPDIFRX_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| /* Initialization/de-initialization functions **********************************/ | |||
| HAL_StatusTypeDef HAL_SPDIFRX_Init(SPDIFRX_HandleTypeDef *hspdif); | |||
| HAL_StatusTypeDef HAL_SPDIFRX_DeInit (SPDIFRX_HandleTypeDef *hspdif); | |||
| void HAL_SPDIFRX_MspInit(SPDIFRX_HandleTypeDef *hspdif); | |||
| void HAL_SPDIFRX_MspDeInit(SPDIFRX_HandleTypeDef *hspdif); | |||
| HAL_StatusTypeDef HAL_SPDIFRX_SetDataFormat(SPDIFRX_HandleTypeDef *hspdif, SPDIFRX_SetDataFormatTypeDef sDataFormat); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup SPDIFRX_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| /* I/O operation functions ***************************************************/ | |||
| /* Blocking mode: Polling */ | |||
| HAL_StatusTypeDef HAL_SPDIFRX_ReceiveDataFlow(SPDIFRX_HandleTypeDef *hspdif, uint32_t *pData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_SPDIFRX_ReceiveControlFlow(SPDIFRX_HandleTypeDef *hspdif, uint32_t *pData, uint16_t Size, uint32_t Timeout); | |||
| /* Non-Blocking mode: Interrupt */ | |||
| HAL_StatusTypeDef HAL_SPDIFRX_ReceiveControlFlow_IT(SPDIFRX_HandleTypeDef *hspdif, uint32_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_SPDIFRX_ReceiveDataFlow_IT(SPDIFRX_HandleTypeDef *hspdif, uint32_t *pData, uint16_t Size); | |||
| void HAL_SPDIFRX_IRQHandler(SPDIFRX_HandleTypeDef *hspdif); | |||
| /* Non-Blocking mode: DMA */ | |||
| HAL_StatusTypeDef HAL_SPDIFRX_ReceiveControlFlow_DMA(SPDIFRX_HandleTypeDef *hspdif, uint32_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_SPDIFRX_ReceiveDataFlow_DMA(SPDIFRX_HandleTypeDef *hspdif, uint32_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_SPDIFRX_DMAStop(SPDIFRX_HandleTypeDef *hspdif); | |||
| /* Callbacks used in non blocking modes (Interrupt and DMA) *******************/ | |||
| void HAL_SPDIFRX_RxHalfCpltCallback(SPDIFRX_HandleTypeDef *hspdif); | |||
| void HAL_SPDIFRX_RxCpltCallback(SPDIFRX_HandleTypeDef *hspdif); | |||
| void HAL_SPDIFRX_ErrorCallback(SPDIFRX_HandleTypeDef *hspdif); | |||
| void HAL_SPDIFRX_CxHalfCpltCallback(SPDIFRX_HandleTypeDef *hspdif); | |||
| void HAL_SPDIFRX_CxCpltCallback(SPDIFRX_HandleTypeDef *hspdif); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup SPDIFRX_Exported_Functions_Group3 | |||
| * @{ | |||
| */ | |||
| /* Peripheral Control and State functions ************************************/ | |||
| HAL_SPDIFRX_StateTypeDef HAL_SPDIFRX_GetState(SPDIFRX_HandleTypeDef *hspdif); | |||
| uint32_t HAL_SPDIFRX_GetError(SPDIFRX_HandleTypeDef *hspdif); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup SPDIFRX_Private_Macros SPDIFRX Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_SPDIFRX_INPUT_SELECT(INPUT) (((INPUT) == SPDIFRX_INPUT_IN1) || \ | |||
| ((INPUT) == SPDIFRX_INPUT_IN2) || \ | |||
| ((INPUT) == SPDIFRX_INPUT_IN3) || \ | |||
| ((INPUT) == SPDIFRX_INPUT_IN0)) | |||
| #define IS_SPDIFRX_MAX_RETRIES(RET) (((RET) == SPDIFRX_MAXRETRIES_NONE) || \ | |||
| ((RET) == SPDIFRX_MAXRETRIES_3) || \ | |||
| ((RET) == SPDIFRX_MAXRETRIES_15) || \ | |||
| ((RET) == SPDIFRX_MAXRETRIES_63)) | |||
| #define IS_SPDIFRX_WAIT_FOR_ACTIVITY(VAL) (((VAL) == SPDIFRX_WAITFORACTIVITY_ON) || \ | |||
| ((VAL) == SPDIFRX_WAITFORACTIVITY_OFF)) | |||
| #define IS_PREAMBLE_TYPE_MASK(VAL) (((VAL) == SPDIFRX_PREAMBLETYPEMASK_ON) || \ | |||
| ((VAL) == SPDIFRX_PREAMBLETYPEMASK_OFF)) | |||
| #define IS_VALIDITY_MASK(VAL) (((VAL) == SPDIFRX_VALIDITYMASK_OFF) || \ | |||
| ((VAL) == SPDIFRX_VALIDITYMASK_ON)) | |||
| #define IS_PARITY_ERROR_MASK(VAL) (((VAL) == SPDIFRX_PARITYERRORMASK_OFF) || \ | |||
| ((VAL) == SPDIFRX_PARITYERRORMASK_ON)) | |||
| #define IS_SPDIFRX_CHANNEL(CHANNEL) (((CHANNEL) == SPDIFRX_CHANNEL_A) || \ | |||
| ((CHANNEL) == SPDIFRX_CHANNEL_B)) | |||
| #define IS_SPDIFRX_DATA_FORMAT(FORMAT) (((FORMAT) == SPDIFRX_DATAFORMAT_LSB) || \ | |||
| ((FORMAT) == SPDIFRX_DATAFORMAT_MSB) || \ | |||
| ((FORMAT) == SPDIFRX_DATAFORMAT_32BITS)) | |||
| #define IS_STEREO_MODE(MODE) (((MODE) == SPDIFRX_STEREOMODE_DISABLE) || \ | |||
| ((MODE) == SPDIFRX_STEREOMODE_ENABLE)) | |||
| #define IS_CHANNEL_STATUS_MASK(VAL) (((VAL) == SPDIFRX_CHANNELSTATUS_ON) || \ | |||
| ((VAL) == SPDIFRX_CHANNELSTATUS_OFF)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup SPDIFRX_Private_Functions SPDIFRX Private Functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F446xx */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_SPDIFRX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_spi.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of SPI HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -0,0 +1,208 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_sram.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of SRAM HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_SRAM_H | |||
| #define __STM32F4xx_HAL_SRAM_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| #include "stm32f4xx_ll_fsmc.h" | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */ | |||
| #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\ | |||
| defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) | |||
| #include "stm32f4xx_ll_fmc.h" | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ | |||
| defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ | |||
| defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /** @addtogroup SRAM | |||
| * @{ | |||
| */ | |||
| /* Exported typedef ----------------------------------------------------------*/ | |||
| /** @defgroup SRAM_Exported_Types SRAM Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief HAL SRAM State structures definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_SRAM_STATE_RESET = 0x00U, /*!< SRAM not yet initialized or disabled */ | |||
| HAL_SRAM_STATE_READY = 0x01U, /*!< SRAM initialized and ready for use */ | |||
| HAL_SRAM_STATE_BUSY = 0x02U, /*!< SRAM internal process is ongoing */ | |||
| HAL_SRAM_STATE_ERROR = 0x03U, /*!< SRAM error state */ | |||
| HAL_SRAM_STATE_PROTECTED = 0x04U /*!< SRAM peripheral NORSRAM device write protected */ | |||
| }HAL_SRAM_StateTypeDef; | |||
| /** | |||
| * @brief SRAM handle Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| FMC_NORSRAM_TypeDef *Instance; /*!< Register base address */ | |||
| FMC_NORSRAM_EXTENDED_TypeDef *Extended; /*!< Extended mode register base address */ | |||
| FMC_NORSRAM_InitTypeDef Init; /*!< SRAM device control configuration parameters */ | |||
| HAL_LockTypeDef Lock; /*!< SRAM locking object */ | |||
| __IO HAL_SRAM_StateTypeDef State; /*!< SRAM device access state */ | |||
| DMA_HandleTypeDef *hdma; /*!< Pointer DMA handler */ | |||
| }SRAM_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup SRAM_Exported_Macros SRAM Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset SRAM handle state | |||
| * @param __HANDLE__: SRAM handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SRAM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SRAM_STATE_RESET) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup SRAM_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup SRAM_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| /* Initialization/de-initialization functions **********************************/ | |||
| HAL_StatusTypeDef HAL_SRAM_Init(SRAM_HandleTypeDef *hsram, FMC_NORSRAM_TimingTypeDef *Timing, FMC_NORSRAM_TimingTypeDef *ExtTiming); | |||
| HAL_StatusTypeDef HAL_SRAM_DeInit(SRAM_HandleTypeDef *hsram); | |||
| void HAL_SRAM_MspInit(SRAM_HandleTypeDef *hsram); | |||
| void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef *hsram); | |||
| void HAL_SRAM_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma); | |||
| void HAL_SRAM_DMA_XferErrorCallback(DMA_HandleTypeDef *hdma); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup SRAM_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| /* I/O operation functions *****************************************************/ | |||
| HAL_StatusTypeDef HAL_SRAM_Read_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pDstBuffer, uint32_t BufferSize); | |||
| HAL_StatusTypeDef HAL_SRAM_Write_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pSrcBuffer, uint32_t BufferSize); | |||
| HAL_StatusTypeDef HAL_SRAM_Read_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pDstBuffer, uint32_t BufferSize); | |||
| HAL_StatusTypeDef HAL_SRAM_Write_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pSrcBuffer, uint32_t BufferSize); | |||
| HAL_StatusTypeDef HAL_SRAM_Read_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize); | |||
| HAL_StatusTypeDef HAL_SRAM_Write_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize); | |||
| HAL_StatusTypeDef HAL_SRAM_Read_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize); | |||
| HAL_StatusTypeDef HAL_SRAM_Write_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup SRAM_Exported_Functions_Group3 | |||
| * @{ | |||
| */ | |||
| /* SRAM Control functions ******************************************************/ | |||
| HAL_StatusTypeDef HAL_SRAM_WriteOperation_Enable(SRAM_HandleTypeDef *hsram); | |||
| HAL_StatusTypeDef HAL_SRAM_WriteOperation_Disable(SRAM_HandleTypeDef *hsram); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup SRAM_Exported_Functions_Group4 | |||
| * @{ | |||
| */ | |||
| /* SRAM State functions *********************************************************/ | |||
| HAL_SRAM_StateTypeDef HAL_SRAM_GetState(SRAM_HandleTypeDef *hsram); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\ | |||
| STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ | |||
| STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_SRAM_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_tim.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of TIM HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_tim_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of TIM HAL Extension module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -133,14 +133,23 @@ typedef struct | |||
| #define TIM_TIM11_GPIO (0x00000000U) | |||
| #define TIM_TIM11_HSE (0x00000002U) | |||
| #if defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define TIM_TIM9_TIM3_TRGO (0x10000000U) | |||
| #define TIM_TIM9_LPTIM (0x10000010U) | |||
| #define TIM_TIM5_TIM3_TRGO (0x10000000U) | |||
| #define TIM_TIM5_LPTIM (0x10000008U) | |||
| #define TIM_TIM1_TIM3_TRGO (0x10000000U) | |||
| #define TIM_TIM1_LPTIM (0x10000004U) | |||
| #endif /* STM32F413xx | STM32F423xx */ | |||
| #if defined (STM32F446xx) | |||
| #define TIM_TIM11_SPDIFRX (0x00000001U) | |||
| #define TIM_TIM11_SPDIFRX (0x00000001U) | |||
| #endif /* STM32F446xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) | |||
| #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /** @defgroup TIMEx_SystemBreakInput TIM System Break Input | |||
| * @{ | |||
| */ | |||
| @@ -150,7 +159,7 @@ typedef struct | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ | |||
| #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx || STM32F413xx || STM32F423xx */ | |||
| /** | |||
| * @} | |||
| @@ -293,6 +302,23 @@ HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef* htim); | |||
| ((TIM_REMAP) == TIM_TIM11_GPIO)||\ | |||
| ((TIM_REMAP) == TIM_TIM11_SPDIFRX)||\ | |||
| ((TIM_REMAP) == TIM_TIM11_HSE)) | |||
| #elif defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define IS_TIM_REMAP(TIM_REMAP) (((TIM_REMAP) == TIM_TIM2_TIM8_TRGO)||\ | |||
| ((TIM_REMAP) == TIM_TIM2_ETH_PTP)||\ | |||
| ((TIM_REMAP) == TIM_TIM2_USBFS_SOF)||\ | |||
| ((TIM_REMAP) == TIM_TIM2_USBHS_SOF)||\ | |||
| ((TIM_REMAP) == TIM_TIM5_GPIO)||\ | |||
| ((TIM_REMAP) == TIM_TIM5_LSI)||\ | |||
| ((TIM_REMAP) == TIM_TIM5_LSE)||\ | |||
| ((TIM_REMAP) == TIM_TIM5_RTC)||\ | |||
| ((TIM_REMAP) == TIM_TIM11_GPIO)||\ | |||
| ((TIM_REMAP) == TIM_TIM11_HSE)||\ | |||
| ((TIM_REMAP) == TIM_TIM9_TIM3_TRGO)||\ | |||
| ((TIM_REMAP) == TIM_TIM9_LPTIM)||\ | |||
| ((TIM_REMAP) == TIM_TIM5_TIM3_TRGO)||\ | |||
| ((TIM_REMAP) == TIM_TIM5_LPTIM)||\ | |||
| ((TIM_REMAP) == TIM_TIM1_TIM3_TRGO)||\ | |||
| ((TIM_REMAP) == TIM_TIM1_LPTIM)) | |||
| #else | |||
| #define IS_TIM_REMAP(TIM_REMAP) (((TIM_REMAP) == TIM_TIM2_TIM8_TRGO)||\ | |||
| ((TIM_REMAP) == TIM_TIM2_ETH_PTP)||\ | |||
| @@ -306,12 +332,12 @@ HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef* htim); | |||
| ((TIM_REMAP) == TIM_TIM11_HSE)) | |||
| #endif /* STM32F446xx */ | |||
| #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) | |||
| #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| #define IS_TIM_SYSTEMBREAKINPUT(BREAKINPUT) (((BREAKINPUT) == TIM_SYSTEMBREAKINPUT_HARDFAULT)||\ | |||
| ((BREAKINPUT) == TIM_SYSTEMBREAKINPUT_PVD)||\ | |||
| ((BREAKINPUT) == TIM_SYSTEMBREAKINPUT_HARDFAULT_PVD)) | |||
| #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ | |||
| #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx || STM32F413xx || STM32F423xx */ | |||
| #define IS_TIM_DEADTIME(DEADTIME) ((DEADTIME) <= 0xFFU) | |||
| /** | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_uart.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of UART HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -653,6 +653,13 @@ HAL_StatusTypeDef HAL_UART_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData | |||
| HAL_StatusTypeDef HAL_UART_DMAPause(UART_HandleTypeDef *huart); | |||
| HAL_StatusTypeDef HAL_UART_DMAResume(UART_HandleTypeDef *huart); | |||
| HAL_StatusTypeDef HAL_UART_DMAStop(UART_HandleTypeDef *huart); | |||
| /* Transfer Abort functions */ | |||
| HAL_StatusTypeDef HAL_UART_Abort(UART_HandleTypeDef *huart); | |||
| HAL_StatusTypeDef HAL_UART_AbortTransmit(UART_HandleTypeDef *huart); | |||
| HAL_StatusTypeDef HAL_UART_AbortReceive(UART_HandleTypeDef *huart); | |||
| HAL_StatusTypeDef HAL_UART_Abort_IT(UART_HandleTypeDef *huart); | |||
| HAL_StatusTypeDef HAL_UART_AbortTransmit_IT(UART_HandleTypeDef *huart); | |||
| HAL_StatusTypeDef HAL_UART_AbortReceive_IT(UART_HandleTypeDef *huart); | |||
| void HAL_UART_IRQHandler(UART_HandleTypeDef *huart); | |||
| void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart); | |||
| @@ -660,6 +667,9 @@ void HAL_UART_TxHalfCpltCallback(UART_HandleTypeDef *huart); | |||
| void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart); | |||
| void HAL_UART_RxHalfCpltCallback(UART_HandleTypeDef *huart); | |||
| void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart); | |||
| void HAL_UART_AbortCpltCallback (UART_HandleTypeDef *huart); | |||
| void HAL_UART_AbortTransmitCpltCallback (UART_HandleTypeDef *huart); | |||
| void HAL_UART_AbortReceiveCpltCallback (UART_HandleTypeDef *huart); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -0,0 +1,592 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_usart.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of USART HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_USART_H | |||
| #define __STM32F4xx_HAL_USART_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup USART | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup USART_Exported_Types USART Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief USART Init Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t BaudRate; /*!< This member configures the Usart communication baud rate. | |||
| The baud rate is computed using the following formula: | |||
| - IntegerDivider = ((PCLKx) / (8 * (husart->Init.BaudRate))) | |||
| - FractionalDivider = ((IntegerDivider - ((uint32_t) IntegerDivider)) * 8) + 0.5 */ | |||
| uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. | |||
| This parameter can be a value of @ref USART_Word_Length */ | |||
| uint32_t StopBits; /*!< Specifies the number of stop bits transmitted. | |||
| This parameter can be a value of @ref USART_Stop_Bits */ | |||
| uint32_t Parity; /*!< Specifies the parity mode. | |||
| This parameter can be a value of @ref USART_Parity | |||
| @note When parity is enabled, the computed parity is inserted | |||
| at the MSB position of the transmitted data (9th bit when | |||
| the word length is set to 9 data bits; 8th bit when the | |||
| word length is set to 8 data bits). */ | |||
| uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled. | |||
| This parameter can be a value of @ref USART_Mode */ | |||
| uint32_t CLKPolarity; /*!< Specifies the steady state of the serial clock. | |||
| This parameter can be a value of @ref USART_Clock_Polarity */ | |||
| uint32_t CLKPhase; /*!< Specifies the clock transition on which the bit capture is made. | |||
| This parameter can be a value of @ref USART_Clock_Phase */ | |||
| uint32_t CLKLastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted | |||
| data bit (MSB) has to be output on the SCLK pin in synchronous mode. | |||
| This parameter can be a value of @ref USART_Last_Bit */ | |||
| }USART_InitTypeDef; | |||
| /** | |||
| * @brief HAL State structures definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_USART_STATE_RESET = 0x00U, /*!< Peripheral is not yet Initialized */ | |||
| HAL_USART_STATE_READY = 0x01U, /*!< Peripheral Initialized and ready for use */ | |||
| HAL_USART_STATE_BUSY = 0x02U, /*!< an internal process is ongoing */ | |||
| HAL_USART_STATE_BUSY_TX = 0x12U, /*!< Data Transmission process is ongoing */ | |||
| HAL_USART_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing */ | |||
| HAL_USART_STATE_BUSY_TX_RX = 0x32U, /*!< Data Transmission Reception process is ongoing */ | |||
| HAL_USART_STATE_TIMEOUT = 0x03U, /*!< Timeout state */ | |||
| HAL_USART_STATE_ERROR = 0x04U /*!< Error */ | |||
| }HAL_USART_StateTypeDef; | |||
| /** | |||
| * @brief USART handle Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| USART_TypeDef *Instance; /* USART registers base address */ | |||
| USART_InitTypeDef Init; /* Usart communication parameters */ | |||
| uint8_t *pTxBuffPtr; /* Pointer to Usart Tx transfer Buffer */ | |||
| uint16_t TxXferSize; /* Usart Tx Transfer size */ | |||
| __IO uint16_t TxXferCount; /* Usart Tx Transfer Counter */ | |||
| uint8_t *pRxBuffPtr; /* Pointer to Usart Rx transfer Buffer */ | |||
| uint16_t RxXferSize; /* Usart Rx Transfer size */ | |||
| __IO uint16_t RxXferCount; /* Usart Rx Transfer Counter */ | |||
| DMA_HandleTypeDef *hdmatx; /* Usart Tx DMA Handle parameters */ | |||
| DMA_HandleTypeDef *hdmarx; /* Usart Rx DMA Handle parameters */ | |||
| HAL_LockTypeDef Lock; /* Locking object */ | |||
| __IO HAL_USART_StateTypeDef State; /* Usart communication state */ | |||
| __IO uint32_t ErrorCode; /* USART Error code */ | |||
| }USART_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup USART_Exported_Constants USART Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup USART_Error_Code USART Error Code | |||
| * @brief USART Error Code | |||
| * @{ | |||
| */ | |||
| #define HAL_USART_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */ | |||
| #define HAL_USART_ERROR_PE ((uint32_t)0x00000001U) /*!< Parity error */ | |||
| #define HAL_USART_ERROR_NE ((uint32_t)0x00000002U) /*!< Noise error */ | |||
| #define HAL_USART_ERROR_FE ((uint32_t)0x00000004U) /*!< Frame error */ | |||
| #define HAL_USART_ERROR_ORE ((uint32_t)0x00000008U) /*!< Overrun error */ | |||
| #define HAL_USART_ERROR_DMA ((uint32_t)0x00000010U) /*!< DMA transfer error */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup USART_Word_Length USART Word Length | |||
| * @{ | |||
| */ | |||
| #define USART_WORDLENGTH_8B ((uint32_t)0x00000000U) | |||
| #define USART_WORDLENGTH_9B ((uint32_t)USART_CR1_M) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup USART_Stop_Bits USART Number of Stop Bits | |||
| * @{ | |||
| */ | |||
| #define USART_STOPBITS_1 ((uint32_t)0x00000000U) | |||
| #define USART_STOPBITS_0_5 ((uint32_t)USART_CR2_STOP_0) | |||
| #define USART_STOPBITS_2 ((uint32_t)USART_CR2_STOP_1) | |||
| #define USART_STOPBITS_1_5 ((uint32_t)(USART_CR2_STOP_0 | USART_CR2_STOP_1)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup USART_Parity USART Parity | |||
| * @{ | |||
| */ | |||
| #define USART_PARITY_NONE ((uint32_t)0x00000000U) | |||
| #define USART_PARITY_EVEN ((uint32_t)USART_CR1_PCE) | |||
| #define USART_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup USART_Mode USART Mode | |||
| * @{ | |||
| */ | |||
| #define USART_MODE_RX ((uint32_t)USART_CR1_RE) | |||
| #define USART_MODE_TX ((uint32_t)USART_CR1_TE) | |||
| #define USART_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup USART_Clock USART Clock | |||
| * @{ | |||
| */ | |||
| #define USART_CLOCK_DISABLE ((uint32_t)0x00000000U) | |||
| #define USART_CLOCK_ENABLE ((uint32_t)USART_CR2_CLKEN) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup USART_Clock_Polarity USART Clock Polarity | |||
| * @{ | |||
| */ | |||
| #define USART_POLARITY_LOW ((uint32_t)0x00000000U) | |||
| #define USART_POLARITY_HIGH ((uint32_t)USART_CR2_CPOL) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup USART_Clock_Phase USART Clock Phase | |||
| * @{ | |||
| */ | |||
| #define USART_PHASE_1EDGE ((uint32_t)0x00000000U) | |||
| #define USART_PHASE_2EDGE ((uint32_t)USART_CR2_CPHA) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup USART_Last_Bit USART Last Bit | |||
| * @{ | |||
| */ | |||
| #define USART_LASTBIT_DISABLE ((uint32_t)0x00000000U) | |||
| #define USART_LASTBIT_ENABLE ((uint32_t)USART_CR2_LBCL) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup USART_NACK_State USART NACK State | |||
| * @{ | |||
| */ | |||
| #define USART_NACK_ENABLE ((uint32_t)USART_CR3_NACK) | |||
| #define USART_NACK_DISABLE ((uint32_t)0x00000000U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup USART_Flags USART Flags | |||
| * Elements values convention: 0xXXXX | |||
| * - 0xXXXX : Flag mask in the SR register | |||
| * @{ | |||
| */ | |||
| #define USART_FLAG_TXE ((uint32_t)0x00000080U) | |||
| #define USART_FLAG_TC ((uint32_t)0x00000040U) | |||
| #define USART_FLAG_RXNE ((uint32_t)0x00000020U) | |||
| #define USART_FLAG_IDLE ((uint32_t)0x00000010U) | |||
| #define USART_FLAG_ORE ((uint32_t)0x00000008U) | |||
| #define USART_FLAG_NE ((uint32_t)0x00000004U) | |||
| #define USART_FLAG_FE ((uint32_t)0x00000002U) | |||
| #define USART_FLAG_PE ((uint32_t)0x00000001U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup USART_Interrupt_definition USART Interrupts Definition | |||
| * Elements values convention: 0xY000XXXX | |||
| * - XXXX : Interrupt mask in the XX register | |||
| * - Y : Interrupt source register (2bits) | |||
| * - 01: CR1 register | |||
| * - 10: CR2 register | |||
| * - 11: CR3 register | |||
| * | |||
| * @{ | |||
| */ | |||
| #define USART_IT_PE ((uint32_t)(USART_CR1_REG_INDEX << 28U | USART_CR1_PEIE)) | |||
| #define USART_IT_TXE ((uint32_t)(USART_CR1_REG_INDEX << 28U | USART_CR1_TXEIE)) | |||
| #define USART_IT_TC ((uint32_t)(USART_CR1_REG_INDEX << 28U | USART_CR1_TCIE)) | |||
| #define USART_IT_RXNE ((uint32_t)(USART_CR1_REG_INDEX << 28U | USART_CR1_RXNEIE)) | |||
| #define USART_IT_IDLE ((uint32_t)(USART_CR1_REG_INDEX << 28U | USART_CR1_IDLEIE)) | |||
| #define USART_IT_LBD ((uint32_t)(USART_CR2_REG_INDEX << 28U | USART_CR2_LBDIE)) | |||
| #define USART_IT_CTS ((uint32_t)(USART_CR3_REG_INDEX << 28U | USART_CR3_CTSIE)) | |||
| #define USART_IT_ERR ((uint32_t)(USART_CR3_REG_INDEX << 28U | USART_CR3_EIE)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup USART_Exported_Macros USART Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset USART handle state | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_USART_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_USART_STATE_RESET) | |||
| /** @brief Checks whether the specified Smartcard flag is set or not. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral. | |||
| * @param __FLAG__: specifies the flag to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg USART_FLAG_TXE: Transmit data register empty flag | |||
| * @arg USART_FLAG_TC: Transmission Complete flag | |||
| * @arg USART_FLAG_RXNE: Receive data register not empty flag | |||
| * @arg USART_FLAG_IDLE: Idle Line detection flag | |||
| * @arg USART_FLAG_ORE: Overrun Error flag | |||
| * @arg USART_FLAG_NE: Noise Error flag | |||
| * @arg USART_FLAG_FE: Framing Error flag | |||
| * @arg USART_FLAG_PE: Parity Error flag | |||
| * @retval The new state of __FLAG__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_USART_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) | |||
| /** @brief Clears the specified Smartcard pending flags. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral. | |||
| * @param __FLAG__: specifies the flag to check. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg USART_FLAG_TC: Transmission Complete flag. | |||
| * @arg USART_FLAG_RXNE: Receive data register not empty flag. | |||
| * | |||
| * @note PE (Parity error), FE (Framing error), NE (Noise error), ORE (Overrun | |||
| * error) and IDLE (Idle line detected) flags are cleared by software | |||
| * sequence: a read operation to USART_SR register followed by a read | |||
| * operation to USART_DR register. | |||
| * @note RXNE flag can be also cleared by a read to the USART_DR register. | |||
| * @note TC flag can be also cleared by software sequence: a read operation to | |||
| * USART_SR register followed by a write operation to USART_DR register. | |||
| * @note TXE flag is cleared only by a write to the USART_DR register. | |||
| * | |||
| * @retval None | |||
| */ | |||
| #define __HAL_USART_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__)) | |||
| /** @brief Clear the USART PE pending flag. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_USART_CLEAR_PEFLAG(__HANDLE__) \ | |||
| do{ \ | |||
| __IO uint32_t tmpreg = 0x00U; \ | |||
| tmpreg = (__HANDLE__)->Instance->SR; \ | |||
| tmpreg = (__HANDLE__)->Instance->DR; \ | |||
| UNUSED(tmpreg); \ | |||
| } while(0) | |||
| /** @brief Clear the USART FE pending flag. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_USART_CLEAR_FEFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__) | |||
| /** @brief Clear the USART NE pending flag. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_USART_CLEAR_NEFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__) | |||
| /** @brief Clear the UART ORE pending flag. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_USART_CLEAR_OREFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__) | |||
| /** @brief Clear the USART IDLE pending flag. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_USART_CLEAR_IDLEFLAG(__HANDLE__) __HAL_USART_CLEAR_PEFLAG(__HANDLE__) | |||
| /** @brief Enables or disables the specified USART interrupts. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral. | |||
| * @param __INTERRUPT__: specifies the USART interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg USART_IT_TXE: Transmit Data Register empty interrupt | |||
| * @arg USART_IT_TC: Transmission complete interrupt | |||
| * @arg USART_IT_RXNE: Receive Data register not empty interrupt | |||
| * @arg USART_IT_IDLE: Idle line detection interrupt | |||
| * @arg USART_IT_PE: Parity Error interrupt | |||
| * @arg USART_IT_ERR: Error interrupt(Frame error, noise error, overrun error) | |||
| * This parameter can be: ENABLE or DISABLE. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_USART_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28U) == 1U)? ((__HANDLE__)->Instance->CR1 |= ((__INTERRUPT__) & USART_IT_MASK)): \ | |||
| (((__INTERRUPT__) >> 28U) == 2U)? ((__HANDLE__)->Instance->CR2 |= ((__INTERRUPT__) & USART_IT_MASK)): \ | |||
| ((__HANDLE__)->Instance->CR3 |= ((__INTERRUPT__) & USART_IT_MASK))) | |||
| #define __HAL_USART_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((((__INTERRUPT__) >> 28U) == 1U)? ((__HANDLE__)->Instance->CR1 &= ~((__INTERRUPT__) & USART_IT_MASK)): \ | |||
| (((__INTERRUPT__) >> 28U) == 2U)? ((__HANDLE__)->Instance->CR2 &= ~((__INTERRUPT__) & USART_IT_MASK)): \ | |||
| ((__HANDLE__)->Instance->CR3 &= ~ ((__INTERRUPT__) & USART_IT_MASK))) | |||
| /** @brief Checks whether the specified USART interrupt has occurred or not. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * This parameter can be USARTx where x: 1, 2, 3 or 6 to select the USART peripheral. | |||
| * @param __IT__: specifies the USART interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg USART_IT_TXE: Transmit Data Register empty interrupt | |||
| * @arg USART_IT_TC: Transmission complete interrupt | |||
| * @arg USART_IT_RXNE: Receive Data register not empty interrupt | |||
| * @arg USART_IT_IDLE: Idle line detection interrupt | |||
| * @arg USART_IT_ERR: Error interrupt | |||
| * @arg USART_IT_PE: Parity Error interrupt | |||
| * @retval The new state of __IT__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_USART_GET_IT_SOURCE(__HANDLE__, __IT__) (((((__IT__) >> 28U) == 1U)? (__HANDLE__)->Instance->CR1:(((((uint32_t)(__IT__)) >> 28U) == 2U)? \ | |||
| (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & (((uint32_t)(__IT__)) & USART_IT_MASK)) | |||
| /** @brief Macro to enable the USART's one bit sample method | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_USART_ONE_BIT_SAMPLE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT) | |||
| /** @brief Macro to disable the USART's one bit sample method | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_USART_ONE_BIT_SAMPLE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3 &= (uint16_t)~((uint16_t)USART_CR3_ONEBIT)) | |||
| /** @brief Enable USART | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). | |||
| * @retval None | |||
| */ | |||
| #define __HAL_USART_ENABLE(__HANDLE__) ( (__HANDLE__)->Instance->CR1 |= USART_CR1_UE) | |||
| /** @brief Disable USART | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * USART Handle selects the USARTx peripheral (USART availability and x value depending on device). | |||
| * @retval None | |||
| */ | |||
| #define __HAL_USART_DISABLE(__HANDLE__) ( (__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup USART_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup USART_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| /* Initialization/de-initialization functions **********************************/ | |||
| HAL_StatusTypeDef HAL_USART_Init(USART_HandleTypeDef *husart); | |||
| HAL_StatusTypeDef HAL_USART_DeInit(USART_HandleTypeDef *husart); | |||
| void HAL_USART_MspInit(USART_HandleTypeDef *husart); | |||
| void HAL_USART_MspDeInit(USART_HandleTypeDef *husart); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup USART_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| /* IO operation functions *******************************************************/ | |||
| HAL_StatusTypeDef HAL_USART_Transmit(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_USART_Receive(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_USART_TransmitReceive(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_USART_Transmit_IT(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_USART_Receive_IT(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_USART_TransmitReceive_IT(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_USART_Transmit_DMA(USART_HandleTypeDef *husart, uint8_t *pTxData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_USART_Receive_DMA(USART_HandleTypeDef *husart, uint8_t *pRxData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_USART_TransmitReceive_DMA(USART_HandleTypeDef *husart, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_USART_DMAPause(USART_HandleTypeDef *husart); | |||
| HAL_StatusTypeDef HAL_USART_DMAResume(USART_HandleTypeDef *husart); | |||
| HAL_StatusTypeDef HAL_USART_DMAStop(USART_HandleTypeDef *husart); | |||
| /* Transfer Abort functions */ | |||
| HAL_StatusTypeDef HAL_USART_Abort(USART_HandleTypeDef *husart); | |||
| HAL_StatusTypeDef HAL_USART_Abort_IT(USART_HandleTypeDef *husart); | |||
| void HAL_USART_IRQHandler(USART_HandleTypeDef *husart); | |||
| void HAL_USART_TxCpltCallback(USART_HandleTypeDef *husart); | |||
| void HAL_USART_TxHalfCpltCallback(USART_HandleTypeDef *husart); | |||
| void HAL_USART_RxCpltCallback(USART_HandleTypeDef *husart); | |||
| void HAL_USART_RxHalfCpltCallback(USART_HandleTypeDef *husart); | |||
| void HAL_USART_TxRxCpltCallback(USART_HandleTypeDef *husart); | |||
| void HAL_USART_ErrorCallback(USART_HandleTypeDef *husart); | |||
| void HAL_USART_AbortCpltCallback (USART_HandleTypeDef *husart); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup USART_Exported_Functions_Group3 | |||
| * @{ | |||
| */ | |||
| /* Peripheral State functions ************************************************/ | |||
| HAL_USART_StateTypeDef HAL_USART_GetState(USART_HandleTypeDef *husart); | |||
| uint32_t HAL_USART_GetError(USART_HandleTypeDef *husart); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup USART_Private_Constants USART Private Constants | |||
| * @{ | |||
| */ | |||
| /** @brief USART interruptions flag mask | |||
| * | |||
| */ | |||
| #define USART_IT_MASK ((uint32_t) USART_CR1_PEIE | USART_CR1_TXEIE | USART_CR1_TCIE | USART_CR1_RXNEIE | \ | |||
| USART_CR1_IDLEIE | USART_CR2_LBDIE | USART_CR3_CTSIE | USART_CR3_EIE ) | |||
| #define USART_CR1_REG_INDEX 1U | |||
| #define USART_CR2_REG_INDEX 2U | |||
| #define USART_CR3_REG_INDEX 3U | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup USART_Private_Macros USART Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_USART_NACK_STATE(NACK) (((NACK) == USART_NACK_ENABLE) || \ | |||
| ((NACK) == USART_NACK_DISABLE)) | |||
| #define IS_USART_LASTBIT(LASTBIT) (((LASTBIT) == USART_LASTBIT_DISABLE) || \ | |||
| ((LASTBIT) == USART_LASTBIT_ENABLE)) | |||
| #define IS_USART_PHASE(CPHA) (((CPHA) == USART_PHASE_1EDGE) || ((CPHA) == USART_PHASE_2EDGE)) | |||
| #define IS_USART_POLARITY(CPOL) (((CPOL) == USART_POLARITY_LOW) || ((CPOL) == USART_POLARITY_HIGH)) | |||
| #define IS_USART_CLOCK(CLOCK) (((CLOCK) == USART_CLOCK_DISABLE) || \ | |||
| ((CLOCK) == USART_CLOCK_ENABLE)) | |||
| #define IS_USART_WORD_LENGTH(LENGTH) (((LENGTH) == USART_WORDLENGTH_8B) || \ | |||
| ((LENGTH) == USART_WORDLENGTH_9B)) | |||
| #define IS_USART_STOPBITS(STOPBITS) (((STOPBITS) == USART_STOPBITS_1) || \ | |||
| ((STOPBITS) == USART_STOPBITS_0_5) || \ | |||
| ((STOPBITS) == USART_STOPBITS_1_5) || \ | |||
| ((STOPBITS) == USART_STOPBITS_2)) | |||
| #define IS_USART_PARITY(PARITY) (((PARITY) == USART_PARITY_NONE) || \ | |||
| ((PARITY) == USART_PARITY_EVEN) || \ | |||
| ((PARITY) == USART_PARITY_ODD)) | |||
| #define IS_USART_MODE(MODE) ((((MODE) & (uint32_t)0xFFF3) == 0x00U) && ((MODE) != (uint32_t)0x00U)) | |||
| #define IS_USART_BAUDRATE(BAUDRATE) ((BAUDRATE) < 10500001U) | |||
| #define USART_DIV(_PCLK_, _BAUD_) (((_PCLK_)*25U)/(2U*(_BAUD_))) | |||
| #define USART_DIVMANT(_PCLK_, _BAUD_) (USART_DIV((_PCLK_), (_BAUD_))/100U) | |||
| #define USART_DIVFRAQ(_PCLK_, _BAUD_) (((USART_DIV((_PCLK_), (_BAUD_)) - (USART_DIVMANT((_PCLK_), (_BAUD_)) * 100U)) * 16U + 50U) / 100U) | |||
| #define USART_BRR(_PCLK_, _BAUD_) ((USART_DIVMANT((_PCLK_), (_BAUD_)) << 4U)|(USART_DIVFRAQ((_PCLK_), (_BAUD_)) & 0x0FU)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup USART_Private_Functions USART Private Functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_USART_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,283 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_wwdg.h | |||
| * @author MCD Application Team | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of WWDG HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without modification, | |||
| * are permitted provided that the following conditions are met: | |||
| * 1. Redistributions of source code must retain the above copyright notice, | |||
| * this list of conditions and the following disclaimer. | |||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | |||
| * this list of conditions and the following disclaimer in the documentation | |||
| * and/or other materials provided with the distribution. | |||
| * 3. Neither the name of STMicroelectronics nor the names of its contributors | |||
| * may be used to endorse or promote products derived from this software | |||
| * without specific prior written permission. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |||
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
| * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |||
| * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32F4xx_HAL_WWDG_H | |||
| #define __STM32F4xx_HAL_WWDG_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| /** @addtogroup STM32F4xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup WWDG | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup WWDG_Exported_Types WWDG Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief WWDG Init structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t Prescaler; /*!< Specifies the prescaler value of the WWDG. | |||
| This parameter can be a value of @ref WWDG_Prescaler */ | |||
| uint32_t Window; /*!< Specifies the WWDG window value to be compared to the downcounter. | |||
| This parameter must be a number Min_Data = 0x40 and Max_Data = 0x7F */ | |||
| uint32_t Counter; /*!< Specifies the WWDG free-running downcounter value. | |||
| This parameter must be a number between Min_Data = 0x40 and Max_Data = 0x7F */ | |||
| uint32_t EWIMode ; /*!< Specifies if WWDG Early Wakeup Interupt is enable or not. | |||
| This parameter can be a value of @ref WWDG_EWI_Mode */ | |||
| }WWDG_InitTypeDef; | |||
| /** | |||
| * @brief WWDG handle Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| WWDG_TypeDef *Instance; /*!< Register base address */ | |||
| WWDG_InitTypeDef Init; /*!< WWDG required parameters */ | |||
| }WWDG_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup WWDG_Exported_Constants WWDG Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup WWDG_Interrupt_definition WWDG Interrupt definition | |||
| * @{ | |||
| */ | |||
| #define WWDG_IT_EWI WWDG_CFR_EWI /*!< Early wakeup interrupt */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup WWDG_Flag_definition WWDG Flag definition | |||
| * @brief WWDG Flag definition | |||
| * @{ | |||
| */ | |||
| #define WWDG_FLAG_EWIF WWDG_SR_EWIF /*!< Early wakeup interrupt flag */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup WWDG_Prescaler WWDG Prescaler | |||
| * @{ | |||
| */ | |||
| #define WWDG_PRESCALER_1 ((uint32_t)0x00000000U) /*!< WWDG counter clock = (PCLK1/4096)/1 */ | |||
| #define WWDG_PRESCALER_2 WWDG_CFR_WDGTB0 /*!< WWDG counter clock = (PCLK1/4096)/2 */ | |||
| #define WWDG_PRESCALER_4 WWDG_CFR_WDGTB1 /*!< WWDG counter clock = (PCLK1/4096)/4 */ | |||
| #define WWDG_PRESCALER_8 WWDG_CFR_WDGTB /*!< WWDG counter clock = (PCLK1/4096)/8 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup WWDG_EWI_Mode WWDG Early Wakeup Interrupt Mode | |||
| * @{ | |||
| */ | |||
| #define WWDG_EWI_DISABLE 0x00000000u /*!< EWI Disable */ | |||
| #define WWDG_EWI_ENABLE WWDG_CFR_EWI /*!< EWI Enable */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup WWDG_Private_Macros WWDG Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_WWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == WWDG_PRESCALER_1) || \ | |||
| ((__PRESCALER__) == WWDG_PRESCALER_2) || \ | |||
| ((__PRESCALER__) == WWDG_PRESCALER_4) || \ | |||
| ((__PRESCALER__) == WWDG_PRESCALER_8)) | |||
| #define IS_WWDG_WINDOW(__WINDOW__) (((__WINDOW__) >= WWDG_CFR_W_6) && ((__WINDOW__) <= WWDG_CFR_W)) | |||
| #define IS_WWDG_COUNTER(__COUNTER__) (((__COUNTER__) >= WWDG_CR_T_6) && ((__COUNTER__) <= WWDG_CR_T)) | |||
| #define IS_WWDG_EWI_MODE(__MODE__) (((__MODE__) == WWDG_EWI_ENABLE) || \ | |||
| ((__MODE__) == WWDG_EWI_DISABLE)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macros ------------------------------------------------------------*/ | |||
| /** @defgroup WWDG_Exported_Macros WWDG Exported Macros | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief Enables the WWDG peripheral. | |||
| * @param __HANDLE__: WWDG handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_WWDG_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, WWDG_CR_WDGA) | |||
| /** | |||
| * @brief Enables the WWDG early wakeup interrupt. | |||
| * @param __HANDLE__: WWDG handle | |||
| * @param __INTERRUPT__ specifies the interrupt to enable. | |||
| * This parameter can be one of the following values: | |||
| * @arg WWDG_IT_EWI: Early wakeup interrupt | |||
| * @note Once enabled this interrupt cannot be disabled except by a system reset. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_WWDG_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CFR, (__INTERRUPT__)) | |||
| /** | |||
| * @brief Checks whether the selected WWDG interrupt has occurred or not. | |||
| * @param __HANDLE__ WWDG handle | |||
| * @param __INTERRUPT__ specifies the it to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg WWDG_FLAG_EWIF: Early wakeup interrupt IT | |||
| * @retval The new state of WWDG_FLAG (SET or RESET). | |||
| */ | |||
| #define __HAL_WWDG_GET_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_GET_FLAG((__HANDLE__),(__INTERRUPT__)) | |||
| /** @brief Clear the WWDG's interrupt pending bits | |||
| * bits to clear the selected interrupt pending bits. | |||
| * @param __HANDLE__: WWDG handle | |||
| * @param __INTERRUPT__: specifies the interrupt pending bit to clear. | |||
| * This parameter can be one of the following values: | |||
| * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag | |||
| */ | |||
| #define __HAL_WWDG_CLEAR_IT(__HANDLE__, __INTERRUPT__) __HAL_WWDG_CLEAR_FLAG((__HANDLE__), (__INTERRUPT__)) | |||
| /** | |||
| * @brief Check whether the specified WWDG flag is set or not. | |||
| * @param __HANDLE__ WWDG handle | |||
| * @param __FLAG__ specifies the flag to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag | |||
| * @retval The new state of WWDG_FLAG (SET or RESET). | |||
| */ | |||
| #define __HAL_WWDG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) | |||
| /** | |||
| * @brief Clears the WWDG's pending flags. | |||
| * @param __HANDLE__: WWDG handle | |||
| * @param __FLAG__: specifies the flag to clear. | |||
| * This parameter can be one of the following values: | |||
| * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag | |||
| * @retval None | |||
| */ | |||
| #define __HAL_WWDG_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = ~(__FLAG__)) | |||
| /** @brief Checks if the specified WWDG interrupt source is enabled or disabled. | |||
| * @param __HANDLE__: WWDG Handle. | |||
| * @param __INTERRUPT__: specifies the WWDG interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg WWDG_IT_EWI: Early Wakeup Interrupt | |||
| * @retval state of __INTERRUPT__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_WWDG_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CFR & (__INTERRUPT__)) == (__INTERRUPT__)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup WWDG_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup WWDG_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| /* Initialization/de-initialization functions **********************************/ | |||
| HAL_StatusTypeDef HAL_WWDG_Init(WWDG_HandleTypeDef *hwwdg); | |||
| void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup WWDG_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| /* I/O operation functions ******************************************************/ | |||
| HAL_StatusTypeDef HAL_WWDG_Refresh(WWDG_HandleTypeDef *hwwdg); | |||
| void HAL_WWDG_IRQHandler(WWDG_HandleTypeDef *hwwdg); | |||
| void HAL_WWDG_EarlyWakeupCallback(WWDG_HandleTypeDef* hwwdg); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32F4xx_HAL_WWDG_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_ll_sdmmc.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of SDMMC HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -46,7 +46,7 @@ | |||
| defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \ | |||
| defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| @@ -909,7 +909,7 @@ HAL_StatusTypeDef SDIO_SetSDIOReadWaitMode(uint32_t SDIO_ReadWaitMode); | |||
| */ | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || | |||
| STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx || | |||
| STM32F412Rx || STM32F412Cx */ | |||
| STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_ll_usb.h | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief Header file of USB Core HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| @@ -46,7 +46,7 @@ | |||
| defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ | |||
| defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \ | |||
| defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \ | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32f4xx_hal_def.h" | |||
| @@ -466,7 +466,7 @@ HAL_StatusTypeDef USB_StopHost(USB_OTG_GlobalTypeDef *USBx); | |||
| */ | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || | |||
| STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Rx || | |||
| STM32F412Vx || STM32F412Cx */ | |||
| STM32F412Vx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal.c | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief HAL module driver. | |||
| * This is the common part of the HAL initialization | |||
| * | |||
| @@ -68,11 +68,11 @@ | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief STM32F4xx HAL Driver version number V1.5.2 | |||
| * @brief STM32F4xx HAL Driver version number V1.6.0 | |||
| */ | |||
| #define __STM32F4xx_HAL_VERSION_MAIN (0x01) /*!< [31:24] main version */ | |||
| #define __STM32F4xx_HAL_VERSION_SUB1 (0x05) /*!< [23:16] sub1 version */ | |||
| #define __STM32F4xx_HAL_VERSION_SUB2 (0x02) /*!< [15:8] sub2 version */ | |||
| #define __STM32F4xx_HAL_VERSION_SUB1 (0x06) /*!< [23:16] sub1 version */ | |||
| #define __STM32F4xx_HAL_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */ | |||
| #define __STM32F4xx_HAL_VERSION_RC (0x00) /*!< [7:0] release candidate */ | |||
| #define __STM32F4xx_HAL_VERSION ((__STM32F4xx_HAL_VERSION_MAIN << 24U)\ | |||
| |(__STM32F4xx_HAL_VERSION_SUB1 << 16U)\ | |||
| @@ -94,6 +94,12 @@ | |||
| #define CMPCR_OFFSET (SYSCFG_OFFSET + 0x20U) | |||
| #define CMP_PD_BIT_NUMBER POSITION_VAL(SYSCFG_CMPCR_CMP_PD) | |||
| #define CMPCR_CMP_PD_BB (uint32_t)(PERIPH_BB_BASE + (CMPCR_OFFSET * 32U) + (CMP_PD_BIT_NUMBER * 4U)) | |||
| /* --- MCHDLYCR Register ---*/ | |||
| /* Alias word address of BSCKSEL bit */ | |||
| #define MCHDLYCR_OFFSET (SYSCFG_OFFSET + 0x30U) | |||
| #define BSCKSEL_BIT_NUMBER POSITION_VAL(SYSCFG_MCHDLYCR_BSCKSEL) | |||
| #define MCHDLYCR_BSCKSEL_BB (uint32_t)(PERIPH_BB_BASE + (MCHDLYCR_OFFSET * 32U) + (BSCKSEL_BIT_NUMBER * 4U)) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -512,7 +518,6 @@ void HAL_DisableMemorySwappingBank(void) | |||
| *(__IO uint32_t *)UFB_MODE_BB = (uint32_t)DISABLE; | |||
| } | |||
| #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_adc.c | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief This file provides firmware functions to manage the following | |||
| * functionalities of the Analog to Digital Convertor (ADC) peripheral: | |||
| * + Initialization and de-initialization functions | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_adc_ex.c | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief This file provides firmware functions to manage the following | |||
| * functionalities of the ADC extension peripheral: | |||
| * + Extended features functions | |||
| @@ -2,8 +2,8 @@ | |||
| ****************************************************************************** | |||
| * @file stm32f4xx_hal_can.c | |||
| * @author MCD Application Team | |||
| * @version V1.5.2 | |||
| * @date 22-September-2016 | |||
| * @version V1.6.0 | |||
| * @date 04-November-2016 | |||
| * @brief This file provides firmware functions to manage the following | |||
| * functionalities of the Controller Area Network (CAN) peripheral: | |||
| * + Initialization and de-initialization functions | |||
| @@ -17,7 +17,8 @@ | |||
| ============================================================================== | |||
| [..] | |||
| (#) Enable the CAN controller interface clock using | |||
| __HAL_RCC_CAN1_CLK_ENABLE() for CAN1 and __HAL_RCC_CAN2_CLK_ENABLE() for CAN2 | |||
| __HAL_RCC_CAN1_CLK_ENABLE() for CAN1, __HAL_RCC_CAN2_CLK_ENABLE() for CAN2 | |||
| and __HAL_RCC_CAN3_CLK_ENABLE() for CAN3 | |||
| -@- In case you are using CAN2 only, you have to enable the CAN1 clock. | |||
| (#) CAN pins configuration | |||
| @@ -30,8 +31,12 @@ | |||
| (#) Transmit the desired CAN frame using HAL_CAN_Transmit() function. | |||
| (#) Or transmit the desired CAN frame using HAL_CAN_Transmit_IT() function. | |||
| (#) Receive a CAN frame using HAL_CAN_Receive() function. | |||
| (#) Or receive a CAN frame using HAL_CAN_Receive_IT() function. | |||
| *** Polling mode IO operation *** | |||
| ================================= | |||
| [..] | |||
| @@ -116,7 +121,8 @@ | |||
| #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ | |||
| defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ | |||
| defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\ | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) | |||
| defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) ||\ | |||
| defined(STM32F423xx) | |||
| /* Private typedef -----------------------------------------------------------*/ | |||
| /* Private define ------------------------------------------------------------*/ | |||
| @@ -168,7 +174,7 @@ static HAL_StatusTypeDef CAN_Transmit_IT(CAN_HandleTypeDef* hcan); | |||
| */ | |||
| HAL_StatusTypeDef HAL_CAN_Init(CAN_HandleTypeDef* hcan) | |||
| { | |||
| uint32_t InitStatus = 3U; | |||
| uint32_t InitStatus = CAN_INITSTATUS_FAILED; | |||
| uint32_t tickstart = 0U; | |||
| /* Check CAN handle */ | |||
| @@ -225,11 +231,7 @@ HAL_StatusTypeDef HAL_CAN_Init(CAN_HandleTypeDef* hcan) | |||
| } | |||
| /* Check acknowledge */ | |||
| if ((hcan->Instance->MSR & CAN_MSR_INAK) != CAN_MSR_INAK) | |||
| { | |||
| InitStatus = CAN_INITSTATUS_FAILED; | |||
| } | |||
| else | |||
| if ((hcan->Instance->MSR & CAN_MSR_INAK) == CAN_MSR_INAK) | |||
| { | |||
| /* Set the time triggered communication mode */ | |||
| if (hcan->Init.TTCM == ENABLE) | |||
| @@ -317,11 +319,7 @@ HAL_StatusTypeDef HAL_CAN_Init(CAN_HandleTypeDef* hcan) | |||
| } | |||
| /* Check acknowledged */ | |||
| if ((hcan->Instance->MSR & CAN_MSR_INAK) == CAN_MSR_INAK) | |||
| { | |||
| InitStatus = CAN_INITSTATUS_FAILED; | |||
| } | |||
| else | |||
| if ((hcan->Instance->MSR & CAN_MSR_INAK) != CAN_MSR_INAK) | |||
| { | |||
| InitStatus = CAN_INITSTATUS_SUCCESS; | |||
| } | |||
| @@ -360,6 +358,7 @@ HAL_StatusTypeDef HAL_CAN_Init(CAN_HandleTypeDef* hcan) | |||
| HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef* hcan, CAN_FilterConfTypeDef* sFilterConfig) | |||
| { | |||
| uint32_t filternbrbitpos = 0U; | |||
| CAN_TypeDef *can_ip; | |||
| /* Check the parameters */ | |||
| assert_param(IS_CAN_FILTER_NUMBER(sFilterConfig->FilterNumber)); | |||
| @@ -370,32 +369,47 @@ HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef* hcan, CAN_FilterConfTy | |||
| assert_param(IS_CAN_BANKNUMBER(sFilterConfig->BankNumber)); | |||
| filternbrbitpos = ((uint32_t)1U) << sFilterConfig->FilterNumber; | |||
| #if defined (CAN3) | |||
| /* Check the CAN instance */ | |||
| if(hcan->Instance == CAN3) | |||
| { | |||
| can_ip = CAN3; | |||
| } | |||
| else | |||
| { | |||
| can_ip = CAN1; | |||
| } | |||
| #else | |||
| can_ip = CAN1; | |||
| #endif | |||
| /* Initialisation mode for the filter */ | |||
| CAN1->FMR |= (uint32_t)CAN_FMR_FINIT; | |||
| can_ip->FMR |= (uint32_t)CAN_FMR_FINIT; | |||
| #if defined (CAN2) | |||
| /* Select the start slave bank */ | |||
| CAN1->FMR &= ~((uint32_t)CAN_FMR_CAN2SB); | |||
| CAN1->FMR |= (uint32_t)(sFilterConfig->BankNumber << 8U); | |||
| can_ip->FMR &= ~((uint32_t)CAN_FMR_CAN2SB); | |||
| can_ip->FMR |= (uint32_t)(sFilterConfig->BankNumber << 8U); | |||
| #endif | |||
| /* Filter Deactivation */ | |||
| CAN1->FA1R &= ~(uint32_t)filternbrbitpos; | |||
| can_ip->FA1R &= ~(uint32_t)filternbrbitpos; | |||
| /* Filter Scale */ | |||
| if (sFilterConfig->FilterScale == CAN_FILTERSCALE_16BIT) | |||
| { | |||
| /* 16-bit scale for the filter */ | |||
| CAN1->FS1R &= ~(uint32_t)filternbrbitpos; | |||
| can_ip->FS1R &= ~(uint32_t)filternbrbitpos; | |||
| /* First 16-bit identifier and First 16-bit mask */ | |||
| /* Or First 16-bit identifier and Second 16-bit identifier */ | |||
| CAN1->sFilterRegister[sFilterConfig->FilterNumber].FR1 = | |||
| can_ip->sFilterRegister[sFilterConfig->FilterNumber].FR1 = | |||
| ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdLow) << 16U) | | |||
| (0x0000FFFFU & (uint32_t)sFilterConfig->FilterIdLow); | |||
| /* Second 16-bit identifier and Second 16-bit mask */ | |||
| /* Or Third 16-bit identifier and Fourth 16-bit identifier */ | |||
| CAN1->sFilterRegister[sFilterConfig->FilterNumber].FR2 = | |||
| can_ip->sFilterRegister[sFilterConfig->FilterNumber].FR2 = | |||
| ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdHigh) << 16U) | | |||
| (0x0000FFFFU & (uint32_t)sFilterConfig->FilterIdHigh); | |||
| } | |||
| @@ -403,13 +417,14 @@ HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef* hcan, CAN_FilterConfTy | |||
| if (sFilterConfig->FilterScale == CAN_FILTERSCALE_32BIT) | |||
| { | |||
| /* 32-bit scale for the filter */ | |||
| CAN1->FS1R |= filternbrbitpos; | |||
| can_ip->FS1R |= filternbrbitpos; | |||
| /* 32-bit identifier or First 32-bit identifier */ | |||
| CAN1->sFilterRegister[sFilterConfig->FilterNumber].FR1 = | |||
| can_ip->sFilterRegister[sFilterConfig->FilterNumber].FR1 = | |||
| ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterIdHigh) << 16U) | | |||
| (0x0000FFFFU & (uint32_t)sFilterConfig->FilterIdLow); | |||
| /* 32-bit mask or Second 32-bit identifier */ | |||
| CAN1->sFilterRegister[sFilterConfig->FilterNumber].FR2 = | |||
| can_ip->sFilterRegister[sFilterConfig->FilterNumber].FR2 = | |||
| ((0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdHigh) << 16U) | | |||
| (0x0000FFFFU & (uint32_t)sFilterConfig->FilterMaskIdLow); | |||
| } | |||
| @@ -418,35 +433,35 @@ HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef* hcan, CAN_FilterConfTy | |||
| if (sFilterConfig->FilterMode == CAN_FILTERMODE_IDMASK) | |||
| { | |||
| /*Id/Mask mode for the filter*/ | |||
| CAN1->FM1R &= ~(uint32_t)filternbrbitpos; | |||
| can_ip->FM1R &= ~(uint32_t)filternbrbitpos; | |||
| } | |||
| else /* CAN_FilterInitStruct->CAN_FilterMode == CAN_FilterMode_IdList */ | |||
| { | |||
| /*Identifier list mode for the filter*/ | |||
| CAN1->FM1R |= (uint32_t)filternbrbitpos; | |||
| can_ip->FM1R |= (uint32_t)filternbrbitpos; | |||
| } | |||
| /* Filter FIFO assignment */ | |||
| if (sFilterConfig->FilterFIFOAssignment == CAN_FILTER_FIFO0) | |||
| { | |||
| /* FIFO 0 assignation for the filter */ | |||
| CAN1->FFA1R &= ~(uint32_t)filternbrbitpos; | |||
| can_ip->FFA1R &= ~(uint32_t)filternbrbitpos; | |||
| } | |||
| if (sFilterConfig->FilterFIFOAssignment == CAN_FILTER_FIFO1) | |||
| { | |||
| /* FIFO 1 assignation for the filter */ | |||
| CAN1->FFA1R |= (uint32_t)filternbrbitpos; | |||
| can_ip->FFA1R |= (uint32_t)filternbrbitpos; | |||
| } | |||
| /* Filter activation */ | |||
| if (sFilterConfig->FilterActivation == ENABLE) | |||
| { | |||
| CAN1->FA1R |= filternbrbitpos; | |||
| can_ip->FA1R |= filternbrbitpos; | |||
| } | |||
| /* Leave the initialisation mode for the filter */ | |||
| CAN1->FMR &= ~((uint32_t)CAN_FMR_FINIT); | |||
| can_ip->FMR &= ~((uint32_t)CAN_FMR_FINIT); | |||
| /* Return function status */ | |||
| return HAL_OK; | |||
| @@ -545,8 +560,8 @@ __weak void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan) | |||
| */ | |||
| HAL_StatusTypeDef HAL_CAN_Transmit(CAN_HandleTypeDef* hcan, uint32_t Timeout) | |||
| { | |||
| uint32_t transmitmailbox = 5U; | |||
| uint32_t tickstart = 0U; | |||
| uint32_t transmitmailbox = CAN_TXSTATUS_NOMAILBOX; | |||
| uint32_t tickstart = 0; | |||
| /* Check the parameters */ | |||
| assert_param(IS_CAN_IDTYPE(hcan->pTxMsg->IDE)); | |||
| @@ -574,15 +589,15 @@ HAL_StatusTypeDef HAL_CAN_Transmit(CAN_HandleTypeDef* hcan, uint32_t Timeout) | |||
| /* Select one empty transmit mailbox */ | |||
| if ((hcan->Instance->TSR&CAN_TSR_TME0) == CAN_TSR_TME0) | |||
| { | |||
| transmitmailbox = 0U; | |||
| transmitmailbox = CAN_TXMAILBOX_0; | |||
| } | |||
| else if ((hcan->Instance->TSR&CAN_TSR_TME1) == CAN_TSR_TME1) | |||
| { | |||
| transmitmailbox = 1U; | |||
| transmitmailbox = CAN_TXMAILBOX_1; | |||
| } | |||
| else | |||
| { | |||
| transmitmailbox = 2U; | |||
| transmitmailbox = CAN_TXMAILBOX_2; | |||
| } | |||
| /* Set up the Id */ | |||
| @@ -671,7 +686,7 @@ HAL_StatusTypeDef HAL_CAN_Transmit(CAN_HandleTypeDef* hcan, uint32_t Timeout) | |||
| */ | |||
| HAL_StatusTypeDef HAL_CAN_Transmit_IT(CAN_HandleTypeDef* hcan) | |||
| { | |||
| uint32_t transmitmailbox = 5U; | |||
| uint32_t transmitmailbox = CAN_TXSTATUS_NOMAILBOX; | |||
| /* Check the parameters */ | |||
| assert_param(IS_CAN_IDTYPE(hcan->pTxMsg->IDE)); | |||
| @@ -688,15 +703,15 @@ HAL_StatusTypeDef HAL_CAN_Transmit_IT(CAN_HandleTypeDef* hcan) | |||
| /* Select one empty transmit mailbox */ | |||
| if((hcan->Instance->TSR&CAN_TSR_TME0) == CAN_TSR_TME0) | |||
| { | |||
| transmitmailbox = 0U; | |||
| transmitmailbox = CAN_TXMAILBOX_0; | |||
| } | |||
| else if((hcan->Instance->TSR&CAN_TSR_TME1) == CAN_TSR_TME1) | |||
| { | |||
| transmitmailbox = 1U; | |||
| transmitmailbox = CAN_TXMAILBOX_1; | |||
| } | |||
| else | |||
| { | |||
| transmitmailbox = 2U; | |||
| transmitmailbox = CAN_TXMAILBOX_2; | |||
| } | |||
| /* Set up the Id */ | |||
| @@ -747,23 +762,14 @@ HAL_StatusTypeDef HAL_CAN_Transmit_IT(CAN_HandleTypeDef* hcan) | |||
| /* Process Unlocked */ | |||
| __HAL_UNLOCK(hcan); | |||
| /* Enable Error warning Interrupt */ | |||
| __HAL_CAN_ENABLE_IT(hcan, CAN_IT_EWG); | |||
| /* Enable Error passive Interrupt */ | |||
| __HAL_CAN_ENABLE_IT(hcan, CAN_IT_EPV); | |||
| /* Enable Bus-off Interrupt */ | |||
| __HAL_CAN_ENABLE_IT(hcan, CAN_IT_BOF); | |||
| /* Enable Last error code Interrupt */ | |||
| __HAL_CAN_ENABLE_IT(hcan, CAN_IT_LEC); | |||
| /* Enable Error Interrupt */ | |||
| __HAL_CAN_ENABLE_IT(hcan, CAN_IT_ERR); | |||
| /* Enable Transmit mailbox empty Interrupt */ | |||
| __HAL_CAN_ENABLE_IT(hcan, CAN_IT_TME); | |||
| /* Enable Error warning, Error passive, Bus-off, | |||
| Last error and Error Interrupts */ | |||
| __HAL_CAN_ENABLE_IT(hcan, CAN_IT_EWG | | |||
| CAN_IT_EPV | | |||
| CAN_IT_BOF | | |||
| CAN_IT_LEC | | |||
| CAN_IT_ERR | | |||
| CAN_IT_TME); | |||
| /* Request transmission */ | |||
| hcan->Instance->sTxMailBox[transmitmailbox].TIR |= CAN_TI0R_TXRQ; | |||
| @@ -872,19 +878,16 @@ HAL_StatusTypeDef HAL_CAN_Receive(CAN_HandleTypeDef* hcan, uint8_t FIFONumber, u | |||
| { | |||
| /* Change CAN state */ | |||
| hcan->State = HAL_CAN_STATE_BUSY_TX; | |||
| /* Process unlocked */ | |||
| __HAL_UNLOCK(hcan); | |||
| } | |||
| else | |||
| { | |||
| /* Change CAN state */ | |||
| hcan->State = HAL_CAN_STATE_READY; | |||
| /* Process unlocked */ | |||
| __HAL_UNLOCK(hcan); | |||
| } | |||
| /* Process unlocked */ | |||
| __HAL_UNLOCK(hcan); | |||
| /* Return function status */ | |||
| return HAL_OK; | |||
| } | |||
| @@ -923,20 +926,13 @@ HAL_StatusTypeDef HAL_CAN_Receive_IT(CAN_HandleTypeDef* hcan, uint8_t FIFONumber | |||
| /* Set CAN error code to none */ | |||
| hcan->ErrorCode = HAL_CAN_ERROR_NONE; | |||
| /* Enable Error warning Interrupt */ | |||
| __HAL_CAN_ENABLE_IT(hcan, CAN_IT_EWG); | |||
| /* Enable Error passive Interrupt */ | |||
| __HAL_CAN_ENABLE_IT(hcan, CAN_IT_EPV); | |||
| /* Enable Bus-off Interrupt */ | |||
| __HAL_CAN_ENABLE_IT(hcan, CAN_IT_BOF); | |||
| /* Enable Last error code Interrupt */ | |||
| __HAL_CAN_ENABLE_IT(hcan, CAN_IT_LEC); | |||
| /* Enable Error Interrupt */ | |||
| __HAL_CAN_ENABLE_IT(hcan, CAN_IT_ERR); | |||
| /* Enable Error warning, Error passive, Bus-off, | |||
| Last error and Error Interrupts */ | |||
| __HAL_CAN_ENABLE_IT(hcan, CAN_IT_EWG | | |||
| CAN_IT_EPV | | |||
| CAN_IT_BOF | | |||
| CAN_IT_LEC | | |||
| CAN_IT_ERR); | |||
| /* Process unlocked */ | |||
| __HAL_UNLOCK(hcan); | |||
| @@ -1297,20 +1293,13 @@ static HAL_StatusTypeDef CAN_Transmit_IT(CAN_HandleTypeDef* hcan) | |||
| if(hcan->State == HAL_CAN_STATE_BUSY_TX) | |||
| { | |||
| /* Disable Error warning Interrupt */ | |||
| __HAL_CAN_DISABLE_IT(hcan, CAN_IT_EWG); | |||
| /* Disable Error passive Interrupt */ | |||
| __HAL_CAN_DISABLE_IT(hcan, CAN_IT_EPV); | |||
| /* Disable Bus-off Interrupt */ | |||
| __HAL_CAN_DISABLE_IT(hcan, CAN_IT_BOF); | |||
| /* Disable Last error code Interrupt */ | |||
| __HAL_CAN_DISABLE_IT(hcan, CAN_IT_LEC); | |||
| /* Disable Error Interrupt */ | |||
| __HAL_CAN_DISABLE_IT(hcan, CAN_IT_ERR); | |||
| /* Disable Error warning, Error passive, Bus-off, Last error code | |||
| and Error Interrupts */ | |||
| __HAL_CAN_DISABLE_IT(hcan, CAN_IT_EWG | | |||
| CAN_IT_EPV | | |||
| CAN_IT_BOF | | |||
| CAN_IT_LEC | | |||
| CAN_IT_ERR ); | |||
| } | |||
| if(hcan->State == HAL_CAN_STATE_BUSY_TX_RX) | |||
| @@ -1387,20 +1376,13 @@ static HAL_StatusTypeDef CAN_Receive_IT(CAN_HandleTypeDef* hcan, uint8_t FIFONum | |||
| if(hcan->State == HAL_CAN_STATE_BUSY_RX) | |||
| { | |||
| /* Disable Error warning Interrupt */ | |||
| __HAL_CAN_DISABLE_IT(hcan, CAN_IT_EWG); | |||
| /* Disable Error passive Interrupt */ | |||
| __HAL_CAN_DISABLE_IT(hcan, CAN_IT_EPV); | |||
| /* Disable Bus-off Interrupt */ | |||
| __HAL_CAN_DISABLE_IT(hcan, CAN_IT_BOF); | |||
| /* Disable Last error code Interrupt */ | |||
| __HAL_CAN_DISABLE_IT(hcan, CAN_IT_LEC); | |||
| /* Disable Error Interrupt */ | |||
| __HAL_CAN_DISABLE_IT(hcan, CAN_IT_ERR); | |||
| /* Disable Error warning, Error passive, Bus-off, Last error code | |||
| and Error Interrupts */ | |||
| __HAL_CAN_DISABLE_IT(hcan, CAN_IT_EWG | | |||
| CAN_IT_EPV | | |||
| CAN_IT_BOF | | |||
| CAN_IT_LEC | | |||
| CAN_IT_ERR); | |||
| } | |||
| if(hcan->State == HAL_CAN_STATE_BUSY_TX_RX) | |||
| @@ -1426,7 +1408,7 @@ static HAL_StatusTypeDef CAN_Receive_IT(CAN_HandleTypeDef* hcan, uint8_t FIFONum | |||
| */ | |||
| #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\ | |||
| STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\ | |||
| STM32F412Vx || STM32F412Rx || STM32F412Cx */ | |||
| STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ | |||
| #endif /* HAL_CAN_MODULE_ENABLED */ | |||
| /** | |||