| @@ -2,8 +2,6 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief CMSIS STM32H7xx Device Peripheral Access Layer Header File. | |||
| * | |||
| * The file is the unique include file that the application programmer | |||
| @@ -18,29 +16,13 @@ | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| @@ -76,14 +58,26 @@ | |||
| application | |||
| */ | |||
| #if !defined (STM32H743xx) && !defined (STM32H753xx) | |||
| /* #define STM32H743xx */ /*!< STM32H743VI, STM32H743ZI, STM32H743II, STM32H743BI, STM32H743XI Devices */ | |||
| /* #define STM32H753xx */ /*!< STM32H753VI, STM32H753ZI, STM32H753II, STM32H753BI, STM32H753XI Devices */ | |||
| #if !defined (STM32H743xx) && !defined (STM32H753xx) && !defined (STM32H750xx) && !defined (STM32H742xx) && \ | |||
| !defined (STM32H745xx) && !defined (STM32H755xx) && !defined (STM32H747xx) && !defined (STM32H757xx) | |||
| /* #define STM32H742xx */ /*!< STM32H742VI, STM32H742ZI, STM32H742AI, STM32H742II, STM32H742BI, STM32H742XI Devices */ | |||
| /* #define STM32H743xx */ /*!< STM32H743VI, STM32H743ZI, STM32H743AI, STM32H743II, STM32H743BI, STM32H743XI Devices */ | |||
| /* #define STM32H753xx */ /*!< STM32H753VI, STM32H753ZI, STM32H753AI, STM32H753II, STM32H753BI, STM32H753XI Devices */ | |||
| /* #define STM32H750xx */ /*!< STM32H750V, STM32H750I, STM32H750X Devices */ | |||
| /* #define STM32H747xx */ /*!< STM32H747ZI, STM32H747AI, STM32H747II, STM32H747BI, STM32H747XI Devices */ | |||
| /* #define STM32H757xx */ /*!< STM32H757ZI, STM32H757AI, STM32H757II, STM32H757BI, STM32H757XI Devices */ | |||
| /* #define STM32H745xx */ /*!< STM32H745ZI, STM32H745II, STM32H745BI, STM32H745XI Devices */ | |||
| /* #define STM32H755xx */ /*!< STM32H755ZI, STM32H755II, STM32H755BI, STM32H755XI Devices */ | |||
| #endif | |||
| /* Tip: To avoid modifying this file each time you need to switch between these | |||
| devices, you can define the device in your toolchain compiler preprocessor. | |||
| */ | |||
| #if defined(DUAL_CORE) && !defined(CORE_CM4) && !defined(CORE_CM7) | |||
| #error "Dual core device, please select CORE_CM4 or CORE_CM7" | |||
| #endif | |||
| #if !defined (USE_HAL_DRIVER) | |||
| /** | |||
| * @brief Comment the line below if you will not use the peripherals drivers. | |||
| @@ -94,10 +88,10 @@ | |||
| #endif /* USE_HAL_DRIVER */ | |||
| /** | |||
| * @brief CMSIS Device version number V1.2.0 | |||
| * @brief CMSIS Device version number V1.5.0 | |||
| */ | |||
| #define __STM32H7xx_CMSIS_DEVICE_VERSION_MAIN (0x01) /*!< [31:24] main version */ | |||
| #define __STM32H7xx_CMSIS_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */ | |||
| #define __STM32H7xx_CMSIS_DEVICE_VERSION_SUB1 (0x05) /*!< [23:16] sub1 version */ | |||
| #define __STM32H7xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */ | |||
| #define __STM32H7xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */ | |||
| #define __STM32H7xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\ | |||
| @@ -117,6 +111,18 @@ | |||
| #include "stm32h743xx.h" | |||
| #elif defined(STM32H753xx) | |||
| #include "stm32h753xx.h" | |||
| #elif defined(STM32H750xx) | |||
| #include "stm32h750xx.h" | |||
| #elif defined(STM32H742xx) | |||
| #include "stm32h742xx.h" | |||
| #elif defined(STM32H745xx) | |||
| #include "stm32h745xx.h" | |||
| #elif defined(STM32H755xx) | |||
| #include "stm32h755xx.h" | |||
| #elif defined(STM32H747xx) | |||
| #include "stm32h747xx.h" | |||
| #elif defined(STM32H757xx) | |||
| #include "stm32h757xx.h" | |||
| #else | |||
| #error "Please select first the target STM32H7xx device used in your application (in stm32h7xx.h file)" | |||
| #endif | |||
| @@ -2,35 +2,17 @@ | |||
| ****************************************************************************** | |||
| * @file system_stm32h7xx.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief CMSIS Cortex-Mx Device System Source File for STM32H7xx devices. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| @@ -2,43 +2,25 @@ | |||
| ****************************************************************************** | |||
| * @file stm32_hal_legacy.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief This file contains aliases definition for the STM32Cube HAL constants | |||
| * macros and functions maintained for legacy purpose. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2018 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32_HAL_LEGACY | |||
| #define __STM32_HAL_LEGACY | |||
| #ifndef STM32_HAL_LEGACY | |||
| #define STM32_HAL_LEGACY | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -112,6 +94,10 @@ | |||
| #define HAL_ADC_STATE_ERROR HAL_ADC_STATE_ERROR_INTERNAL | |||
| #define HAL_ADC_STATE_BUSY HAL_ADC_STATE_BUSY_INTERNAL | |||
| #define HAL_ADC_STATE_AWD HAL_ADC_STATE_AWD1 | |||
| #if defined(STM32H7) | |||
| #define ADC_CHANNEL_VBAT_DIV4 ADC_CHANNEL_VBAT | |||
| #endif /* STM32H7 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -138,7 +124,9 @@ | |||
| #define COMP_EXTI_LINE_COMP5_EVENT COMP_EXTI_LINE_COMP5 | |||
| #define COMP_EXTI_LINE_COMP6_EVENT COMP_EXTI_LINE_COMP6 | |||
| #define COMP_EXTI_LINE_COMP7_EVENT COMP_EXTI_LINE_COMP7 | |||
| #define COMP_LPTIMCONNECTION_ENABLED COMP_LPTIMCONNECTION_IN1_ENABLED /*!< COMPX output is connected to LPTIM input 1 */ | |||
| #if defined(STM32L0) | |||
| #define COMP_LPTIMCONNECTION_ENABLED ((uint32_t)0x00000003U) /*!< COMPX output generic naming: connected to LPTIM input 1 for COMP1, LPTIM input 2 for COMP2 */ | |||
| #endif | |||
| #define COMP_OUTPUT_COMP6TIM2OCREFCLR COMP_OUTPUT_COMP6_TIM2OCREFCLR | |||
| #if defined(STM32F373xC) || defined(STM32F378xx) | |||
| #define COMP_OUTPUT_TIM3IC1 COMP_OUTPUT_COMP1_TIM3IC1 | |||
| @@ -248,6 +236,11 @@ | |||
| #define DAC_WAVEGENERATION_NOISE DAC_WAVE_NOISE | |||
| #define DAC_WAVEGENERATION_TRIANGLE DAC_WAVE_TRIANGLE | |||
| #if defined(STM32L1) || defined(STM32L4) || defined(STM32G0) | |||
| #define HAL_DAC_MSP_INIT_CB_ID HAL_DAC_MSPINIT_CB_ID | |||
| #define HAL_DAC_MSP_DEINIT_CB_ID HAL_DAC_MSPDEINIT_CB_ID | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -265,7 +258,6 @@ | |||
| #define HAL_REMAPDMA_TIM17_DMA_CH7 DMA_REMAP_TIM17_DMA_CH7 | |||
| #define HAL_REMAPDMA_SPI2_DMA_CH67 DMA_REMAP_SPI2_DMA_CH67 | |||
| #define HAL_REMAPDMA_USART2_DMA_CH67 DMA_REMAP_USART2_DMA_CH67 | |||
| #define HAL_REMAPDMA_USART3_DMA_CH32 DMA_REMAP_USART3_DMA_CH32 | |||
| #define HAL_REMAPDMA_I2C1_DMA_CH76 DMA_REMAP_I2C1_DMA_CH76 | |||
| #define HAL_REMAPDMA_TIM1_DMA_CH6 DMA_REMAP_TIM1_DMA_CH6 | |||
| #define HAL_REMAPDMA_TIM2_DMA_CH7 DMA_REMAP_TIM2_DMA_CH7 | |||
| @@ -275,7 +267,100 @@ | |||
| #define __HAL_REMAPDMA_CHANNEL_ENABLE __HAL_DMA_REMAP_CHANNEL_ENABLE | |||
| #define __HAL_REMAPDMA_CHANNEL_DISABLE __HAL_DMA_REMAP_CHANNEL_DISABLE | |||
| #if defined(STM32L4) | |||
| #define HAL_DMAMUX1_REQUEST_GEN_EXTI0 HAL_DMAMUX1_REQ_GEN_EXTI0 | |||
| #define HAL_DMAMUX1_REQUEST_GEN_EXTI1 HAL_DMAMUX1_REQ_GEN_EXTI1 | |||
| #define HAL_DMAMUX1_REQUEST_GEN_EXTI2 HAL_DMAMUX1_REQ_GEN_EXTI2 | |||
| #define HAL_DMAMUX1_REQUEST_GEN_EXTI3 HAL_DMAMUX1_REQ_GEN_EXTI3 | |||
| #define HAL_DMAMUX1_REQUEST_GEN_EXTI4 HAL_DMAMUX1_REQ_GEN_EXTI4 | |||
| #define HAL_DMAMUX1_REQUEST_GEN_EXTI5 HAL_DMAMUX1_REQ_GEN_EXTI5 | |||
| #define HAL_DMAMUX1_REQUEST_GEN_EXTI6 HAL_DMAMUX1_REQ_GEN_EXTI6 | |||
| #define HAL_DMAMUX1_REQUEST_GEN_EXTI7 HAL_DMAMUX1_REQ_GEN_EXTI7 | |||
| #define HAL_DMAMUX1_REQUEST_GEN_EXTI8 HAL_DMAMUX1_REQ_GEN_EXTI8 | |||
| #define HAL_DMAMUX1_REQUEST_GEN_EXTI9 HAL_DMAMUX1_REQ_GEN_EXTI9 | |||
| #define HAL_DMAMUX1_REQUEST_GEN_EXTI10 HAL_DMAMUX1_REQ_GEN_EXTI10 | |||
| #define HAL_DMAMUX1_REQUEST_GEN_EXTI11 HAL_DMAMUX1_REQ_GEN_EXTI11 | |||
| #define HAL_DMAMUX1_REQUEST_GEN_EXTI12 HAL_DMAMUX1_REQ_GEN_EXTI12 | |||
| #define HAL_DMAMUX1_REQUEST_GEN_EXTI13 HAL_DMAMUX1_REQ_GEN_EXTI13 | |||
| #define HAL_DMAMUX1_REQUEST_GEN_EXTI14 HAL_DMAMUX1_REQ_GEN_EXTI14 | |||
| #define HAL_DMAMUX1_REQUEST_GEN_EXTI15 HAL_DMAMUX1_REQ_GEN_EXTI15 | |||
| #define HAL_DMAMUX1_REQUEST_GEN_DMAMUX1_CH0_EVT HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH0_EVT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_DMAMUX1_CH1_EVT HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH1_EVT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_DMAMUX1_CH2_EVT HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH2_EVT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_DMAMUX1_CH3_EVT HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH3_EVT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_LPTIM1_OUT HAL_DMAMUX1_REQ_GEN_LPTIM1_OUT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_LPTIM2_OUT HAL_DMAMUX1_REQ_GEN_LPTIM2_OUT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_DSI_TE HAL_DMAMUX1_REQ_GEN_DSI_TE | |||
| #define HAL_DMAMUX1_REQUEST_GEN_DSI_EOT HAL_DMAMUX1_REQ_GEN_DSI_EOT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_DMA2D_EOT HAL_DMAMUX1_REQ_GEN_DMA2D_EOT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_LTDC_IT HAL_DMAMUX1_REQ_GEN_LTDC_IT | |||
| #define HAL_DMAMUX_REQUEST_GEN_NO_EVENT HAL_DMAMUX_REQ_GEN_NO_EVENT | |||
| #define HAL_DMAMUX_REQUEST_GEN_RISING HAL_DMAMUX_REQ_GEN_RISING | |||
| #define HAL_DMAMUX_REQUEST_GEN_FALLING HAL_DMAMUX_REQ_GEN_FALLING | |||
| #define HAL_DMAMUX_REQUEST_GEN_RISING_FALLING HAL_DMAMUX_REQ_GEN_RISING_FALLING | |||
| #endif /* STM32L4 */ | |||
| #if defined(STM32H7) | |||
| #define DMA_REQUEST_DAC1 DMA_REQUEST_DAC1_CH1 | |||
| #define DMA_REQUEST_DAC2 DMA_REQUEST_DAC1_CH2 | |||
| #define BDMA_REQUEST_LP_UART1_RX BDMA_REQUEST_LPUART1_RX | |||
| #define BDMA_REQUEST_LP_UART1_TX BDMA_REQUEST_LPUART1_TX | |||
| #define HAL_DMAMUX1_REQUEST_GEN_DMAMUX1_CH0_EVT HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH0_EVT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_DMAMUX1_CH1_EVT HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH1_EVT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_DMAMUX1_CH2_EVT HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH2_EVT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_LPTIM1_OUT HAL_DMAMUX1_REQ_GEN_LPTIM1_OUT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_LPTIM2_OUT HAL_DMAMUX1_REQ_GEN_LPTIM2_OUT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_LPTIM3_OUT HAL_DMAMUX1_REQ_GEN_LPTIM3_OUT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_EXTI0 HAL_DMAMUX1_REQ_GEN_EXTI0 | |||
| #define HAL_DMAMUX1_REQUEST_GEN_TIM12_TRGO HAL_DMAMUX1_REQ_GEN_TIM12_TRGO | |||
| #define HAL_DMAMUX2_REQUEST_GEN_DMAMUX2_CH0_EVT HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH0_EVT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_DMAMUX2_CH1_EVT HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH1_EVT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_DMAMUX2_CH2_EVT HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH2_EVT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_DMAMUX2_CH3_EVT HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH3_EVT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_DMAMUX2_CH4_EVT HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH4_EVT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_DMAMUX2_CH5_EVT HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH5_EVT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_DMAMUX2_CH6_EVT HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH6_EVT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPUART1_RX_WKUP HAL_DMAMUX2_REQ_GEN_LPUART1_RX_WKUP | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPUART1_TX_WKUP HAL_DMAMUX2_REQ_GEN_LPUART1_TX_WKUP | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPTIM2_WKUP HAL_DMAMUX2_REQ_GEN_LPTIM2_WKUP | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPTIM2_OUT HAL_DMAMUX2_REQ_GEN_LPTIM2_OUT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPTIM3_WKUP HAL_DMAMUX2_REQ_GEN_LPTIM3_WKUP | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPTIM3_OUT HAL_DMAMUX2_REQ_GEN_LPTIM3_OUT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPTIM4_WKUP HAL_DMAMUX2_REQ_GEN_LPTIM4_WKUP | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPTIM5_WKUP HAL_DMAMUX2_REQ_GEN_LPTIM5_WKUP | |||
| #define HAL_DMAMUX2_REQUEST_GEN_I2C4_WKUP HAL_DMAMUX2_REQ_GEN_I2C4_WKUP | |||
| #define HAL_DMAMUX2_REQUEST_GEN_SPI6_WKUP HAL_DMAMUX2_REQ_GEN_SPI6_WKUP | |||
| #define HAL_DMAMUX2_REQUEST_GEN_COMP1_OUT HAL_DMAMUX2_REQ_GEN_COMP1_OUT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_COMP2_OUT HAL_DMAMUX2_REQ_GEN_COMP2_OUT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_RTC_WKUP HAL_DMAMUX2_REQ_GEN_RTC_WKUP | |||
| #define HAL_DMAMUX2_REQUEST_GEN_EXTI0 HAL_DMAMUX2_REQ_GEN_EXTI0 | |||
| #define HAL_DMAMUX2_REQUEST_GEN_EXTI2 HAL_DMAMUX2_REQ_GEN_EXTI2 | |||
| #define HAL_DMAMUX2_REQUEST_GEN_I2C4_IT_EVT HAL_DMAMUX2_REQ_GEN_I2C4_IT_EVT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_SPI6_IT HAL_DMAMUX2_REQ_GEN_SPI6_IT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPUART1_TX_IT HAL_DMAMUX2_REQ_GEN_LPUART1_TX_IT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPUART1_RX_IT HAL_DMAMUX2_REQ_GEN_LPUART1_RX_IT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_ADC3_IT HAL_DMAMUX2_REQ_GEN_ADC3_IT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_ADC3_AWD1_OUT HAL_DMAMUX2_REQ_GEN_ADC3_AWD1_OUT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_BDMA_CH0_IT HAL_DMAMUX2_REQ_GEN_BDMA_CH0_IT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_BDMA_CH1_IT HAL_DMAMUX2_REQ_GEN_BDMA_CH1_IT | |||
| #define HAL_DMAMUX_REQUEST_GEN_NO_EVENT HAL_DMAMUX_REQ_GEN_NO_EVENT | |||
| #define HAL_DMAMUX_REQUEST_GEN_RISING HAL_DMAMUX_REQ_GEN_RISING | |||
| #define HAL_DMAMUX_REQUEST_GEN_FALLING HAL_DMAMUX_REQ_GEN_FALLING | |||
| #define HAL_DMAMUX_REQUEST_GEN_RISING_FALLING HAL_DMAMUX_REQ_GEN_RISING_FALLING | |||
| #define DFSDM_FILTER_EXT_TRIG_LPTIM1 DFSDM_FILTER_EXT_TRIG_LPTIM1_OUT | |||
| #define DFSDM_FILTER_EXT_TRIG_LPTIM2 DFSDM_FILTER_EXT_TRIG_LPTIM2_OUT | |||
| #define DFSDM_FILTER_EXT_TRIG_LPTIM3 DFSDM_FILTER_EXT_TRIG_LPTIM3_OUT | |||
| #endif /* STM32H7 */ | |||
| /** | |||
| * @} | |||
| @@ -356,6 +441,38 @@ | |||
| #define OB_RDP_LEVEL0 OB_RDP_LEVEL_0 | |||
| #define OB_RDP_LEVEL1 OB_RDP_LEVEL_1 | |||
| #define OB_RDP_LEVEL2 OB_RDP_LEVEL_2 | |||
| #if defined(STM32G0) | |||
| #define OB_BOOT_LOCK_DISABLE OB_BOOT_ENTRY_FORCED_NONE | |||
| #define OB_BOOT_LOCK_ENABLE OB_BOOT_ENTRY_FORCED_FLASH | |||
| #else | |||
| #define OB_BOOT_ENTRY_FORCED_NONE OB_BOOT_LOCK_DISABLE | |||
| #define OB_BOOT_ENTRY_FORCED_FLASH OB_BOOT_LOCK_ENABLE | |||
| #endif | |||
| #if defined(STM32H7) | |||
| #define FLASH_FLAG_SNECCE_BANK1RR FLASH_FLAG_SNECCERR_BANK1 | |||
| #define FLASH_FLAG_DBECCE_BANK1RR FLASH_FLAG_DBECCERR_BANK1 | |||
| #define FLASH_FLAG_STRBER_BANK1R FLASH_FLAG_STRBERR_BANK1 | |||
| #define FLASH_FLAG_SNECCE_BANK2RR FLASH_FLAG_SNECCERR_BANK2 | |||
| #define FLASH_FLAG_DBECCE_BANK2RR FLASH_FLAG_DBECCERR_BANK2 | |||
| #define FLASH_FLAG_STRBER_BANK2R FLASH_FLAG_STRBERR_BANK2 | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_JPEG_Aliased_Macros HAL JPEG Aliased Macros maintained for legacy purpose | |||
| * @{ | |||
| */ | |||
| #if defined(STM32H7) | |||
| #define __HAL_RCC_JPEG_CLK_ENABLE __HAL_RCC_JPGDECEN_CLK_ENABLE | |||
| #define __HAL_RCC_JPEG_CLK_DISABLE __HAL_RCC_JPGDECEN_CLK_DISABLE | |||
| #define __HAL_RCC_JPEG_FORCE_RESET __HAL_RCC_JPGDECRST_FORCE_RESET | |||
| #define __HAL_RCC_JPEG_RELEASE_RESET __HAL_RCC_JPGDECRST_RELEASE_RESET | |||
| #define __HAL_RCC_JPEG_CLK_SLEEP_ENABLE __HAL_RCC_JPGDEC_CLK_SLEEP_ENABLE | |||
| #define __HAL_RCC_JPEG_CLK_SLEEP_DISABLE __HAL_RCC_JPGDEC_CLK_SLEEP_DISABLE | |||
| #endif /* STM32H7 */ | |||
| /** | |||
| * @} | |||
| @@ -374,6 +491,7 @@ | |||
| #define HAL_SYSCFG_FASTMODEPLUS_I2C1 I2C_FASTMODEPLUS_I2C1 | |||
| #define HAL_SYSCFG_FASTMODEPLUS_I2C2 I2C_FASTMODEPLUS_I2C2 | |||
| #define HAL_SYSCFG_FASTMODEPLUS_I2C3 I2C_FASTMODEPLUS_I2C3 | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -387,7 +505,7 @@ | |||
| #define FMC_NAND_PCC_WAIT_FEATURE_ENABLE FMC_NAND_WAIT_FEATURE_ENABLE | |||
| #define FMC_NAND_PCC_MEM_BUS_WIDTH_8 FMC_NAND_MEM_BUS_WIDTH_8 | |||
| #define FMC_NAND_PCC_MEM_BUS_WIDTH_16 FMC_NAND_MEM_BUS_WIDTH_16 | |||
| #else | |||
| #elif defined(STM32F1) || defined(STM32F2) || defined(STM32F3) || defined(STM32F4) | |||
| #define FMC_NAND_WAIT_FEATURE_DISABLE FMC_NAND_PCC_WAIT_FEATURE_DISABLE | |||
| #define FMC_NAND_WAIT_FEATURE_ENABLE FMC_NAND_PCC_WAIT_FEATURE_ENABLE | |||
| #define FMC_NAND_MEM_BUS_WIDTH_8 FMC_NAND_PCC_MEM_BUS_WIDTH_8 | |||
| @@ -428,16 +546,25 @@ | |||
| #define GPIO_AF12_SDMMC GPIO_AF12_SDMMC1 | |||
| #endif | |||
| #if defined(STM32H7) | |||
| #define GPIO_AF7_SDIO1 GPIO_AF7_SDMMC1 | |||
| #define GPIO_AF8_SDIO1 GPIO_AF8_SDMMC1 | |||
| #define GPIO_AF12_SDIO1 GPIO_AF12_SDMMC1 | |||
| #define GPIO_AF9_SDIO2 GPIO_AF9_SDMMC2 | |||
| #define GPIO_AF10_SDIO2 GPIO_AF10_SDMMC2 | |||
| #define GPIO_AF11_SDIO2 GPIO_AF11_SDMMC2 | |||
| #endif | |||
| #define GPIO_AF0_LPTIM GPIO_AF0_LPTIM1 | |||
| #define GPIO_AF1_LPTIM GPIO_AF1_LPTIM1 | |||
| #define GPIO_AF2_LPTIM GPIO_AF2_LPTIM1 | |||
| #if defined(STM32L0) || defined(STM32L4) || defined(STM32F4) || defined(STM32F2) || defined(STM32F7) | |||
| #if defined(STM32L0) || defined(STM32L4) || defined(STM32F4) || defined(STM32F2) || defined(STM32F7) || defined(STM32H7) | |||
| #define GPIO_SPEED_LOW GPIO_SPEED_FREQ_LOW | |||
| #define GPIO_SPEED_MEDIUM GPIO_SPEED_FREQ_MEDIUM | |||
| #define GPIO_SPEED_FAST GPIO_SPEED_FREQ_HIGH | |||
| #define GPIO_SPEED_HIGH GPIO_SPEED_FREQ_VERY_HIGH | |||
| #endif /* STM32L0 || STM32L4 || STM32F4 || STM32F2 || STM32F7 */ | |||
| #endif /* STM32L0 || STM32L4 || STM32F4 || STM32F2 || STM32F7 || STM32H7*/ | |||
| #if defined(STM32L1) | |||
| #define GPIO_SPEED_VERY_LOW GPIO_SPEED_FREQ_LOW | |||
| @@ -457,77 +584,6 @@ | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_JPEG_Aliased_Macros HAL JPEG Aliased Macros maintained for legacy purpose | |||
| * @{ | |||
| */ | |||
| #if defined(STM32H7) | |||
| #define __HAL_RCC_JPEG_CLK_ENABLE __HAL_RCC_JPGDECEN_CLK_ENABLE | |||
| #define __HAL_RCC_JPEG_CLK_DISABLE __HAL_RCC_JPGDECEN_CLK_DISABLE | |||
| #define __HAL_RCC_JPEG_FORCE_RESET __HAL_RCC_JPGDECRST_FORCE_RESET | |||
| #define __HAL_RCC_JPEG_RELEASE_RESET __HAL_RCC_JPGDECRST_RELEASE_RESET | |||
| #define __HAL_RCC_JPEG_CLK_SLEEP_ENABLE __HAL_RCC_JPGDEC_CLK_SLEEP_ENABLE | |||
| #define __HAL_RCC_JPEG_CLK_SLEEP_DISABLE __HAL_RCC_JPGDEC_CLK_SLEEP_DISABLE | |||
| #define DMA_REQUEST_DAC1 DMA_REQUEST_DAC1_CH1 | |||
| #define DMA_REQUEST_DAC2 DMA_REQUEST_DAC1_CH2 | |||
| #define BDMA_REQUEST_LP_UART1_RX BDMA_REQUEST_LPUART1_RX | |||
| #define BDMA_REQUEST_LP_UART1_TX BDMA_REQUEST_LPUART1_TX | |||
| #define HAL_DMAMUX1_REQUEST_GEN_DMAMUX1_CH0_EVT HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH0_EVT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_DMAMUX1_CH1_EVT HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH1_EVT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_DMAMUX1_CH2_EVT HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH2_EVT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_LPTIM1_OUT HAL_DMAMUX1_REQ_GEN_LPTIM1_OUT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_LPTIM2_OUT HAL_DMAMUX1_REQ_GEN_LPTIM2_OUT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_LPTIM3_OUT HAL_DMAMUX1_REQ_GEN_LPTIM3_OUT | |||
| #define HAL_DMAMUX1_REQUEST_GEN_EXTI0 HAL_DMAMUX1_REQ_GEN_EXTI0 | |||
| #define HAL_DMAMUX1_REQUEST_GEN_TIM12_TRGO HAL_DMAMUX1_REQ_GEN_TIM12_TRGO | |||
| #define HAL_DMAMUX2_REQUEST_GEN_DMAMUX2_CH0_EVT HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH0_EVT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_DMAMUX2_CH1_EVT HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH1_EVT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_DMAMUX2_CH2_EVT HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH2_EVT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_DMAMUX2_CH3_EVT HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH3_EVT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_DMAMUX2_CH4_EVT HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH4_EVT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_DMAMUX2_CH5_EVT HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH5_EVT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_DMAMUX2_CH6_EVT HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH6_EVT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPUART1_RX_WKUP HAL_DMAMUX2_REQ_GEN_LPUART1_RX_WKUP | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPUART1_TX_WKUP HAL_DMAMUX2_REQ_GEN_LPUART1_TX_WKUP | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPTIM2_WKUP HAL_DMAMUX2_REQ_GEN_LPTIM2_WKUP | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPTIM2_OUT HAL_DMAMUX2_REQ_GEN_LPTIM2_OUT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPTIM3_WKUP HAL_DMAMUX2_REQ_GEN_LPTIM3_WKUP | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPTIM3_OUT HAL_DMAMUX2_REQ_GEN_LPTIM3_OUT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPTIM4_WKUP HAL_DMAMUX2_REQ_GEN_LPTIM4_WKUP | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPTIM5_WKUP HAL_DMAMUX2_REQ_GEN_LPTIM5_WKUP | |||
| #define HAL_DMAMUX2_REQUEST_GEN_I2C4_WKUP HAL_DMAMUX2_REQ_GEN_I2C4_WKUP | |||
| #define HAL_DMAMUX2_REQUEST_GEN_SPI6_WKUP HAL_DMAMUX2_REQ_GEN_SPI6_WKUP | |||
| #define HAL_DMAMUX2_REQUEST_GEN_COMP1_OUT HAL_DMAMUX2_REQ_GEN_COMP1_OUT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_COMP2_OUT HAL_DMAMUX2_REQ_GEN_COMP2_OUT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_RTC_WKUP HAL_DMAMUX2_REQ_GEN_RTC_WKUP | |||
| #define HAL_DMAMUX2_REQUEST_GEN_EXTI0 HAL_DMAMUX2_REQ_GEN_EXTI0 | |||
| #define HAL_DMAMUX2_REQUEST_GEN_EXTI2 HAL_DMAMUX2_REQ_GEN_EXTI2 | |||
| #define HAL_DMAMUX2_REQUEST_GEN_I2C4_IT_EVT HAL_DMAMUX2_REQ_GEN_I2C4_IT_EVT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_SPI6_IT HAL_DMAMUX2_REQ_GEN_SPI6_IT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPUART1_TX_IT HAL_DMAMUX2_REQ_GEN_LPUART1_TX_IT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_LPUART1_RX_IT HAL_DMAMUX2_REQ_GEN_LPUART1_RX_IT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_ADC3_IT HAL_DMAMUX2_REQ_GEN_ADC3_IT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_ADC3_AWD1_OUT HAL_DMAMUX2_REQ_GEN_ADC3_AWD1_OUT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_BDMA_CH0_IT HAL_DMAMUX2_REQ_GEN_BDMA_CH0_IT | |||
| #define HAL_DMAMUX2_REQUEST_GEN_BDMA_CH1_IT HAL_DMAMUX2_REQ_GEN_BDMA_CH1_IT | |||
| #define HAL_DMAMUX_REQUEST_GEN_NO_EVENT HAL_DMAMUX_REQ_GEN_NO_EVENT | |||
| #define HAL_DMAMUX_REQUEST_GEN_RISING HAL_DMAMUX_REQ_GEN_RISING | |||
| #define HAL_DMAMUX_REQUEST_GEN_FALLING HAL_DMAMUX_REQ_GEN_FALLING | |||
| #define HAL_DMAMUX_REQUEST_GEN_RISING_FALLING HAL_DMAMUX_REQ_GEN_RISING_FALLING | |||
| #endif /* STM32H7 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_HRTIM_Aliased_Macros HAL HRTIM Aliased Macros maintained for legacy purpose | |||
| * @{ | |||
| */ | |||
| @@ -549,6 +605,7 @@ | |||
| #define __HAL_HRTIM_GetClockPrescaler __HAL_HRTIM_GETCLOCKPRESCALER | |||
| #define __HAL_HRTIM_SetCompare __HAL_HRTIM_SETCOMPARE | |||
| #define __HAL_HRTIM_GetCompare __HAL_HRTIM_GETCOMPARE | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -688,6 +745,12 @@ | |||
| #define OPAMP_PGACONNECT_VM0 OPAMP_PGA_CONNECT_INVERTINGINPUT_IO0 | |||
| #define OPAMP_PGACONNECT_VM1 OPAMP_PGA_CONNECT_INVERTINGINPUT_IO1 | |||
| #if defined(STM32L1) || defined(STM32L4) | |||
| #define HAL_OPAMP_MSP_INIT_CB_ID HAL_OPAMP_MSPINIT_CB_ID | |||
| #define HAL_OPAMP_MSP_DEINIT_CB_ID HAL_OPAMP_MSPDEINIT_CB_ID | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -696,6 +759,15 @@ | |||
| * @{ | |||
| */ | |||
| #define I2S_STANDARD_PHILLIPS I2S_STANDARD_PHILIPS | |||
| #if defined(STM32H7) | |||
| #define I2S_IT_TXE I2S_IT_TXP | |||
| #define I2S_IT_RXNE I2S_IT_RXP | |||
| #define I2S_FLAG_TXE I2S_FLAG_TXP | |||
| #define I2S_FLAG_RXNE I2S_FLAG_RXP | |||
| #endif | |||
| #if defined(STM32F7) | |||
| #define I2S_CLOCK_SYSCLK I2S_CLOCK_PLL | |||
| #endif | |||
| @@ -741,7 +813,6 @@ | |||
| #define FORMAT_BCD RTC_FORMAT_BCD | |||
| #define RTC_ALARMSUBSECONDMASK_None RTC_ALARMSUBSECONDMASK_NONE | |||
| #define RTC_TAMPERERASEBACKUP_ENABLED RTC_TAMPER_ERASE_BACKUP_ENABLE | |||
| #define RTC_TAMPERERASEBACKUP_DISABLED RTC_TAMPER_ERASE_BACKUP_DISABLE | |||
| #define RTC_TAMPERMASK_FLAG_DISABLED RTC_TAMPERMASK_FLAG_DISABLE | |||
| #define RTC_TAMPERMASK_FLAG_ENABLED RTC_TAMPERMASK_FLAG_ENABLE | |||
| @@ -749,9 +820,6 @@ | |||
| #define RTC_MASKTAMPERFLAG_DISABLED RTC_TAMPERMASK_FLAG_DISABLE | |||
| #define RTC_MASKTAMPERFLAG_ENABLED RTC_TAMPERMASK_FLAG_ENABLE | |||
| #define RTC_TAMPERERASEBACKUP_ENABLED RTC_TAMPER_ERASE_BACKUP_ENABLE | |||
| #define RTC_TAMPERERASEBACKUP_DISABLED RTC_TAMPER_ERASE_BACKUP_DISABLE | |||
| #define RTC_MASKTAMPERFLAG_DISABLED RTC_TAMPERMASK_FLAG_DISABLE | |||
| #define RTC_MASKTAMPERFLAG_ENABLED RTC_TAMPERMASK_FLAG_ENABLE | |||
| #define RTC_TAMPER1_2_INTERRUPT RTC_ALL_TAMPER_INTERRUPT | |||
| #define RTC_TAMPER1_2_3_INTERRUPT RTC_ALL_TAMPER_INTERRUPT | |||
| @@ -824,6 +892,21 @@ | |||
| #define SPI_NSS_PULSE_DISABLED SPI_NSS_PULSE_DISABLE | |||
| #define SPI_NSS_PULSE_ENABLED SPI_NSS_PULSE_ENABLE | |||
| #if defined(STM32H7) | |||
| #define SPI_FLAG_TXE SPI_FLAG_TXP | |||
| #define SPI_FLAG_RXNE SPI_FLAG_RXP | |||
| #define SPI_IT_TXE SPI_IT_TXP | |||
| #define SPI_IT_RXNE SPI_IT_RXP | |||
| #define SPI_FRLVL_EMPTY SPI_RX_FIFO_0PACKET | |||
| #define SPI_FRLVL_QUARTER_FULL SPI_RX_FIFO_1PACKET | |||
| #define SPI_FRLVL_HALF_FULL SPI_RX_FIFO_2PACKET | |||
| #define SPI_FRLVL_FULL SPI_RX_FIFO_3PACKET | |||
| #endif /* STM32H7 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -891,6 +974,33 @@ | |||
| #define TIM_DMABurstLength_17Transfers TIM_DMABURSTLENGTH_17TRANSFERS | |||
| #define TIM_DMABurstLength_18Transfers TIM_DMABURSTLENGTH_18TRANSFERS | |||
| #if defined(STM32L0) | |||
| #define TIM22_TI1_GPIO1 TIM22_TI1_GPIO | |||
| #define TIM22_TI1_GPIO2 TIM22_TI1_GPIO | |||
| #endif | |||
| #if defined(STM32F3) | |||
| #define IS_TIM_HALL_INTERFACE_INSTANCE IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE | |||
| #endif | |||
| #if defined(STM32H7) | |||
| #define TIM_TIM1_ETR_COMP1_OUT TIM_TIM1_ETR_COMP1 | |||
| #define TIM_TIM1_ETR_COMP2_OUT TIM_TIM1_ETR_COMP2 | |||
| #define TIM_TIM8_ETR_COMP1_OUT TIM_TIM8_ETR_COMP1 | |||
| #define TIM_TIM8_ETR_COMP2_OUT TIM_TIM8_ETR_COMP2 | |||
| #define TIM_TIM2_ETR_COMP1_OUT TIM_TIM2_ETR_COMP1 | |||
| #define TIM_TIM2_ETR_COMP2_OUT TIM_TIM2_ETR_COMP2 | |||
| #define TIM_TIM3_ETR_COMP1_OUT TIM_TIM3_ETR_COMP1 | |||
| #define TIM_TIM1_TI1_COMP1_OUT TIM_TIM1_TI1_COMP1 | |||
| #define TIM_TIM8_TI1_COMP2_OUT TIM_TIM8_TI1_COMP2 | |||
| #define TIM_TIM2_TI4_COMP1_OUT TIM_TIM2_TI4_COMP1 | |||
| #define TIM_TIM2_TI4_COMP2_OUT TIM_TIM2_TI4_COMP2 | |||
| #define TIM_TIM2_TI4_COMP1COMP2_OUT TIM_TIM2_TI4_COMP1_COMP2 | |||
| #define TIM_TIM3_TI1_COMP1_OUT TIM_TIM3_TI1_COMP1 | |||
| #define TIM_TIM3_TI1_COMP2_OUT TIM_TIM3_TI1_COMP2 | |||
| #define TIM_TIM3_TI1_COMP1COMP2_OUT TIM_TIM3_TI1_COMP1_COMP2 | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -967,9 +1077,9 @@ | |||
| #define CAN_IT_RQCP2 CAN_IT_TME | |||
| #define INAK_TIMEOUT CAN_TIMEOUT_VALUE | |||
| #define SLAK_TIMEOUT CAN_TIMEOUT_VALUE | |||
| #define CAN_TXSTATUS_FAILED ((uint8_t)0x00) | |||
| #define CAN_TXSTATUS_OK ((uint8_t)0x01) | |||
| #define CAN_TXSTATUS_PENDING ((uint8_t)0x02) | |||
| #define CAN_TXSTATUS_FAILED ((uint8_t)0x00U) | |||
| #define CAN_TXSTATUS_OK ((uint8_t)0x01U) | |||
| #define CAN_TXSTATUS_PENDING ((uint8_t)0x02U) | |||
| /** | |||
| * @} | |||
| @@ -1017,9 +1127,12 @@ | |||
| #define ETH_MAC_RXFIFO_BELOW_THRESHOLD 0x00000100U /* Rx FIFO fill level: fill-level below flow-control de-activate threshold */ | |||
| #define ETH_MAC_RXFIFO_ABOVE_THRESHOLD 0x00000200U /* Rx FIFO fill level: fill-level above flow-control activate threshold */ | |||
| #define ETH_MAC_RXFIFO_FULL 0x00000300U /* Rx FIFO fill level: full */ | |||
| #if defined(STM32F1) | |||
| #else | |||
| #define ETH_MAC_READCONTROLLER_IDLE 0x00000000U /* Rx FIFO read controller IDLE state */ | |||
| #define ETH_MAC_READCONTROLLER_READING_DATA 0x00000020U /* Rx FIFO read controller Reading frame data */ | |||
| #define ETH_MAC_READCONTROLLER_READING_STATUS 0x00000040U /* Rx FIFO read controller Reading frame status (or time-stamp) */ | |||
| #endif | |||
| #define ETH_MAC_READCONTROLLER_FLUSHING 0x00000060U /* Rx FIFO read controller Flushing the frame data and status */ | |||
| #define ETH_MAC_RXFIFO_WRITE_ACTIVE 0x00000010U /* Rx FIFO write controller active */ | |||
| #define ETH_MAC_SMALL_FIFO_NOTACTIVE 0x00000000U /* MAC small FIFO read / write controllers not active */ | |||
| @@ -1048,8 +1161,9 @@ | |||
| * @} | |||
| */ | |||
| #if defined(STM32L4) || defined(STM32F7) || defined(STM32F427xx) || defined(STM32F437xx) ||\ | |||
| defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) | |||
| #if defined(STM32L4) || defined(STM32F7) || defined(STM32F427xx) || defined(STM32F437xx) \ | |||
| || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx) \ | |||
| || defined(STM32H7) | |||
| /** @defgroup HAL_DMA2D_Aliased_Defines HAL DMA2D Aliased Defines maintained for legacy purpose | |||
| * @{ | |||
| */ | |||
| @@ -1073,7 +1187,7 @@ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* STM32L4 || STM32F7*/ | |||
| #endif /* STM32L4 || STM32F7 || STM32F4 || STM32H7 */ | |||
| /** @defgroup HAL_PPP_Aliased_Defines HAL PPP Aliased Defines maintained for legacy purpose | |||
| * @{ | |||
| @@ -1165,6 +1279,28 @@ | |||
| #define HAL_FMPI2CEx_DigitalFilter_Config HAL_FMPI2CEx_ConfigDigitalFilter | |||
| #define HAL_I2CFastModePlusConfig(SYSCFG_I2CFastModePlus, cmd) (((cmd)==ENABLE)? HAL_I2CEx_EnableFastModePlus(SYSCFG_I2CFastModePlus): HAL_I2CEx_DisableFastModePlus(SYSCFG_I2CFastModePlus)) | |||
| #if defined(STM32H7) || defined(STM32WB) || defined(STM32G0) || defined(STM32F4) || defined(STM32F7) || defined(STM32L0) || defined(STM32L4) | |||
| #define HAL_I2C_Master_Sequential_Transmit_IT HAL_I2C_Master_Seq_Transmit_IT | |||
| #define HAL_I2C_Master_Sequential_Receive_IT HAL_I2C_Master_Seq_Receive_IT | |||
| #define HAL_I2C_Slave_Sequential_Transmit_IT HAL_I2C_Slave_Seq_Transmit_IT | |||
| #define HAL_I2C_Slave_Sequential_Receive_IT HAL_I2C_Slave_Seq_Receive_IT | |||
| #define HAL_I2C_Master_Sequential_Transmit_DMA HAL_I2C_Master_Seq_Transmit_DMA | |||
| #define HAL_I2C_Master_Sequential_Receive_DMA HAL_I2C_Master_Seq_Receive_DMA | |||
| #define HAL_I2C_Slave_Sequential_Transmit_DMA HAL_I2C_Slave_Seq_Transmit_DMA | |||
| #define HAL_I2C_Slave_Sequential_Receive_DMA HAL_I2C_Slave_Seq_Receive_DMA | |||
| #endif /* STM32H7 || STM32WB || STM32G0 || STM32F4 || STM32F7 || STM32L0 || STM32L4 */ | |||
| #if defined(STM32F4) | |||
| #define HAL_FMPI2C_Master_Sequential_Transmit_IT HAL_FMPI2C_Master_Seq_Transmit_IT | |||
| #define HAL_FMPI2C_Master_Sequential_Receive_IT HAL_FMPI2C_Master_Seq_Receive_IT | |||
| #define HAL_FMPI2C_Slave_Sequential_Transmit_IT HAL_FMPI2C_Slave_Seq_Transmit_IT | |||
| #define HAL_FMPI2C_Slave_Sequential_Receive_IT HAL_FMPI2C_Slave_Seq_Receive_IT | |||
| #define HAL_FMPI2C_Master_Sequential_Transmit_DMA HAL_FMPI2C_Master_Seq_Transmit_DMA | |||
| #define HAL_FMPI2C_Master_Sequential_Receive_DMA HAL_FMPI2C_Master_Seq_Receive_DMA | |||
| #define HAL_FMPI2C_Slave_Sequential_Transmit_DMA HAL_FMPI2C_Slave_Seq_Transmit_DMA | |||
| #define HAL_FMPI2C_Slave_Sequential_Receive_DMA HAL_FMPI2C_Slave_Seq_Receive_DMA | |||
| #endif /* STM32F4 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -1199,6 +1335,8 @@ | |||
| #define CR_OFFSET_BB PWR_CR_OFFSET_BB | |||
| #define CSR_OFFSET_BB PWR_CSR_OFFSET_BB | |||
| #define PMODE_BIT_NUMBER VOS_BIT_NUMBER | |||
| #define CR_PMODE_BB CR_VOS_BB | |||
| #define DBP_BitNumber DBP_BIT_NUMBER | |||
| #define PVDE_BitNumber PVDE_BIT_NUMBER | |||
| @@ -1242,6 +1380,14 @@ | |||
| #define HAL_TIM_DMAError TIM_DMAError | |||
| #define HAL_TIM_DMACaptureCplt TIM_DMACaptureCplt | |||
| #define HAL_TIMEx_DMACommutationCplt TIMEx_DMACommutationCplt | |||
| #if defined(STM32H7) || defined(STM32G0) || defined(STM32F7) || defined(STM32F4) || defined(STM32L0) || defined(STM32L4) | |||
| #define HAL_TIM_SlaveConfigSynchronization HAL_TIM_SlaveConfigSynchro | |||
| #define HAL_TIM_SlaveConfigSynchronization_IT HAL_TIM_SlaveConfigSynchro_IT | |||
| #define HAL_TIMEx_CommutationCallback HAL_TIMEx_CommutCallback | |||
| #define HAL_TIMEx_ConfigCommutationEvent HAL_TIMEx_ConfigCommutEvent | |||
| #define HAL_TIMEx_ConfigCommutationEvent_IT HAL_TIMEx_ConfigCommutEvent_IT | |||
| #define HAL_TIMEx_ConfigCommutationEvent_DMA HAL_TIMEx_ConfigCommutEvent_DMA | |||
| #endif /* STM32H7 || STM32G0 || STM32F7 || STM32F4 || STM32L0 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -1384,7 +1530,6 @@ | |||
| #define __HAL_ADC_CR1_SCANCONV ADC_CR1_SCANCONV | |||
| #define __HAL_ADC_CR2_EOCSelection ADC_CR2_EOCSelection | |||
| #define __HAL_ADC_CR2_DMAContReq ADC_CR2_DMAContReq | |||
| #define __HAL_ADC_GET_RESOLUTION ADC_GET_RESOLUTION | |||
| #define __HAL_ADC_JSQR ADC_JSQR | |||
| #define __HAL_ADC_CHSELR_CHANNEL ADC_CHSELR_CHANNEL | |||
| @@ -1456,10 +1601,17 @@ | |||
| #define __HAL_UNFREEZE_TIM17_DBGMCU __HAL_DBGMCU_UNFREEZE_TIM17 | |||
| #define __HAL_FREEZE_RTC_DBGMCU __HAL_DBGMCU_FREEZE_RTC | |||
| #define __HAL_UNFREEZE_RTC_DBGMCU __HAL_DBGMCU_UNFREEZE_RTC | |||
| #define __HAL_FREEZE_WWDG_DBGMCU __HAL_DBGMCU_FREEZE_WWDG | |||
| #define __HAL_UNFREEZE_WWDG_DBGMCU __HAL_DBGMCU_UNFREEZE_WWDG | |||
| #define __HAL_FREEZE_IWDG_DBGMCU __HAL_DBGMCU_FREEZE_IWDG | |||
| #define __HAL_UNFREEZE_IWDG_DBGMCU __HAL_DBGMCU_UNFREEZE_IWDG | |||
| #if defined(STM32H7) | |||
| #define __HAL_FREEZE_WWDG_DBGMCU __HAL_DBGMCU_FREEZE_WWDG1 | |||
| #define __HAL_UNFREEZE_WWDG_DBGMCU __HAL_DBGMCU_UnFreeze_WWDG1 | |||
| #define __HAL_FREEZE_IWDG_DBGMCU __HAL_DBGMCU_FREEZE_IWDG1 | |||
| #define __HAL_UNFREEZE_IWDG_DBGMCU __HAL_DBGMCU_UnFreeze_IWDG1 | |||
| #else | |||
| #define __HAL_FREEZE_WWDG_DBGMCU __HAL_DBGMCU_FREEZE_WWDG | |||
| #define __HAL_UNFREEZE_WWDG_DBGMCU __HAL_DBGMCU_UNFREEZE_WWDG | |||
| #define __HAL_FREEZE_IWDG_DBGMCU __HAL_DBGMCU_FREEZE_IWDG | |||
| #define __HAL_UNFREEZE_IWDG_DBGMCU __HAL_DBGMCU_UNFREEZE_IWDG | |||
| #endif /* STM32H7 */ | |||
| #define __HAL_FREEZE_I2C1_TIMEOUT_DBGMCU __HAL_DBGMCU_FREEZE_I2C1_TIMEOUT | |||
| #define __HAL_UNFREEZE_I2C1_TIMEOUT_DBGMCU __HAL_DBGMCU_UNFREEZE_I2C1_TIMEOUT | |||
| #define __HAL_FREEZE_I2C2_TIMEOUT_DBGMCU __HAL_DBGMCU_FREEZE_I2C2_TIMEOUT | |||
| @@ -1725,6 +1877,10 @@ | |||
| #define IS_I2S_INSTANCE IS_I2S_ALL_INSTANCE | |||
| #define IS_I2S_INSTANCE_EXT IS_I2S_ALL_INSTANCE_EXT | |||
| #if defined(STM32H7) | |||
| #define __HAL_I2S_CLEAR_FREFLAG __HAL_I2S_CLEAR_TIFREFLAG | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -1861,20 +2017,20 @@ | |||
| #define HAL_RCC_CCSCallback HAL_RCC_CSSCallback | |||
| #define HAL_RC48_EnableBuffer_Cmd(cmd) (((cmd)==ENABLE) ? HAL_RCCEx_EnableHSI48_VREFINT() : HAL_RCCEx_DisableHSI48_VREFINT()) | |||
| #define __ADC_CLK_DISABLE __HAL_RCC_ADC_CLK_DISABLE | |||
| #define __ADC_CLK_ENABLE __HAL_RCC_ADC_CLK_ENABLE | |||
| #define __ADC_CLK_SLEEP_DISABLE __HAL_RCC_ADC_CLK_SLEEP_DISABLE | |||
| #define __ADC_CLK_SLEEP_ENABLE __HAL_RCC_ADC_CLK_SLEEP_ENABLE | |||
| #define __ADC_FORCE_RESET __HAL_RCC_ADC_FORCE_RESET | |||
| #define __ADC_RELEASE_RESET __HAL_RCC_ADC_RELEASE_RESET | |||
| #define __ADC1_CLK_DISABLE __HAL_RCC_ADC1_CLK_DISABLE | |||
| #define __ADC1_CLK_ENABLE __HAL_RCC_ADC1_CLK_ENABLE | |||
| #define __ADC1_FORCE_RESET __HAL_RCC_ADC1_FORCE_RESET | |||
| #define __ADC1_RELEASE_RESET __HAL_RCC_ADC1_RELEASE_RESET | |||
| #define __ADC1_CLK_SLEEP_ENABLE __HAL_RCC_ADC1_CLK_SLEEP_ENABLE | |||
| #define __ADC1_CLK_SLEEP_DISABLE __HAL_RCC_ADC1_CLK_SLEEP_DISABLE | |||
| #define __ADC2_CLK_DISABLE __HAL_RCC_ADC2_CLK_DISABLE | |||
| #define __ADC2_CLK_ENABLE __HAL_RCC_ADC2_CLK_ENABLE | |||
| #define __ADC_CLK_DISABLE __HAL_RCC_ADC_CLK_DISABLE | |||
| #define __ADC_CLK_ENABLE __HAL_RCC_ADC_CLK_ENABLE | |||
| #define __ADC_CLK_SLEEP_DISABLE __HAL_RCC_ADC_CLK_SLEEP_DISABLE | |||
| #define __ADC_CLK_SLEEP_ENABLE __HAL_RCC_ADC_CLK_SLEEP_ENABLE | |||
| #define __ADC_FORCE_RESET __HAL_RCC_ADC_FORCE_RESET | |||
| #define __ADC_RELEASE_RESET __HAL_RCC_ADC_RELEASE_RESET | |||
| #define __ADC1_CLK_DISABLE __HAL_RCC_ADC1_CLK_DISABLE | |||
| #define __ADC1_CLK_ENABLE __HAL_RCC_ADC1_CLK_ENABLE | |||
| #define __ADC1_FORCE_RESET __HAL_RCC_ADC1_FORCE_RESET | |||
| #define __ADC1_RELEASE_RESET __HAL_RCC_ADC1_RELEASE_RESET | |||
| #define __ADC1_CLK_SLEEP_ENABLE __HAL_RCC_ADC1_CLK_SLEEP_ENABLE | |||
| #define __ADC1_CLK_SLEEP_DISABLE __HAL_RCC_ADC1_CLK_SLEEP_DISABLE | |||
| #define __ADC2_CLK_DISABLE __HAL_RCC_ADC2_CLK_DISABLE | |||
| #define __ADC2_CLK_ENABLE __HAL_RCC_ADC2_CLK_ENABLE | |||
| #define __ADC2_FORCE_RESET __HAL_RCC_ADC2_FORCE_RESET | |||
| #define __ADC2_RELEASE_RESET __HAL_RCC_ADC2_RELEASE_RESET | |||
| #define __ADC3_CLK_DISABLE __HAL_RCC_ADC3_CLK_DISABLE | |||
| @@ -1891,7 +2047,7 @@ | |||
| #define __CRYP_CLK_SLEEP_DISABLE __HAL_RCC_CRYP_CLK_SLEEP_DISABLE | |||
| #define __CRYP_CLK_ENABLE __HAL_RCC_CRYP_CLK_ENABLE | |||
| #define __CRYP_CLK_DISABLE __HAL_RCC_CRYP_CLK_DISABLE | |||
| #define __CRYP_FORCE_RESET __HAL_RCC_CRYP_FORCE_RESET | |||
| #define __CRYP_FORCE_RESET __HAL_RCC_CRYP_FORCE_RESET | |||
| #define __CRYP_RELEASE_RESET __HAL_RCC_CRYP_RELEASE_RESET | |||
| #define __AFIO_CLK_DISABLE __HAL_RCC_AFIO_CLK_DISABLE | |||
| #define __AFIO_CLK_ENABLE __HAL_RCC_AFIO_CLK_ENABLE | |||
| @@ -2119,6 +2275,21 @@ | |||
| #define __QSPI_CLK_SLEEP_ENABLE __HAL_RCC_QSPI_CLK_SLEEP_ENABLE | |||
| #define __QSPI_FORCE_RESET __HAL_RCC_QSPI_FORCE_RESET | |||
| #define __QSPI_RELEASE_RESET __HAL_RCC_QSPI_RELEASE_RESET | |||
| #if defined(STM32WB) | |||
| #define __HAL_RCC_QSPI_CLK_DISABLE __HAL_RCC_QUADSPI_CLK_DISABLE | |||
| #define __HAL_RCC_QSPI_CLK_ENABLE __HAL_RCC_QUADSPI_CLK_ENABLE | |||
| #define __HAL_RCC_QSPI_CLK_SLEEP_DISABLE __HAL_RCC_QUADSPI_CLK_SLEEP_DISABLE | |||
| #define __HAL_RCC_QSPI_CLK_SLEEP_ENABLE __HAL_RCC_QUADSPI_CLK_SLEEP_ENABLE | |||
| #define __HAL_RCC_QSPI_FORCE_RESET __HAL_RCC_QUADSPI_FORCE_RESET | |||
| #define __HAL_RCC_QSPI_RELEASE_RESET __HAL_RCC_QUADSPI_RELEASE_RESET | |||
| #define __HAL_RCC_QSPI_IS_CLK_ENABLED __HAL_RCC_QUADSPI_IS_CLK_ENABLED | |||
| #define __HAL_RCC_QSPI_IS_CLK_DISABLED __HAL_RCC_QUADSPI_IS_CLK_DISABLED | |||
| #define __HAL_RCC_QSPI_IS_CLK_SLEEP_ENABLED __HAL_RCC_QUADSPI_IS_CLK_SLEEP_ENABLED | |||
| #define __HAL_RCC_QSPI_IS_CLK_SLEEP_DISABLED __HAL_RCC_QUADSPI_IS_CLK_SLEEP_DISABLED | |||
| #define QSPI_IRQHandler QUADSPI_IRQHandler | |||
| #endif /* __HAL_RCC_QUADSPI_CLK_ENABLE */ | |||
| #define __RNG_CLK_DISABLE __HAL_RCC_RNG_CLK_DISABLE | |||
| #define __RNG_CLK_ENABLE __HAL_RCC_RNG_CLK_ENABLE | |||
| #define __RNG_CLK_SLEEP_DISABLE __HAL_RCC_RNG_CLK_SLEEP_DISABLE | |||
| @@ -2335,12 +2506,28 @@ | |||
| #define __USB_OTG_FS_CLK_DISABLE __HAL_RCC_USB_OTG_FS_CLK_DISABLE | |||
| #define __USB_OTG_FS_CLK_ENABLE __HAL_RCC_USB_OTG_FS_CLK_ENABLE | |||
| #define __USB_RELEASE_RESET __HAL_RCC_USB_RELEASE_RESET | |||
| #if defined(STM32H7) | |||
| #define __HAL_RCC_WWDG_CLK_DISABLE __HAL_RCC_WWDG1_CLK_DISABLE | |||
| #define __HAL_RCC_WWDG_CLK_ENABLE __HAL_RCC_WWDG1_CLK_ENABLE | |||
| #define __HAL_RCC_WWDG_CLK_SLEEP_DISABLE __HAL_RCC_WWDG1_CLK_SLEEP_DISABLE | |||
| #define __HAL_RCC_WWDG_CLK_SLEEP_ENABLE __HAL_RCC_WWDG1_CLK_SLEEP_ENABLE | |||
| #define __HAL_RCC_WWDG_FORCE_RESET ((void)0U) /* Not available on the STM32H7*/ | |||
| #define __HAL_RCC_WWDG_RELEASE_RESET ((void)0U) /* Not available on the STM32H7*/ | |||
| #define __HAL_RCC_WWDG_IS_CLK_ENABLED __HAL_RCC_WWDG1_IS_CLK_ENABLED | |||
| #define __HAL_RCC_WWDG_IS_CLK_DISABLED __HAL_RCC_WWDG1_IS_CLK_DISABLED | |||
| #endif | |||
| #define __WWDG_CLK_DISABLE __HAL_RCC_WWDG_CLK_DISABLE | |||
| #define __WWDG_CLK_ENABLE __HAL_RCC_WWDG_CLK_ENABLE | |||
| #define __WWDG_CLK_SLEEP_DISABLE __HAL_RCC_WWDG_CLK_SLEEP_DISABLE | |||
| #define __WWDG_CLK_SLEEP_ENABLE __HAL_RCC_WWDG_CLK_SLEEP_ENABLE | |||
| #define __WWDG_FORCE_RESET __HAL_RCC_WWDG_FORCE_RESET | |||
| #define __WWDG_RELEASE_RESET __HAL_RCC_WWDG_RELEASE_RESET | |||
| #define __TIM21_CLK_ENABLE __HAL_RCC_TIM21_CLK_ENABLE | |||
| #define __TIM21_CLK_DISABLE __HAL_RCC_TIM21_CLK_DISABLE | |||
| #define __TIM21_FORCE_RESET __HAL_RCC_TIM21_FORCE_RESET | |||
| @@ -2486,7 +2673,6 @@ | |||
| #define __HAL_RCC_OTGHSULPI_CLK_SLEEP_DISABLE __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE | |||
| #define __HAL_RCC_OTGHSULPI_IS_CLK_SLEEP_ENABLED __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_SLEEP_ENABLED | |||
| #define __HAL_RCC_OTGHSULPI_IS_CLK_SLEEP_DISABLED __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_SLEEP_DISABLED | |||
| #define __CRYP_FORCE_RESET __HAL_RCC_CRYP_FORCE_RESET | |||
| #define __SRAM3_CLK_SLEEP_ENABLE __HAL_RCC_SRAM3_CLK_SLEEP_ENABLE | |||
| #define __CAN2_CLK_SLEEP_ENABLE __HAL_RCC_CAN2_CLK_SLEEP_ENABLE | |||
| #define __CAN2_CLK_SLEEP_DISABLE __HAL_RCC_CAN2_CLK_SLEEP_DISABLE | |||
| @@ -2519,8 +2705,6 @@ | |||
| #define __ADC12_CLK_DISABLE __HAL_RCC_ADC12_CLK_DISABLE | |||
| #define __ADC34_CLK_ENABLE __HAL_RCC_ADC34_CLK_ENABLE | |||
| #define __ADC34_CLK_DISABLE __HAL_RCC_ADC34_CLK_DISABLE | |||
| #define __ADC12_CLK_ENABLE __HAL_RCC_ADC12_CLK_ENABLE | |||
| #define __ADC12_CLK_DISABLE __HAL_RCC_ADC12_CLK_DISABLE | |||
| #define __DAC2_CLK_ENABLE __HAL_RCC_DAC2_CLK_ENABLE | |||
| #define __DAC2_CLK_DISABLE __HAL_RCC_DAC2_CLK_DISABLE | |||
| #define __TIM18_CLK_ENABLE __HAL_RCC_TIM18_CLK_ENABLE | |||
| @@ -2542,8 +2726,6 @@ | |||
| #define __ADC12_RELEASE_RESET __HAL_RCC_ADC12_RELEASE_RESET | |||
| #define __ADC34_FORCE_RESET __HAL_RCC_ADC34_FORCE_RESET | |||
| #define __ADC34_RELEASE_RESET __HAL_RCC_ADC34_RELEASE_RESET | |||
| #define __ADC12_FORCE_RESET __HAL_RCC_ADC12_FORCE_RESET | |||
| #define __ADC12_RELEASE_RESET __HAL_RCC_ADC12_RELEASE_RESET | |||
| #define __DAC2_FORCE_RESET __HAL_RCC_DAC2_FORCE_RESET | |||
| #define __DAC2_RELEASE_RESET __HAL_RCC_DAC2_RELEASE_RESET | |||
| #define __TIM18_FORCE_RESET __HAL_RCC_TIM18_FORCE_RESET | |||
| @@ -2678,6 +2860,15 @@ | |||
| #define __WWDG_IS_CLK_ENABLED __HAL_RCC_WWDG_IS_CLK_ENABLED | |||
| #define __WWDG_IS_CLK_DISABLED __HAL_RCC_WWDG_IS_CLK_DISABLED | |||
| #if defined(STM32L1) | |||
| #define __HAL_RCC_CRYP_CLK_DISABLE __HAL_RCC_AES_CLK_DISABLE | |||
| #define __HAL_RCC_CRYP_CLK_ENABLE __HAL_RCC_AES_CLK_ENABLE | |||
| #define __HAL_RCC_CRYP_CLK_SLEEP_DISABLE __HAL_RCC_AES_CLK_SLEEP_DISABLE | |||
| #define __HAL_RCC_CRYP_CLK_SLEEP_ENABLE __HAL_RCC_AES_CLK_SLEEP_ENABLE | |||
| #define __HAL_RCC_CRYP_FORCE_RESET __HAL_RCC_AES_FORCE_RESET | |||
| #define __HAL_RCC_CRYP_RELEASE_RESET __HAL_RCC_AES_RELEASE_RESET | |||
| #endif /* STM32L1 */ | |||
| #if defined(STM32F4) | |||
| #define __HAL_RCC_SDMMC1_FORCE_RESET __HAL_RCC_SDIO_FORCE_RESET | |||
| #define __HAL_RCC_SDMMC1_RELEASE_RESET __HAL_RCC_SDIO_RELEASE_RESET | |||
| @@ -2710,6 +2901,11 @@ | |||
| #define __HAL_RCC_GET_SDIO_SOURCE __HAL_RCC_GET_SDMMC1_SOURCE | |||
| #endif | |||
| #if defined(STM32F7) | |||
| #define RCC_SDIOCLKSOURCE_CLK48 RCC_SDMMC1CLKSOURCE_CLK48 | |||
| #define RCC_SDIOCLKSOURCE_SYSCLK RCC_SDMMC1CLKSOURCE_SYSCLK | |||
| #endif | |||
| #if defined(STM32H7) | |||
| #define __HAL_RCC_USB_OTG_HS_CLK_ENABLE() __HAL_RCC_USB1_OTG_HS_CLK_ENABLE() | |||
| #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE() __HAL_RCC_USB1_OTG_HS_ULPI_CLK_ENABLE() | |||
| @@ -2734,11 +2930,6 @@ | |||
| #define __HAL_RCC_USB_OTG_FS_ULPI_CLK_SLEEP_DISABLE() __HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_DISABLE() | |||
| #endif | |||
| #if defined(STM32F7) | |||
| #define RCC_SDIOCLKSOURCE_CLK48 RCC_SDMMC1CLKSOURCE_CLK48 | |||
| #define RCC_SDIOCLKSOURCE_SYSCLK RCC_SDMMC1CLKSOURCE_SYSCLK | |||
| #endif | |||
| #define __HAL_RCC_I2SCLK __HAL_RCC_I2S_CONFIG | |||
| #define __HAL_RCC_I2SCLK_CONFIG __HAL_RCC_I2S_CONFIG | |||
| @@ -2792,7 +2983,12 @@ | |||
| #define RCC_MCOSOURCE_PLLCLK_NODIV RCC_MCO1SOURCE_PLLCLK | |||
| #define RCC_MCOSOURCE_PLLCLK_DIV2 RCC_MCO1SOURCE_PLLCLK_DIV2 | |||
| #if defined(STM32L4) | |||
| #define RCC_RTCCLKSOURCE_NO_CLK RCC_RTCCLKSOURCE_NONE | |||
| #elif defined(STM32WB) || defined(STM32G0) | |||
| #else | |||
| #define RCC_RTCCLKSOURCE_NONE RCC_RTCCLKSOURCE_NO_CLK | |||
| #endif | |||
| #define RCC_USBCLK_PLLSAI1 RCC_USBCLKSOURCE_PLLSAI1 | |||
| #define RCC_USBCLK_PLL RCC_USBCLKSOURCE_PLL | |||
| @@ -2917,8 +3113,10 @@ | |||
| /** @defgroup HAL_RTC_Aliased_Macros HAL RTC Aliased Macros maintained for legacy purpose | |||
| * @{ | |||
| */ | |||
| #if defined (STM32G0) || defined (STM32L412xx) || defined (STM32L422xx) | |||
| #else | |||
| #define __HAL_RTC_CLEAR_FLAG __HAL_RTC_EXTI_CLEAR_FLAG | |||
| #endif | |||
| #define __HAL_RTC_DISABLE_IT __HAL_RTC_EXTI_DISABLE_IT | |||
| #define __HAL_RTC_ENABLE_IT __HAL_RTC_EXTI_ENABLE_IT | |||
| @@ -3031,13 +3229,24 @@ | |||
| #define SDIO_IRQHandler SDMMC1_IRQHandler | |||
| #endif | |||
| #if defined(STM32F7) || defined(STM32F4) || defined(STM32F2) | |||
| #if defined(STM32F7) || defined(STM32F4) || defined(STM32F2) || defined(STM32L4) | |||
| #define HAL_SD_CardCIDTypedef HAL_SD_CardCIDTypeDef | |||
| #define HAL_SD_CardCSDTypedef HAL_SD_CardCSDTypeDef | |||
| #define HAL_SD_CardStatusTypedef HAL_SD_CardStatusTypeDef | |||
| #define HAL_SD_CardStateTypedef HAL_SD_CardStateTypeDef | |||
| #endif | |||
| #if defined(STM32H7) | |||
| #define HAL_MMCEx_Read_DMADoubleBuffer0CpltCallback HAL_MMCEx_Read_DMADoubleBuf0CpltCallback | |||
| #define HAL_MMCEx_Read_DMADoubleBuffer1CpltCallback HAL_MMCEx_Read_DMADoubleBuf1CpltCallback | |||
| #define HAL_MMCEx_Write_DMADoubleBuffer0CpltCallback HAL_MMCEx_Write_DMADoubleBuf0CpltCallback | |||
| #define HAL_MMCEx_Write_DMADoubleBuffer1CpltCallback HAL_MMCEx_Write_DMADoubleBuf1CpltCallback | |||
| #define HAL_SDEx_Read_DMADoubleBuffer0CpltCallback HAL_SDEx_Read_DMADoubleBuf0CpltCallback | |||
| #define HAL_SDEx_Read_DMADoubleBuffer1CpltCallback HAL_SDEx_Read_DMADoubleBuf1CpltCallback | |||
| #define HAL_SDEx_Write_DMADoubleBuffer0CpltCallback HAL_SDEx_Write_DMADoubleBuf0CpltCallback | |||
| #define HAL_SDEx_Write_DMADoubleBuffer1CpltCallback HAL_SDEx_Write_DMADoubleBuf1CpltCallback | |||
| #define HAL_SD_DriveTransciver_1_8V_Callback HAL_SD_DriveTransceiver_1_8V_Callback | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -3252,6 +3461,42 @@ | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_SPDIFRX_Aliased_Macros HAL SPDIFRX Aliased Macros maintained for legacy purpose | |||
| * @{ | |||
| */ | |||
| #if defined(STM32H7) | |||
| #define HAL_SPDIFRX_ReceiveControlFlow HAL_SPDIFRX_ReceiveCtrlFlow | |||
| #define HAL_SPDIFRX_ReceiveControlFlow_IT HAL_SPDIFRX_ReceiveCtrlFlow_IT | |||
| #define HAL_SPDIFRX_ReceiveControlFlow_DMA HAL_SPDIFRX_ReceiveCtrlFlow_DMA | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_HRTIM_Aliased_Functions HAL HRTIM Aliased Functions maintained for legacy purpose | |||
| * @{ | |||
| */ | |||
| #if defined (STM32H7) || defined (STM32F3) | |||
| #define HAL_HRTIM_WaveformCounterStart_IT HAL_HRTIM_WaveformCountStart_IT | |||
| #define HAL_HRTIM_WaveformCounterStart_DMA HAL_HRTIM_WaveformCountStart_DMA | |||
| #define HAL_HRTIM_WaveformCounterStart HAL_HRTIM_WaveformCountStart | |||
| #define HAL_HRTIM_WaveformCounterStop_IT HAL_HRTIM_WaveformCountStop_IT | |||
| #define HAL_HRTIM_WaveformCounterStop_DMA HAL_HRTIM_WaveformCountStop_DMA | |||
| #define HAL_HRTIM_WaveformCounterStop HAL_HRTIM_WaveformCountStop | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_QSPI_Aliased_Macros HAL QSPI Aliased Macros maintained for legacy purpose | |||
| * @{ | |||
| */ | |||
| #if defined (STM32L4) | |||
| #define HAL_QPSI_TIMEOUT_DEFAULT_VALUE HAL_QSPI_TIMEOUT_DEFAULT_VALUE | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_PPP_Aliased_Macros HAL PPP Aliased Macros maintained for legacy purpose | |||
| * @{ | |||
| @@ -3265,7 +3510,7 @@ | |||
| } | |||
| #endif | |||
| #endif /* ___STM32_HAL_LEGACY */ | |||
| #endif /* STM32_HAL_LEGACY */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,57 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32_assert.h | |||
| * @author MCD Application Team | |||
| * @brief STM32 assert template file. | |||
| * This file should be copied to the application folder and renamed | |||
| * to stm32_assert.h. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</center></h2> | |||
| * | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32_ASSERT_H | |||
| #define __STM32_ASSERT_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| /* 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)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) | |||
| /* Exported functions ------------------------------------------------------- */ | |||
| void assert_failed(uint8_t* file, uint32_t line); | |||
| #else | |||
| #define assert_param(expr) ((void)0U) | |||
| #endif /* USE_FULL_ASSERT */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32_ASSERT_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,43 +2,25 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief This file contains all the functions prototypes for the HAL | |||
| * module driver. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_H | |||
| #define __STM32H7xx_HAL_H | |||
| #ifndef STM32H7xx_HAL_H | |||
| #define STM32H7xx_HAL_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -72,6 +54,18 @@ typedef enum | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup REV_ID device revision ID | |||
| * @{ | |||
| */ | |||
| #define REV_ID_Y ((uint32_t)0x1003) /*!< STM32H7 rev.Y */ | |||
| #define REV_ID_B ((uint32_t)0x2000) /*!< STM32H7 rev.B */ | |||
| #define REV_ID_X ((uint32_t)0x2001) /*!< STM32H7 rev.X */ | |||
| #define REV_ID_V ((uint32_t)0x2003) /*!< STM32H7 rev.V */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SYSCFG_VREFBUF_VoltageScale VREFBUF Voltage Scale | |||
| * @{ | |||
| */ | |||
| @@ -100,7 +94,7 @@ typedef enum | |||
| #define IS_SYSCFG_VREFBUF_HIGH_IMPEDANCE(__VALUE__) (((__VALUE__) == SYSCFG_VREFBUF_HIGH_IMPEDANCE_DISABLE) || \ | |||
| ((__VALUE__) == SYSCFG_VREFBUF_HIGH_IMPEDANCE_ENABLE)) | |||
| #define IS_SYSCFG_VREFBUF_TRIMMING(__VALUE__) (((__VALUE__) > 0) && ((__VALUE__) <= VREFBUF_CCR_TRIM)) | |||
| #define IS_SYSCFG_VREFBUF_TRIMMING(__VALUE__) (((__VALUE__) > 0UL) && ((__VALUE__) <= VREFBUF_CCR_TRIM)) | |||
| /** | |||
| * @} | |||
| @@ -181,7 +175,7 @@ typedef enum | |||
| #define IS_SYSCFG_CODE_SELECT(SELECT) (((SELECT) == SYSCFG_CELL_CODE)|| \ | |||
| ((SELECT) == SYSCFG_REGISTER_CODE)) | |||
| #define IS_SYSCFG_CODE_CONFIG(CONFIG) ((CONFIG) < (0x10)) | |||
| #define IS_SYSCFG_CODE_CONFIG(CONFIG) ((CONFIG) < (0x10UL)) | |||
| /** | |||
| * @} | |||
| @@ -249,7 +243,11 @@ typedef enum | |||
| #define EXTI_LINE43 ((uint32_t)0x2B) | |||
| #define EXTI_LINE44 ((uint32_t)0x2C) | |||
| /* EXTI_LINE45 Reserved */ | |||
| #if defined(DUAL_CORE) | |||
| #define EXTI_LINE46 ((uint32_t)0x2E) | |||
| #else | |||
| /* EXTI_LINE46 Reserved */ | |||
| #endif | |||
| #define EXTI_LINE47 ((uint32_t)0x2F) | |||
| #define EXTI_LINE48 ((uint32_t)0x30) | |||
| #define EXTI_LINE49 ((uint32_t)0x31) | |||
| @@ -284,6 +282,21 @@ typedef enum | |||
| #define EXTI_LINE75 ((uint32_t)0x4B) | |||
| #define EXTI_LINE76 ((uint32_t)0x4C) | |||
| #if defined(DUAL_CORE) | |||
| #define EXTI_LINE77 ((uint32_t)0x4D) | |||
| #define EXTI_LINE78 ((uint32_t)0x4E) | |||
| #define EXTI_LINE79 ((uint32_t)0x4F) | |||
| #define EXTI_LINE80 ((uint32_t)0x50) | |||
| /* EXTI_LINE81 Reserved */ | |||
| #define EXTI_LINE82 ((uint32_t)0x52) | |||
| /* EXTI_LINE83 Reserved */ | |||
| #define EXTI_LINE84 ((uint32_t)0x54) | |||
| #define EXTI_LINE85 ((uint32_t)0x55) | |||
| #define EXTI_LINE86 ((uint32_t)0x56) | |||
| #define EXTI_LINE87 ((uint32_t)0x57) | |||
| /* EXTI_LINE88 Reserved */ | |||
| #else | |||
| /* EXTI_LINE77 Reserved */ | |||
| /* EXTI_LINE78 Reserved */ | |||
| /* EXTI_LINE79 Reserved */ | |||
| @@ -298,9 +311,25 @@ typedef enum | |||
| #define EXTI_LINE87 ((uint32_t)0x57) | |||
| /* EXTI_LINE88 Reserved */ | |||
| #endif | |||
| #define IS_EXTI_CONFIG_LINE(LINE) (((LINE) == EXTI_LINE0) || ((LINE) == EXTI_LINE1)|| \ | |||
| #if defined(DUAL_CORE) | |||
| #define IS_HAL_EXTI_CONFIG_LINE(LINE) (((LINE) == EXTI_LINE0) || ((LINE) == EXTI_LINE1) || \ | |||
| ((LINE) == EXTI_LINE2) || ((LINE) == EXTI_LINE3) || \ | |||
| ((LINE) == EXTI_LINE4) || ((LINE) == EXTI_LINE5) || \ | |||
| ((LINE) == EXTI_LINE6) || ((LINE) == EXTI_LINE7) || \ | |||
| ((LINE) == EXTI_LINE8) || ((LINE) == EXTI_LINE9) || \ | |||
| ((LINE) == EXTI_LINE10) || ((LINE) == EXTI_LINE11) || \ | |||
| ((LINE) == EXTI_LINE12) || ((LINE) == EXTI_LINE13) || \ | |||
| ((LINE) == EXTI_LINE14) || ((LINE) == EXTI_LINE15) || \ | |||
| ((LINE) == EXTI_LINE16) || ((LINE) == EXTI_LINE17) || \ | |||
| ((LINE) == EXTI_LINE18) || ((LINE) == EXTI_LINE19) || \ | |||
| ((LINE) == EXTI_LINE20) || ((LINE) == EXTI_LINE21) || \ | |||
| ((LINE) == EXTI_LINE49) || ((LINE) == EXTI_LINE51) || \ | |||
| ((LINE) == EXTI_LINE82) || ((LINE) == EXTI_LINE84) || \ | |||
| ((LINE) == EXTI_LINE85) || ((LINE) == EXTI_LINE86)) | |||
| #else | |||
| #define IS_HAL_EXTI_CONFIG_LINE(LINE) (((LINE) == EXTI_LINE0) || ((LINE) == EXTI_LINE1)|| \ | |||
| ((LINE) == EXTI_LINE2) || ((LINE) == EXTI_LINE3) || \ | |||
| ((LINE) == EXTI_LINE4) || ((LINE) == EXTI_LINE5) || \ | |||
| ((LINE) == EXTI_LINE6) || ((LINE) == EXTI_LINE7) || \ | |||
| @@ -313,7 +342,53 @@ typedef enum | |||
| ((LINE) == EXTI_LINE20) || ((LINE) == EXTI_LINE21) || \ | |||
| ((LINE) == EXTI_LINE49) || ((LINE) == EXTI_LINE51) || \ | |||
| ((LINE) == EXTI_LINE85) || ((LINE) == EXTI_LINE86)) | |||
| #endif | |||
| #if defined(DUAL_CORE) | |||
| #define IS_EXTI_ALL_LINE(LINE) (((LINE) == EXTI_LINE0) || ((LINE) == EXTI_LINE1) || \ | |||
| ((LINE) == EXTI_LINE2) || ((LINE) == EXTI_LINE3) || \ | |||
| ((LINE) == EXTI_LINE4) || ((LINE) == EXTI_LINE5) || \ | |||
| ((LINE) == EXTI_LINE6) || ((LINE) == EXTI_LINE7) || \ | |||
| ((LINE) == EXTI_LINE8) || ((LINE) == EXTI_LINE9) || \ | |||
| ((LINE) == EXTI_LINE10) || ((LINE) == EXTI_LINE11) || \ | |||
| ((LINE) == EXTI_LINE12) || ((LINE) == EXTI_LINE13) || \ | |||
| ((LINE) == EXTI_LINE14) || ((LINE) == EXTI_LINE15) || \ | |||
| ((LINE) == EXTI_LINE16) || ((LINE) == EXTI_LINE17) || \ | |||
| ((LINE) == EXTI_LINE18) || ((LINE) == EXTI_LINE19) || \ | |||
| ((LINE) == EXTI_LINE20) || ((LINE) == EXTI_LINE21) || \ | |||
| ((LINE) == EXTI_LINE22) || ((LINE) == EXTI_LINE23) || \ | |||
| ((LINE) == EXTI_LINE24) || ((LINE) == EXTI_LINE25) || \ | |||
| ((LINE) == EXTI_LINE26) || ((LINE) == EXTI_LINE27) || \ | |||
| ((LINE) == EXTI_LINE28) || ((LINE) == EXTI_LINE29) || \ | |||
| ((LINE) == EXTI_LINE30) || ((LINE) == EXTI_LINE31) || \ | |||
| ((LINE) == EXTI_LINE32) || ((LINE) == EXTI_LINE33) || \ | |||
| ((LINE) == EXTI_LINE34) || ((LINE) == EXTI_LINE35) || \ | |||
| ((LINE) == EXTI_LINE36) || ((LINE) == EXTI_LINE37) || \ | |||
| ((LINE) == EXTI_LINE38) || ((LINE) == EXTI_LINE39) || \ | |||
| ((LINE) == EXTI_LINE40) || ((LINE) == EXTI_LINE41) || \ | |||
| ((LINE) == EXTI_LINE42) || ((LINE) == EXTI_LINE43) || \ | |||
| ((LINE) == EXTI_LINE44) || ((LINE) == EXTI_LINE46) || \ | |||
| ((LINE) == EXTI_LINE47) || ((LINE) == EXTI_LINE48) || \ | |||
| ((LINE) == EXTI_LINE49) || ((LINE) == EXTI_LINE50) || \ | |||
| ((LINE) == EXTI_LINE51) || ((LINE) == EXTI_LINE52) || \ | |||
| ((LINE) == EXTI_LINE53) || ((LINE) == EXTI_LINE54) || \ | |||
| ((LINE) == EXTI_LINE55) || ((LINE) == EXTI_LINE56) || \ | |||
| ((LINE) == EXTI_LINE57) || ((LINE) == EXTI_LINE58) || \ | |||
| ((LINE) == EXTI_LINE59) || ((LINE) == EXTI_LINE60) || \ | |||
| ((LINE) == EXTI_LINE61) || ((LINE) == EXTI_LINE62) || \ | |||
| ((LINE) == EXTI_LINE63) || ((LINE) == EXTI_LINE64) || \ | |||
| ((LINE) == EXTI_LINE65) || ((LINE) == EXTI_LINE66) || \ | |||
| ((LINE) == EXTI_LINE67) || ((LINE) == EXTI_LINE68) || \ | |||
| ((LINE) == EXTI_LINE69) || ((LINE) == EXTI_LINE70) || \ | |||
| ((LINE) == EXTI_LINE71) || ((LINE) == EXTI_LINE72) || \ | |||
| ((LINE) == EXTI_LINE73) || ((LINE) == EXTI_LINE74) || \ | |||
| ((LINE) == EXTI_LINE75) || ((LINE) == EXTI_LINE76) || \ | |||
| ((LINE) == EXTI_LINE77) || ((LINE) == EXTI_LINE79) || \ | |||
| ((LINE) == EXTI_LINE84) || ((LINE) == EXTI_LINE85) || \ | |||
| ((LINE) == EXTI_LINE86) || ((LINE) == EXTI_LINE87) || \ | |||
| ((LINE) == EXTI_LINE78) || \ | |||
| ((LINE) == EXTI_LINE80) || ((LINE) == EXTI_LINE82)) | |||
| #else | |||
| #define IS_EXTI_ALL_LINE(LINE) (((LINE) == EXTI_LINE0) || ((LINE) == EXTI_LINE1) || \ | |||
| ((LINE) == EXTI_LINE2) || ((LINE) == EXTI_LINE3) || \ | |||
| ((LINE) == EXTI_LINE4) || ((LINE) == EXTI_LINE5) || \ | |||
| @@ -354,7 +429,51 @@ typedef enum | |||
| ((LINE) == EXTI_LINE75) || ((LINE) == EXTI_LINE76) || \ | |||
| ((LINE) == EXTI_LINE85) || \ | |||
| ((LINE) == EXTI_LINE86) || ((LINE) == EXTI_LINE87)) | |||
| #endif /*DUAL_CORE*/ | |||
| #if defined(DUAL_CORE) | |||
| #define IS_EXTI_D1_LINE(LINE) (((LINE) == EXTI_LINE0) || ((LINE) == EXTI_LINE1) || \ | |||
| ((LINE) == EXTI_LINE2) || ((LINE) == EXTI_LINE3) || \ | |||
| ((LINE) == EXTI_LINE4) || ((LINE) == EXTI_LINE5) || \ | |||
| ((LINE) == EXTI_LINE6) || ((LINE) == EXTI_LINE7) || \ | |||
| ((LINE) == EXTI_LINE8) || ((LINE) == EXTI_LINE9) || \ | |||
| ((LINE) == EXTI_LINE10) || ((LINE) == EXTI_LINE11) || \ | |||
| ((LINE) == EXTI_LINE12) || ((LINE) == EXTI_LINE13) || \ | |||
| ((LINE) == EXTI_LINE14) || ((LINE) == EXTI_LINE15) || \ | |||
| ((LINE) == EXTI_LINE16) || ((LINE) == EXTI_LINE17) || \ | |||
| ((LINE) == EXTI_LINE18) || ((LINE) == EXTI_LINE19) || \ | |||
| ((LINE) == EXTI_LINE20) || ((LINE) == EXTI_LINE21) || \ | |||
| ((LINE) == EXTI_LINE22) || ((LINE) == EXTI_LINE23) || \ | |||
| ((LINE) == EXTI_LINE24) || ((LINE) == EXTI_LINE25) || \ | |||
| ((LINE) == EXTI_LINE26) || ((LINE) == EXTI_LINE27) || \ | |||
| ((LINE) == EXTI_LINE28) || ((LINE) == EXTI_LINE29) || \ | |||
| ((LINE) == EXTI_LINE30) || ((LINE) == EXTI_LINE31) || \ | |||
| ((LINE) == EXTI_LINE32) || ((LINE) == EXTI_LINE33) || \ | |||
| ((LINE) == EXTI_LINE34) || ((LINE) == EXTI_LINE35) || \ | |||
| ((LINE) == EXTI_LINE36) || ((LINE) == EXTI_LINE37) || \ | |||
| ((LINE) == EXTI_LINE38) || ((LINE) == EXTI_LINE39) || \ | |||
| ((LINE) == EXTI_LINE40) || ((LINE) == EXTI_LINE41) || \ | |||
| ((LINE) == EXTI_LINE42) || ((LINE) == EXTI_LINE43) || \ | |||
| ((LINE) == EXTI_LINE44) || ((LINE) == EXTI_LINE46) || \ | |||
| ((LINE) == EXTI_LINE47) || ((LINE) == EXTI_LINE48) || \ | |||
| ((LINE) == EXTI_LINE49) || ((LINE) == EXTI_LINE50) || \ | |||
| ((LINE) == EXTI_LINE51) || ((LINE) == EXTI_LINE52) || \ | |||
| ((LINE) == EXTI_LINE53) || ((LINE) == EXTI_LINE54) || \ | |||
| ((LINE) == EXTI_LINE55) || ((LINE) == EXTI_LINE56) || \ | |||
| ((LINE) == EXTI_LINE57) || ((LINE) == EXTI_LINE58) || \ | |||
| ((LINE) == EXTI_LINE59) || ((LINE) == EXTI_LINE60) || \ | |||
| ((LINE) == EXTI_LINE61) || ((LINE) == EXTI_LINE62) || \ | |||
| ((LINE) == EXTI_LINE63) || ((LINE) == EXTI_LINE64) || \ | |||
| ((LINE) == EXTI_LINE65) || ((LINE) == EXTI_LINE66) || \ | |||
| ((LINE) == EXTI_LINE67) || ((LINE) == EXTI_LINE68) || \ | |||
| ((LINE) == EXTI_LINE69) || ((LINE) == EXTI_LINE70) || \ | |||
| ((LINE) == EXTI_LINE71) || ((LINE) == EXTI_LINE72) || \ | |||
| ((LINE) == EXTI_LINE73) || ((LINE) == EXTI_LINE74) || \ | |||
| ((LINE) == EXTI_LINE75) || ((LINE) == EXTI_LINE76) || \ | |||
| ((LINE) == EXTI_LINE77) || ((LINE) == EXTI_LINE79) || \ | |||
| ((LINE) == EXTI_LINE84) || ((LINE) == EXTI_LINE85) || \ | |||
| ((LINE) == EXTI_LINE86) || ((LINE) == EXTI_LINE87)) | |||
| #else | |||
| #define IS_EXTI_D1_LINE(LINE) (((LINE) == EXTI_LINE0) || ((LINE) == EXTI_LINE1) || \ | |||
| ((LINE) == EXTI_LINE2) || ((LINE) == EXTI_LINE3) || \ | |||
| ((LINE) == EXTI_LINE4) || ((LINE) == EXTI_LINE5) || \ | |||
| @@ -395,8 +514,53 @@ typedef enum | |||
| ((LINE) == EXTI_LINE75) || ((LINE) == EXTI_LINE76) || \ | |||
| ((LINE) == EXTI_LINE85) || \ | |||
| ((LINE) == EXTI_LINE86) || ((LINE) == EXTI_LINE87)) | |||
| #endif /*DUAL_CORE*/ | |||
| #if defined(DUAL_CORE) | |||
| #define IS_EXTI_D2_LINE(LINE) (((LINE) == EXTI_LINE0) || ((LINE) == EXTI_LINE1) || \ | |||
| ((LINE) == EXTI_LINE2) || ((LINE) == EXTI_LINE3) || \ | |||
| ((LINE) == EXTI_LINE4) || ((LINE) == EXTI_LINE5) || \ | |||
| ((LINE) == EXTI_LINE6) || ((LINE) == EXTI_LINE7) || \ | |||
| ((LINE) == EXTI_LINE8) || ((LINE) == EXTI_LINE9) || \ | |||
| ((LINE) == EXTI_LINE10) || ((LINE) == EXTI_LINE11) || \ | |||
| ((LINE) == EXTI_LINE12) || ((LINE) == EXTI_LINE13) || \ | |||
| ((LINE) == EXTI_LINE14) || ((LINE) == EXTI_LINE15) || \ | |||
| ((LINE) == EXTI_LINE16) || ((LINE) == EXTI_LINE17) || \ | |||
| ((LINE) == EXTI_LINE18) || ((LINE) == EXTI_LINE19) || \ | |||
| ((LINE) == EXTI_LINE20) || ((LINE) == EXTI_LINE21) || \ | |||
| ((LINE) == EXTI_LINE22) || ((LINE) == EXTI_LINE23) || \ | |||
| ((LINE) == EXTI_LINE24) || ((LINE) == EXTI_LINE25) || \ | |||
| ((LINE) == EXTI_LINE26) || ((LINE) == EXTI_LINE27) || \ | |||
| ((LINE) == EXTI_LINE28) || ((LINE) == EXTI_LINE29) || \ | |||
| ((LINE) == EXTI_LINE30) || ((LINE) == EXTI_LINE31) || \ | |||
| ((LINE) == EXTI_LINE32) || ((LINE) == EXTI_LINE33) || \ | |||
| ((LINE) == EXTI_LINE34) || ((LINE) == EXTI_LINE35) || \ | |||
| ((LINE) == EXTI_LINE36) || ((LINE) == EXTI_LINE37) || \ | |||
| ((LINE) == EXTI_LINE38) || ((LINE) == EXTI_LINE39) || \ | |||
| ((LINE) == EXTI_LINE40) || ((LINE) == EXTI_LINE41) || \ | |||
| ((LINE) == EXTI_LINE42) || ((LINE) == EXTI_LINE43) || \ | |||
| ((LINE) == EXTI_LINE44) || ((LINE) == EXTI_LINE46) || \ | |||
| ((LINE) == EXTI_LINE47) || ((LINE) == EXTI_LINE48) || \ | |||
| ((LINE) == EXTI_LINE49) || ((LINE) == EXTI_LINE50) || \ | |||
| ((LINE) == EXTI_LINE51) || ((LINE) == EXTI_LINE52) || \ | |||
| ((LINE) == EXTI_LINE53) || ((LINE) == EXTI_LINE54) || \ | |||
| ((LINE) == EXTI_LINE55) || ((LINE) == EXTI_LINE56) || \ | |||
| ((LINE) == EXTI_LINE57) || ((LINE) == EXTI_LINE58) || \ | |||
| ((LINE) == EXTI_LINE59) || ((LINE) == EXTI_LINE60) || \ | |||
| ((LINE) == EXTI_LINE61) || ((LINE) == EXTI_LINE62) || \ | |||
| ((LINE) == EXTI_LINE63) || ((LINE) == EXTI_LINE64) || \ | |||
| ((LINE) == EXTI_LINE65) || ((LINE) == EXTI_LINE66) || \ | |||
| ((LINE) == EXTI_LINE67) || ((LINE) == EXTI_LINE68) || \ | |||
| ((LINE) == EXTI_LINE69) || ((LINE) == EXTI_LINE70) || \ | |||
| ((LINE) == EXTI_LINE71) || ((LINE) == EXTI_LINE72) || \ | |||
| ((LINE) == EXTI_LINE73) || ((LINE) == EXTI_LINE74) || \ | |||
| ((LINE) == EXTI_LINE75) || ((LINE) == EXTI_LINE76) || \ | |||
| ((LINE) == EXTI_LINE78) || ((LINE) == EXTI_LINE80) || \ | |||
| ((LINE) == EXTI_LINE82) || ((LINE) == EXTI_LINE85) || \ | |||
| ((LINE) == EXTI_LINE86) || ((LINE) == EXTI_LINE87)) | |||
| #endif /*DUAL_CORE*/ | |||
| #if defined(DUAL_CORE) | |||
| #define IS_EXTI_D3_LINE(LINE) (((LINE) == EXTI_LINE0) || ((LINE) == EXTI_LINE1) || \ | |||
| ((LINE) == EXTI_LINE2) || ((LINE) == EXTI_LINE3) || \ | |||
| ((LINE) == EXTI_LINE4) || ((LINE) == EXTI_LINE5) || \ | |||
| @@ -412,12 +576,29 @@ typedef enum | |||
| ((LINE) == EXTI_LINE49) || ((LINE) == EXTI_LINE50) || \ | |||
| ((LINE) == EXTI_LINE51) || ((LINE) == EXTI_LINE52) || \ | |||
| ((LINE) == EXTI_LINE53)) | |||
| #else | |||
| #define IS_EXTI_D3_LINE(LINE) (((LINE) == EXTI_LINE0) || ((LINE) == EXTI_LINE1) || \ | |||
| ((LINE) == EXTI_LINE2) || ((LINE) == EXTI_LINE3) || \ | |||
| ((LINE) == EXTI_LINE4) || ((LINE) == EXTI_LINE5) || \ | |||
| ((LINE) == EXTI_LINE6) || ((LINE) == EXTI_LINE7) || \ | |||
| ((LINE) == EXTI_LINE8) || ((LINE) == EXTI_LINE9) || \ | |||
| ((LINE) == EXTI_LINE10) || ((LINE) == EXTI_LINE11) || \ | |||
| ((LINE) == EXTI_LINE12) || ((LINE) == EXTI_LINE13) || \ | |||
| ((LINE) == EXTI_LINE14) || ((LINE) == EXTI_LINE15) || \ | |||
| ((LINE) == EXTI_LINE19) || ((LINE) == EXTI_LINE20) || \ | |||
| ((LINE) == EXTI_LINE21) || ((LINE) == EXTI_LINE25) || \ | |||
| ((LINE) == EXTI_LINE34) || ((LINE) == EXTI_LINE35) || \ | |||
| ((LINE) == EXTI_LINE41) || ((LINE) == EXTI_LINE48) || \ | |||
| ((LINE) == EXTI_LINE49) || ((LINE) == EXTI_LINE50) || \ | |||
| ((LINE) == EXTI_LINE51) || ((LINE) == EXTI_LINE52) || \ | |||
| ((LINE) == EXTI_LINE53)) | |||
| #endif | |||
| #define BDMA_CH6_CLEAR ((uint32_t)0x00000000) /*!< BDMA ch6 event selected as D3 domain pendclear source*/ | |||
| #define BDMA_CH7_CLEAR ((uint32_t)0x00000001) /*!< BDMA ch7 event selected as D3 domain pendclear source*/ | |||
| #define LPTIM4_OUT_CLEAR ((uint32_t)0x00000002) /*!< LPTIM4 out selected as D3 domain pendclear source*/ | |||
| #define LPTIM5_OUT_CLEAR ((uint32_t)0x00000003) /*!< LPTIM5 out selected as D3 domain pendclear source*/ | |||
| #define BDMA_CH6_CLEAR ((uint32_t)0x00000000) /*!< BDMA ch6 event selected as D3 domain pendclear source*/ | |||
| #define BDMA_CH7_CLEAR ((uint32_t)0x00000001) /*!< BDMA ch7 event selected as D3 domain pendclear source*/ | |||
| #define LPTIM4_OUT_CLEAR ((uint32_t)0x00000002) /*!< LPTIM4 out selected as D3 domain pendclear source*/ | |||
| #define LPTIM5_OUT_CLEAR ((uint32_t)0x00000003) /*!< LPTIM5 out selected as D3 domain pendclear source*/ | |||
| #define IS_EXTI_D3_CLEAR(SOURCE) (((SOURCE) == BDMA_CH6_CLEAR) || ((SOURCE) == BDMA_CH7_CLEAR) || \ | |||
| ((SOURCE) == LPTIM4_OUT_CLEAR) || ((SOURCE) == LPTIM5_OUT_CLEAR)) | |||
| @@ -443,6 +624,99 @@ typedef enum | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup SYSCFG_Exported_Macros SYSCFG Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief SYSCFG Break AXIRAM double ECC lock. | |||
| * Enable and lock the connection of AXIRAM double ECC error to TIM1/8/15/16/17 and HRTIMER Break input. | |||
| * @note The selected configuration is locked and can be unlocked only by system reset. | |||
| This feature is available on STM32H7 rev.B and above. | |||
| */ | |||
| #define __HAL_SYSCFG_BREAK_AXISRAM_DBL_ECC_LOCK() SET_BIT(SYSCFG->CFGR, SYSCFG_CFGR_AXISRAML) | |||
| /** @brief SYSCFG Break ITCM double ECC lock. | |||
| * Enable and lock the connection of ITCM double ECC error to TIM1/8/15/16/17 and HRTIMER Break input. | |||
| * @note The selected configuration is locked and can be unlocked only by system reset. | |||
| This feature is available on STM32H7 rev.B and above. | |||
| */ | |||
| #define __HAL_SYSCFG_BREAK_ITCM_DBL_ECC_LOCK() SET_BIT(SYSCFG->CFGR, SYSCFG_CFGR_ITCML) | |||
| /** @brief SYSCFG Break DTCM double ECC lock. | |||
| * Enable and lock the connection of DTCM double ECC error to TIM1/8/15/16/17 and HRTIMER Break input. | |||
| * @note The selected configuration is locked and can be unlocked only by system reset. | |||
| This feature is available on STM32H7 rev.B and above. | |||
| */ | |||
| #define __HAL_SYSCFG_BREAK_DTCM_DBL_ECC_LOCK() SET_BIT(SYSCFG->CFGR, SYSCFG_CFGR_DTCML) | |||
| /** @brief SYSCFG Break SRAM1 double ECC lock. | |||
| * Enable and lock the connection of SRAM1 double ECC error to TIM1/8/15/16/17 and HRTIMER Break input. | |||
| * @note The selected configuration is locked and can be unlocked only by system reset. | |||
| This feature is available on STM32H7 rev.B and above. | |||
| */ | |||
| #define __HAL_SYSCFG_BREAK_SRAM1_DBL_ECC_LOCK() SET_BIT(SYSCFG->CFGR, SYSCFG_CFGR_SRAM1L) | |||
| /** @brief SYSCFG Break SRAM2 double ECC lock. | |||
| * Enable and lock the connection of SRAM2 double ECC error to TIM1/8/15/16/17 and HRTIMER Break input. | |||
| * @note The selected configuration is locked and can be unlocked only by system reset. | |||
| This feature is available on STM32H7 rev.B and above. | |||
| */ | |||
| #define __HAL_SYSCFG_BREAK_SRAM2_DBL_ECC_LOCK() SET_BIT(SYSCFG->CFGR, SYSCFG_CFGR_SRAM2L) | |||
| /** @brief SYSCFG Break SRAM3 double ECC lock. | |||
| * Enable and lock the connection of SRAM3 double ECC error to TIM1/8/15/16/17 and HRTIMER Break input. | |||
| * @note The selected configuration is locked and can be unlocked only by system reset. | |||
| This feature is available on STM32H7 rev.B and above. | |||
| */ | |||
| #define __HAL_SYSCFG_BREAK_SRAM3_DBL_ECC_LOCK() SET_BIT(SYSCFG->CFGR, SYSCFG_CFGR_SRAM3L) | |||
| /** @brief SYSCFG Break SRAM4 double ECC lock. | |||
| * Enable and lock the connection of SRAM4 double ECC error to TIM1/8/15/16/17 and HRTIMER Break input. | |||
| * @note The selected configuration is locked and can be unlocked only by system reset. | |||
| This feature is available on STM32H7 rev.B and above. | |||
| */ | |||
| #define __HAL_SYSCFG_BREAK_SRAM4_DBL_ECC_LOCK() SET_BIT(SYSCFG->CFGR, SYSCFG_CFGR_SRAM4L) | |||
| /** @brief SYSCFG Break Backup SRAM double ECC lock. | |||
| * Enable and lock the connection of Backup SRAM double ECC error to TIM1/8/15/16/17 and HRTIMER Break input. | |||
| * @note The selected configuration is locked and can be unlocked only by system reset. | |||
| This feature is available on STM32H7 rev.B and above. | |||
| */ | |||
| #define __HAL_SYSCFG_BREAK_BKRAM_DBL_ECC_LOCK() SET_BIT(SYSCFG->CFGR, SYSCFG_CFGR_BKRAML) | |||
| /** @brief SYSCFG Break Cortex-M7 Lockup lock. | |||
| * Enable and lock the connection of Cortex-M7 LOCKUP output to TIM1/8/15/16/17 and HRTIMER Break input. | |||
| * @note The selected configuration is locked and can be unlocked only by system reset. | |||
| This feature is available on STM32H7 rev.B and above. | |||
| */ | |||
| #define __HAL_SYSCFG_BREAK_CM7_LOCKUP_LOCK() SET_BIT(SYSCFG->CFGR, SYSCFG_CFGR_CM7L) | |||
| /** @brief SYSCFG Break FLASH double ECC lock. | |||
| * Enable and lock the connection of Flash double ECC error connection to TIM1/8/15/16/17 and HRTIMER Break input. | |||
| * @note The selected configuration is locked and can be unlocked only by system reset. | |||
| This feature is available on STM32H7 rev.B and above. | |||
| */ | |||
| #define __HAL_SYSCFG_BREAK_FLASH_DBL_ECC_LOCK() SET_BIT(SYSCFG->CFGR, SYSCFG_CFGR_FLASHL) | |||
| /** @brief SYSCFG Break PVD lock. | |||
| * Enable and lock the PVD connection to Timer1/8/15/16/17 and HRTIMER Break input, as well as the PVDE and PLS[2:0] in the PWR_CR1 register. | |||
| * @note The selected configuration is locked and can be unlocked only by system reset. | |||
| This feature is available on STM32H7 rev.B and above. | |||
| */ | |||
| #define __HAL_SYSCFG_BREAK_PVD_LOCK() SET_BIT(SYSCFG->CFGR, SYSCFG_CFGR_PVDL) | |||
| #if defined(DUAL_CORE) | |||
| /** @brief SYSCFG Break Cortex-M4 Lockup lock. | |||
| * Enable and lock the connection of Cortex-M4 LOCKUP output to TIM1/8/15/16/17 and HRTIMER Break input. | |||
| * @note The selected configuration is locked and can be unlocked only by system reset. | |||
| This feature is available on STM32H7 rev.B and above. | |||
| */ | |||
| #define __HAL_SYSCFG_BREAK_CM4_LOCKUP_LOCK() SET_BIT(SYSCFG->CFGR, SYSCFG_CFGR_CM4L) | |||
| #endif /* DUAL_CORE */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @brief Freeze/Unfreeze Peripherals in Debug mode | |||
| */ | |||
| @@ -514,6 +788,81 @@ typedef enum | |||
| #define __HAL_DBGMCU_UnFreeze_IWDG1() (DBGMCU->APB4FZ1 &= ~ (DBGMCU_APB4FZ1_DBG_IWDG1)) | |||
| #if defined(DUAL_CORE) | |||
| #define __HAL_DBGMCU_FREEZE2_IWDG2() (DBGMCU->APB4FZ2 |= (DBGMCU_APB4FZ2_DBG_IWDG2)) | |||
| #define __HAL_DBGMCU_FREEZE2_WWDG2() (DBGMCU->APB1LFZ2 |= (DBGMCU_APB1LFZ2_DBG_WWDG2)) | |||
| #define __HAL_DBGMCU_UnFreeze2_IWDG2() (DBGMCU->APB4FZ2 &= ~ (DBGMCU_APB4FZ2_DBG_IWDG2)) | |||
| #define __HAL_DBGMCU_UnFreeze2_WWDG2() (DBGMCU->APB1LFZ2 &= ~ (DBGMCU_APB1LFZ2_DBG_WWDG2)) | |||
| #define __HAL_DBGMCU_FREEZE2_WWDG1() (DBGMCU->APB3FZ2 |= (DBGMCU_APB3FZ2_DBG_WWDG1)) | |||
| #define __HAL_DBGMCU_FREEZE2_TIM2() (DBGMCU->APB1LFZ2 |= (DBGMCU_APB1LFZ2_DBG_TIM2)) | |||
| #define __HAL_DBGMCU_FREEZE2_TIM3() (DBGMCU->APB1LFZ2 |= (DBGMCU_APB1LFZ2_DBG_TIM3)) | |||
| #define __HAL_DBGMCU_FREEZE2_TIM4() (DBGMCU->APB1LFZ2 |= (DBGMCU_APB1LFZ2_DBG_TIM4)) | |||
| #define __HAL_DBGMCU_FREEZE2_TIM5() (DBGMCU->APB1LFZ2 |= (DBGMCU_APB1LFZ2_DBG_TIM5)) | |||
| #define __HAL_DBGMCU_FREEZE2_TIM6() (DBGMCU->APB1LFZ2 |= (DBGMCU_APB1LFZ2_DBG_TIM6)) | |||
| #define __HAL_DBGMCU_FREEZE2_TIM7() (DBGMCU->APB1LFZ2 |= (DBGMCU_APB1LFZ2_DBG_TIM7)) | |||
| #define __HAL_DBGMCU_FREEZE2_TIM12() (DBGMCU->APB1LFZ2 |= (DBGMCU_APB1LFZ2_DBG_TIM12)) | |||
| #define __HAL_DBGMCU_FREEZE2_TIM13() (DBGMCU->APB1LFZ2 |= (DBGMCU_APB1LFZ2_DBG_TIM13)) | |||
| #define __HAL_DBGMCU_FREEZE2_TIM14() (DBGMCU->APB1LFZ2 |= (DBGMCU_APB1LFZ2_DBG_TIM14)) | |||
| #define __HAL_DBGMCU_FREEZE2_LPTIM1() (DBGMCU->APB1LFZ2 |= (DBGMCU_APB1LFZ2_DBG_LPTIM1)) | |||
| #define __HAL_DBGMCU_FREEZE2_I2C1() (DBGMCU->APB1LFZ2 |= (DBGMCU_APB1LFZ2_DBG_I2C1)) | |||
| #define __HAL_DBGMCU_FREEZE2_I2C2() (DBGMCU->APB1LFZ2 |= (DBGMCU_APB1LFZ2_DBG_I2C2)) | |||
| #define __HAL_DBGMCU_FREEZE2_I2C3() (DBGMCU->APB1LFZ2 |= (DBGMCU_APB1LFZ2_DBG_I2C3)) | |||
| #define __HAL_DBGMCU_FREEZE2_FDCAN() (DBGMCU->APB1HFZ2 |= (DBGMCU_APB1HFZ2_DBG_FDCAN)) | |||
| #define __HAL_DBGMCU_FREEZE2_TIM1() (DBGMCU->APB2FZ2 |= (DBGMCU_APB2FZ2_DBG_TIM1)) | |||
| #define __HAL_DBGMCU_FREEZE2_TIM8() (DBGMCU->APB2FZ2 |= (DBGMCU_APB2FZ2_DBG_TIM8)) | |||
| #define __HAL_DBGMCU_FREEZE2_TIM15() (DBGMCU->APB2FZ2 |= (DBGMCU_APB2FZ2_DBG_TIM15)) | |||
| #define __HAL_DBGMCU_FREEZE2_TIM16() (DBGMCU->APB2FZ2 |= (DBGMCU_APB2FZ2_DBG_TIM16)) | |||
| #define __HAL_DBGMCU_FREEZE2_TIM17() (DBGMCU->APB2FZ2 |= (DBGMCU_APB2FZ2_DBG_TIM17)) | |||
| #define __HAL_DBGMCU_FREEZE2_HRTIM() (DBGMCU->APB2FZ2 |= (DBGMCU_APB2FZ2_DBG_HRTIM)) | |||
| #define __HAL_DBGMCU_FREEZE2_I2C4() (DBGMCU->APB4FZ2 |= (DBGMCU_APB4FZ2_DBG_I2C4)) | |||
| #define __HAL_DBGMCU_FREEZE2_LPTIM2() (DBGMCU->APB4FZ2 |= (DBGMCU_APB4FZ2_DBG_LPTIM2)) | |||
| #define __HAL_DBGMCU_FREEZE2_LPTIM3() (DBGMCU->APB4FZ2 |= (DBGMCU_APB4FZ2_DBG_LPTIM3)) | |||
| #define __HAL_DBGMCU_FREEZE2_LPTIM4() (DBGMCU->APB4FZ2 |= (DBGMCU_APB4FZ2_DBG_LPTIM4)) | |||
| #define __HAL_DBGMCU_FREEZE2_LPTIM5() (DBGMCU->APB4FZ2 |= (DBGMCU_APB4FZ2_DBG_LPTIM5)) | |||
| #define __HAL_DBGMCU_FREEZE2_RTC() (DBGMCU->APB4FZ2 |= (DBGMCU_APB4FZ2_DBG_RTC)) | |||
| #define __HAL_DBGMCU_FREEZE2_IWDG1() (DBGMCU->APB4FZ2 |= (DBGMCU_APB4FZ2_DBG_IWDG1)) | |||
| #define __HAL_DBGMCU_UnFreeze2_WWDG1() (DBGMCU->APB3FZ2 &= ~ (DBGMCU_APB3FZ2_DBG_WWDG1)) | |||
| #define __HAL_DBGMCU_UnFreeze2_TIM2() (DBGMCU->APB1LFZ2 &= ~ (DBGMCU_APB1LFZ2_DBG_TIM2)) | |||
| #define __HAL_DBGMCU_UnFreeze2_TIM3() (DBGMCU->APB1LFZ2 &= ~ (DBGMCU_APB1LFZ2_DBG_TIM3)) | |||
| #define __HAL_DBGMCU_UnFreeze2_TIM4() (DBGMCU->APB1LFZ2 &= ~ (DBGMCU_APB1LFZ2_DBG_TIM4)) | |||
| #define __HAL_DBGMCU_UnFreeze2_TIM5() (DBGMCU->APB1LFZ2 &= ~ (DBGMCU_APB1LFZ2_DBG_TIM5)) | |||
| #define __HAL_DBGMCU_UnFreeze2_TIM6() (DBGMCU->APB1LFZ2 &= ~ (DBGMCU_APB1LFZ2_DBG_TIM6)) | |||
| #define __HAL_DBGMCU_UnFreeze2_TIM7() (DBGMCU->APB1LFZ2 &= ~ (DBGMCU_APB1LFZ2_DBG_TIM7)) | |||
| #define __HAL_DBGMCU_UnFreeze2_TIM12() (DBGMCU->APB1LFZ2 &= ~ (DBGMCU_APB1LFZ2_DBG_TIM12)) | |||
| #define __HAL_DBGMCU_UnFreeze2_TIM13() (DBGMCU->APB1LFZ2 &= ~ (DBGMCU_APB1LFZ2_DBG_TIM13)) | |||
| #define __HAL_DBGMCU_UnFreeze2_TIM14() (DBGMCU->APB1LFZ2 &= ~ (DBGMCU_APB1LFZ2_DBG_TIM14)) | |||
| #define __HAL_DBGMCU_UnFreeze2_LPTIM1() (DBGMCU->APB1LFZ2 &= ~ (DBGMCU_APB1LFZ2_DBG_LPTIM1)) | |||
| #define __HAL_DBGMCU_UnFreeze2_I2C1() (DBGMCU->APB1LFZ2 &= ~ (DBGMCU_APB1LFZ2_DBG_I2C1)) | |||
| #define __HAL_DBGMCU_UnFreeze2_I2C2() (DBGMCU->APB1LFZ2 &= ~ (DBGMCU_APB1LFZ2_DBG_I2C2)) | |||
| #define __HAL_DBGMCU_UnFreeze2_I2C3() (DBGMCU->APB1LFZ2 &= ~ (DBGMCU_APB1LFZ2_DBG_I2C3)) | |||
| #define __HAL_DBGMCU_UnFreeze2_FDCAN() (DBGMCU->APB1HFZ2 &= ~ (DBGMCU_APB1HFZ2_DBG_FDCAN)) | |||
| #define __HAL_DBGMCU_UnFreeze2_TIM1() (DBGMCU->APB2FZ2 &= ~ (DBGMCU_APB2FZ2_DBG_TIM1)) | |||
| #define __HAL_DBGMCU_UnFreeze2_TIM8() (DBGMCU->APB2FZ2 &= ~ (DBGMCU_APB2FZ2_DBG_TIM8)) | |||
| #define __HAL_DBGMCU_UnFreeze2_TIM15() (DBGMCU->APB2FZ2 &= ~ (DBGMCU_APB2FZ2_DBG_TIM15)) | |||
| #define __HAL_DBGMCU_UnFreeze2_TIM16() (DBGMCU->APB2FZ2 &= ~ (DBGMCU_APB2FZ2_DBG_TIM16)) | |||
| #define __HAL_DBGMCU_UnFreeze2_TIM17() (DBGMCU->APB2FZ2 &= ~ (DBGMCU_APB2FZ2_DBG_TIM17)) | |||
| #define __HAL_DBGMCU_UnFreeze2_HRTIM() (DBGMCU->APB2FZ2 &= ~ (DBGMCU_APB2FZ2_DBG_HRTIM)) | |||
| #define __HAL_DBGMCU_UnFreeze2_I2C4() (DBGMCU->APB4FZ2 &= ~ (DBGMCU_APB4FZ2_DBG_I2C4)) | |||
| #define __HAL_DBGMCU_UnFreeze2_LPTIM2() (DBGMCU->APB4FZ2 &= ~ (DBGMCU_APB4FZ2_DBG_LPTIM2)) | |||
| #define __HAL_DBGMCU_UnFreeze2_LPTIM3() (DBGMCU->APB4FZ2 &= ~ (DBGMCU_APB4FZ2_DBG_LPTIM3)) | |||
| #define __HAL_DBGMCU_UnFreeze2_LPTIM4() (DBGMCU->APB4FZ2 &= ~ (DBGMCU_APB4FZ2_DBG_LPTIM4)) | |||
| #define __HAL_DBGMCU_UnFreeze2_LPTIM5() (DBGMCU->APB4FZ2 &= ~ (DBGMCU_APB4FZ2_DBG_LPTIM5)) | |||
| #define __HAL_DBGMCU_UnFreeze2_RTC() (DBGMCU->APB4FZ2 &= ~ (DBGMCU_APB4FZ2_DBG_RTC)) | |||
| #define __HAL_DBGMCU_UnFreeze2_IWDG1() (DBGMCU->APB4FZ2 &= ~ (DBGMCU_APB4FZ2_DBG_IWDG1)) | |||
| #endif /*DUAL_CORE*/ | |||
| /** @defgroup HAL_Private_Macros HAL Private Macros | |||
| * @{ | |||
| @@ -536,7 +885,7 @@ HAL_StatusTypeDef HAL_InitTick (uint32_t TickPriority); | |||
| /* Peripheral Control functions ************************************************/ | |||
| void HAL_IncTick(void); | |||
| void HAL_Delay(__IO uint32_t Delay); | |||
| void HAL_Delay(uint32_t Delay); | |||
| uint32_t HAL_GetTick(void); | |||
| uint32_t HAL_GetTickPrio(void); | |||
| HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq); | |||
| @@ -551,6 +900,13 @@ void HAL_SYSCFG_AnalogSwitchConfig(uint32_t SYSCFG_AnalogSwitch , uint32_t SYSCF | |||
| void HAL_SYSCFG_EnableBOOST(void); | |||
| void HAL_SYSCFG_DisableBOOST(void); | |||
| void HAL_SYSCFG_CM7BootAddConfig(uint32_t BootRegister, uint32_t BootAddress); | |||
| #if defined(DUAL_CORE) | |||
| void HAL_SYSCFG_CM4BootAddConfig(uint32_t BootRegister, uint32_t BootAddress); | |||
| void HAL_SYSCFG_EnableCM7BOOT(void); | |||
| void HAL_SYSCFG_DisableCM7BOOT(void); | |||
| void HAL_SYSCFG_EnableCM4BOOT(void); | |||
| void HAL_SYSCFG_DisableCM4BOOT(void); | |||
| #endif /*DUAL_CORE*/ | |||
| void HAL_EnableCompensationCell(void); | |||
| void HAL_DisableCompensationCell(void); | |||
| void HAL_SYSCFG_EnableIOSpeedOptimize(void); | |||
| @@ -563,14 +919,28 @@ void HAL_EnableDBGStopMode(void); | |||
| void HAL_DisableDBGStopMode(void); | |||
| void HAL_EnableDBGStandbyMode(void); | |||
| void HAL_DisableDBGStandbyMode(void); | |||
| #if defined(DUAL_CORE) | |||
| void HAL_EnableDomain2DBGSleepMode(void); | |||
| void HAL_DisableDomain2DBGSleepMode(void); | |||
| void HAL_EnableDomain2DBGStopMode(void); | |||
| void HAL_DisableDomain2DBGStopMode(void); | |||
| void HAL_EnableDomain2DBGStandbyMode(void); | |||
| void HAL_DisableDomain2DBGStandbyMode(void); | |||
| #endif /*DUAL_CORE*/ | |||
| void HAL_EnableDomain3DBGStopMode(void); | |||
| void HAL_DisableDomain3DBGStopMode(void); | |||
| void HAL_EnableDomain3DBGStandbyMode(void); | |||
| void HAL_DisableDomain3DBGStandbyMode(void); | |||
| void HAL_EXTI_EdgeConfig(uint32_t EXTI_Line , uint32_t EXTI_Edge ); | |||
| void HAL_EXTI_GenerateSWInterrupt(uint32_t EXTI_Line); | |||
| #if defined(DUAL_CORE) | |||
| void HAL_EXTI_D2_ClearFlag(uint32_t EXTI_Line); | |||
| #endif /*DUAL_CORE*/ | |||
| void HAL_EXTI_D1_ClearFlag(uint32_t EXTI_Line); | |||
| void HAL_EXTI_D1_EventInputConfig(uint32_t EXTI_Line , uint32_t EXTI_Mode, uint32_t EXTI_LineCmd); | |||
| #if defined(DUAL_CORE) | |||
| void HAL_EXTI_D2_EventInputConfig(uint32_t EXTI_Line , uint32_t EXTI_Mode, uint32_t EXTI_LineCmd); | |||
| #endif /*DUAL_CORE*/ | |||
| void HAL_EXTI_D3_EventInputConfig(uint32_t EXTI_Line, uint32_t EXTI_LineCmd , uint32_t EXTI_ClearSrc); | |||
| void HAL_SetFMCMemorySwappingConfig(uint32_t BankMapConfig); | |||
| uint32_t HAL_GetFMCMemorySwappingConfig(void); | |||
| @@ -592,6 +962,6 @@ void HAL_SYSCFG_DisableVREFBUF(void); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_H */ | |||
| #endif /* STM32H7xx_HAL_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,50 +2,34 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_cec.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of CEC HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_CEC_H | |||
| #define __STM32H7xx_HAL_CEC_H | |||
| #ifndef STM32H7xx_HAL_CEC_H | |||
| #define STM32H7xx_HAL_CEC_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_hal_def.h" | |||
| #if defined (CEC) | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| @@ -75,59 +59,60 @@ typedef struct | |||
| 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. */ | |||
| 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. */ | |||
| 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. */ | |||
| 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: | |||
| - CEC_BROADCASTERROR_ERRORBIT_GENERATION. | |||
| - a) BRE detection: error-bit generation on the CEC line if BRESTP=CEC_RX_STOP_ON_BRE | |||
| 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 | |||
| b) LBPE detection: error-bit generation on the CEC line | |||
| if LBPGEN=CEC_LBPE_ERRORBIT_NO_GENERATION. | |||
| - CEC_BROADCASTERROR_NO_ERRORBIT_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. */ | |||
| 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 | |||
| 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 | |||
| 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 | |||
| uint16_t OwnAddress; /*!< Own addresses configuration | |||
| This parameter can be a value of @ref CEC_OWN_ADDRESS */ | |||
| uint8_t *RxBuffer; /*!< CEC Rx buffer pointer */ | |||
| uint8_t *RxBuffer; /*!< CEC Rx buffer pointeur */ | |||
| }CEC_InitTypeDef; | |||
| } CEC_InitTypeDef; | |||
| /** | |||
| * @brief HAL CEC State structures definition | |||
| * @note HAL CEC State value is a combination of 2 different substates: gState and RxState. | |||
| * @brief HAL CEC State definition | |||
| * @note HAL CEC State value is a combination of 2 different substates: gState and RxState (see @ref CEC_State_Definition). | |||
| * - gState contains CEC state information related to global Handle management | |||
| * and also information related to Tx operations. | |||
| * gState value coding follow below described bitmap : | |||
| @@ -164,27 +149,16 @@ typedef struct | |||
| * 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_BUSY_RX_TX = 0x23U, /*!< an internal process is ongoing | |||
| Value is allowed for gState only */ | |||
| HAL_CEC_STATE_ERROR = 0x60U /*!< Error Value is allowed for gState only */ | |||
| }HAL_CEC_StateTypeDef; | |||
| typedef uint32_t HAL_CEC_StateTypeDef; | |||
| /** | |||
| * @brief CEC handle Structure definition | |||
| */ | |||
| #if (USE_HAL_CEC_REGISTER_CALLBACKS == 1) | |||
| typedef struct __CEC_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_CEC_REGISTER_CALLBACKS */ | |||
| { | |||
| CEC_TypeDef *Instance; /*!< CEC registers base address */ | |||
| @@ -207,7 +181,40 @@ typedef struct | |||
| uint32_t ErrorCode; /*!< For errors handling purposes, copy of ISR register | |||
| in case error is reported */ | |||
| }CEC_HandleTypeDef; | |||
| #if (USE_HAL_CEC_REGISTER_CALLBACKS == 1) | |||
| void (* TxCpltCallback)(struct __CEC_HandleTypeDef | |||
| *hcec); /*!< CEC Tx Transfer completed callback */ | |||
| void (* RxCpltCallback)(struct __CEC_HandleTypeDef *hcec, | |||
| uint32_t RxFrameSize); /*!< CEC Rx Transfer completed callback */ | |||
| void (* ErrorCallback)(struct __CEC_HandleTypeDef *hcec); /*!< CEC error callback */ | |||
| void (* MspInitCallback)(struct __CEC_HandleTypeDef *hcec); /*!< CEC Msp Init callback */ | |||
| void (* MspDeInitCallback)(struct __CEC_HandleTypeDef *hcec); /*!< CEC Msp DeInit callback */ | |||
| #endif /* (USE_HAL_CEC_REGISTER_CALLBACKS) */ | |||
| } CEC_HandleTypeDef; | |||
| #if (USE_HAL_CEC_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL CEC Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_CEC_TX_CPLT_CB_ID = 0x00U, /*!< CEC Tx Transfer completed callback ID */ | |||
| HAL_CEC_RX_CPLT_CB_ID = 0x01U, /*!< CEC Rx Transfer completed callback ID */ | |||
| HAL_CEC_ERROR_CB_ID = 0x02U, /*!< CEC error callback ID */ | |||
| HAL_CEC_MSPINIT_CB_ID = 0x03U, /*!< CEC Msp Init callback ID */ | |||
| HAL_CEC_MSPDEINIT_CB_ID = 0x04U /*!< CEC Msp DeInit callback ID */ | |||
| } HAL_CEC_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL CEC Callback pointer definition | |||
| */ | |||
| typedef void (*pCEC_CallbackTypeDef)(CEC_HandleTypeDef *hcec); /*!< pointer to an CEC callback function */ | |||
| typedef void (*pCEC_RxCallbackTypeDef)(CEC_HandleTypeDef *hcec, | |||
| uint32_t RxFrameSize); /*!< pointer to an Rx Transfer completed callback function */ | |||
| #endif /* USE_HAL_CEC_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -216,7 +223,25 @@ typedef struct | |||
| /** @defgroup CEC_Exported_Constants CEC Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup CEC_State_Definition CEC State Code Definition | |||
| * @{ | |||
| */ | |||
| #define HAL_CEC_STATE_RESET ((uint32_t)0x00000000) /*!< Peripheral is not yet Initialized | |||
| Value is allowed for gState and RxState */ | |||
| #define HAL_CEC_STATE_READY ((uint32_t)0x00000020) /*!< Peripheral Initialized and ready for use | |||
| Value is allowed for gState and RxState */ | |||
| #define HAL_CEC_STATE_BUSY ((uint32_t)0x00000024) /*!< an internal process is ongoing | |||
| Value is allowed for gState only */ | |||
| #define HAL_CEC_STATE_BUSY_RX ((uint32_t)0x00000022) /*!< Data Reception process is ongoing | |||
| Value is allowed for RxState only */ | |||
| #define HAL_CEC_STATE_BUSY_TX ((uint32_t)0x00000021) /*!< Data Transmission process is ongoing | |||
| Value is allowed for gState only */ | |||
| #define HAL_CEC_STATE_BUSY_RX_TX ((uint32_t)0x00000023) /*!< an internal process is ongoing | |||
| Value is allowed for gState only */ | |||
| #define HAL_CEC_STATE_ERROR ((uint32_t)0x00000050) /*!< Error Value is allowed for gState only */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CEC_Error_Code CEC Error Code | |||
| * @{ | |||
| */ | |||
| @@ -230,6 +255,9 @@ typedef struct | |||
| #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 */ | |||
| #if (USE_HAL_CEC_REGISTER_CALLBACKS == 1) | |||
| #define HAL_CEC_ERROR_INVALID_CALLBACK ((uint32_t)0x00002000U) /*!< Invalid Callback Error */ | |||
| #endif /* USE_HAL_CEC_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -395,7 +423,7 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| #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) | |||
| CEC_ISR_ARBLST|CEC_ISR_TXUDR|CEC_ISR_TXERR|CEC_ISR_TXACKE) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -426,17 +454,25 @@ typedef struct | |||
| */ | |||
| /** @brief Reset CEC handle gstate & RxState | |||
| * @param __HANDLE__: CEC handle. | |||
| * @param __HANDLE__ CEC handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_CEC_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_CEC_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->gState = HAL_CEC_STATE_RESET; \ | |||
| (__HANDLE__)->RxState = HAL_CEC_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_CEC_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->gState = HAL_CEC_STATE_RESET; \ | |||
| (__HANDLE__)->RxState = HAL_CEC_STATE_RESET; \ | |||
| } while(0) | |||
| #endif /* USE_HAL_CEC_REGISTER_CALLBACKS */ | |||
| /** @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. | |||
| * @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. | |||
| @@ -455,8 +491,8 @@ typedef struct | |||
| #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. | |||
| * @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. | |||
| @@ -476,8 +512,8 @@ typedef struct | |||
| #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. | |||
| * @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 | |||
| @@ -497,8 +533,8 @@ typedef struct | |||
| #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. | |||
| * @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 | |||
| @@ -518,8 +554,8 @@ typedef struct | |||
| #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. | |||
| * @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 | |||
| @@ -539,52 +575,52 @@ typedef struct | |||
| #define __HAL_CEC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER & (__INTERRUPT__)) | |||
| /** @brief Enables the CEC device | |||
| * @param __HANDLE__: specifies the CEC Handle. | |||
| * @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. | |||
| * @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. | |||
| * @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. | |||
| * @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. | |||
| * @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. | |||
| * @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. | |||
| * @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) | |||
| * @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) | |||
| @@ -607,6 +643,15 @@ 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); | |||
| #if (USE_HAL_CEC_REGISTER_CALLBACKS == 1) | |||
| HAL_StatusTypeDef HAL_CEC_RegisterCallback(CEC_HandleTypeDef *hcec, HAL_CEC_CallbackIDTypeDef CallbackID, | |||
| pCEC_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_CEC_UnRegisterCallback(CEC_HandleTypeDef *hcec, HAL_CEC_CallbackIDTypeDef CallbackID); | |||
| HAL_StatusTypeDef HAL_CEC_RegisterRxCpltCallback(CEC_HandleTypeDef *hcec, pCEC_RxCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_CEC_UnRegisterRxCpltCallback(CEC_HandleTypeDef *hcec); | |||
| #endif /* USE_HAL_CEC_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -615,9 +660,10 @@ void HAL_CEC_MspDeInit(CEC_HandleTypeDef *hcec); | |||
| * @{ | |||
| */ | |||
| /* 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); | |||
| 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_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); | |||
| @@ -699,24 +745,24 @@ uint32_t HAL_CEC_GetError(CEC_HandleTypeDef *hcec); | |||
| * 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. | |||
| * @param __SIZE__ CEC message size. | |||
| * @retval Test result (TRUE or FALSE). | |||
| */ | |||
| #define IS_CEC_MSGSIZE(__SIZE__) ((__SIZE__) <= 0x10) | |||
| #define IS_CEC_MSGSIZE(__SIZE__) ((__SIZE__) <= 0x10U) | |||
| /** @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. | |||
| * @param __ADDRESS__ CEC own address. | |||
| * @retval Test result (TRUE or FALSE). | |||
| */ | |||
| #define IS_CEC_OWN_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0x7FFF) | |||
| #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. | |||
| * @param __ADDRESS__ CEC initiator or logical address. | |||
| * @retval Test result (TRUE or FALSE). | |||
| */ | |||
| #define IS_CEC_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0xF) | |||
| #define IS_CEC_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0xFU) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -737,10 +783,12 @@ uint32_t HAL_CEC_GetError(CEC_HandleTypeDef *hcec); | |||
| * @} | |||
| */ | |||
| #endif /* CEC */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_CEC_H */ | |||
| #endif /* STM32H7xxHAL_CEC_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_comp.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of COMP HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_COMP_H | |||
| #define __STM32H7xx_HAL_COMP_H | |||
| #ifndef STM32H7xx_HAL_COMP_H | |||
| #define STM32H7xx_HAL_COMP_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -112,15 +94,42 @@ typedef enum | |||
| /** | |||
| * @brief COMP Handle Structure definition | |||
| */ | |||
| #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1) | |||
| typedef struct __COMP_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */ | |||
| { | |||
| COMP_TypeDef *Instance; /*!< Register base address */ | |||
| COMP_InitTypeDef Init; /*!< COMP required parameters */ | |||
| HAL_LockTypeDef Lock; /*!< Locking object */ | |||
| __IO HAL_COMP_StateTypeDef State; /*!< COMP communication state */ | |||
| __IO uint32_t ErrorCode; /*!< COMP error code */ | |||
| #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1) | |||
| void (* TriggerCallback)(struct __COMP_HandleTypeDef *hcomp); /*!< COMP trigger callback */ | |||
| void (* MspInitCallback)(struct __COMP_HandleTypeDef *hcomp); /*!< COMP Msp Init callback */ | |||
| void (* MspDeInitCallback)(struct __COMP_HandleTypeDef *hcomp); /*!< COMP Msp DeInit callback */ | |||
| #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */ | |||
| } COMP_HandleTypeDef; | |||
| #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL COMP Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_COMP_TRIGGER_CB_ID = 0x00U, /*!< COMP trigger callback ID */ | |||
| HAL_COMP_MSPINIT_CB_ID = 0x01U, /*!< COMP Msp Init callback ID */ | |||
| HAL_COMP_MSPDEINIT_CB_ID = 0x02U /*!< COMP Msp DeInit callback ID */ | |||
| } HAL_COMP_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL COMP Callback pointer definition | |||
| */ | |||
| typedef void (*pCOMP_CallbackTypeDef)(COMP_HandleTypeDef *hcomp); /*!< pointer to a COMP callback function */ | |||
| #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -129,6 +138,18 @@ typedef struct | |||
| /** @defgroup COMP_Exported_Constants COMP Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup COMP_Error_Code COMP Error Code | |||
| * @{ | |||
| */ | |||
| #define HAL_COMP_ERROR_NONE (0x00U) /*!< No error */ | |||
| #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1) | |||
| #define HAL_COMP_ERROR_INVALID_CALLBACK (0x01U) /*!< Invalid Callback error */ | |||
| #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup COMP_WindowMode COMP Window Mode | |||
| * @{ | |||
| */ | |||
| @@ -289,10 +310,25 @@ typedef struct | |||
| */ | |||
| /** @brief Reset COMP handle state. | |||
| * @param __HANDLE__ COMP handle | |||
| * @param __HANDLE__ COMP handle | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_COMP_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->State = HAL_COMP_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_COMP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_COMP_STATE_RESET) | |||
| #endif | |||
| /** | |||
| * @brief Clear COMP error code (set it to no error code "HAL_COMP_ERROR_NONE"). | |||
| * @param __HANDLE__ COMP handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_COMP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_COMP_STATE_RESET) | |||
| #define COMP_CLEAR_ERRORCODE(__HANDLE__) ((__HANDLE__)->ErrorCode = HAL_COMP_ERROR_NONE) | |||
| /** | |||
| * @brief Enable the specified comparator. | |||
| @@ -433,6 +469,44 @@ typedef struct | |||
| */ | |||
| #define __HAL_COMP_COMP1_EXTID3_DISABLE_EVENT() CLEAR_BIT(EXTI->D3PMR1, COMP_EXTI_LINE_COMP1) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Enable the COMP1 D2 EXTI line in interrupt mode. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_COMP_COMP1_EXTID2_ENABLE_IT() SET_BIT(EXTI_D2->IMR1, COMP_EXTI_LINE_COMP1) | |||
| /** | |||
| * @brief Disable the COMP1 D2 EXTI line in interrupt mode. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_COMP_COMP1_EXTID2_DISABLE_IT() CLEAR_BIT(EXTI_D2->IMR1, COMP_EXTI_LINE_COMP1) | |||
| /** | |||
| * @brief Enable the COMP1 D2 EXTI Line in event mode. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_COMP_COMP1_EXTID2_ENABLE_EVENT() SET_BIT(EXTI_D2->EMR1, COMP_EXTI_LINE_COMP1) | |||
| /** | |||
| * @brief Disable the COMP1 D2 EXTI Line in event mode. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_COMP_COMP1_EXTID2_DISABLE_EVENT() CLEAR_BIT(EXTI_D2->EMR1, COMP_EXTI_LINE_COMP1) | |||
| /** | |||
| * @brief Check whether the COMP1 D2 EXTI line flag is set or not. | |||
| * @retval RESET or SET | |||
| */ | |||
| #define __HAL_COMP_COMP1_EXTID2_GET_FLAG() READ_BIT(EXTI_D2->PR1, COMP_EXTI_LINE_COMP1) | |||
| /** | |||
| * @brief Clear the COMP1 D2 EXTI flag. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_COMP_COMP1_EXTID2_CLEAR_FLAG() WRITE_REG(EXTI_D2->PR1, COMP_EXTI_LINE_COMP1) | |||
| #endif | |||
| /** | |||
| * @brief Enable the COMP2 EXTI line rising edge trigger. | |||
| @@ -529,6 +603,50 @@ typedef struct | |||
| */ | |||
| #define __HAL_COMP_COMP2_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER1, COMP_EXTI_LINE_COMP2) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Enable the COMP2 D2 EXTI line | |||
| * @retval None | |||
| */ | |||
| #define __HAL_COMP_COMP2_EXTID2_ENABLE_IT() SET_BIT(EXTI_D2->IMR1, COMP_EXTI_LINE_COMP2) | |||
| /** | |||
| * @brief Disable the COMP2 D2 EXTI line. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_COMP_COMP2_EXTID2_DISABLE_IT() CLEAR_BIT(EXTI_D2->IMR1, COMP_EXTI_LINE_COMP2) | |||
| /** | |||
| * @brief Enable the COMP2 D2 EXTI Line in event mode. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_COMP_COMP2_EXTID2_ENABLE_EVENT() SET_BIT(EXTI_D2->EMR1, COMP_EXTI_LINE_COMP2) | |||
| /** | |||
| * @brief Disable the COMP2 D2 EXTI Line in event mode. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_COMP_COMP2_EXTID2_DISABLE_EVENT() CLEAR_BIT(EXTI_D2->EMR1, COMP_EXTI_LINE_COMP2) | |||
| /** | |||
| * @brief Check whether the COMP2 D2 EXTI line flag is set or not. | |||
| * @retval RESET or SET | |||
| */ | |||
| #define __HAL_COMP_COMP2_EXTID2_GET_FLAG() READ_BIT(EXTI_D2->PR1, COMP_EXTI_LINE_COMP2) | |||
| /** | |||
| * @brief Clear the the COMP2 D2 EXTI flag. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_COMP_COMP2_EXTID2_CLEAR_FLAG() WRITE_REG(EXTI_D2->PR1, COMP_EXTI_LINE_COMP2) | |||
| #endif | |||
| /** @brief Checks if the specified COMP interrupt source is enabled or disabled. | |||
| * @param __HANDLE__: specifies the COMP Handle. | |||
| * This parameter can be COMP1 where x: 1 or 2 to select the COMP peripheral. | |||
| @@ -747,6 +865,11 @@ HAL_StatusTypeDef HAL_COMP_Init(COMP_HandleTypeDef *hcomp); | |||
| HAL_StatusTypeDef HAL_COMP_DeInit (COMP_HandleTypeDef *hcomp); | |||
| void HAL_COMP_MspInit(COMP_HandleTypeDef *hcomp); | |||
| void HAL_COMP_MspDeInit(COMP_HandleTypeDef *hcomp); | |||
| #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1) | |||
| /* Callbacks Register/UnRegister functions ***********************************/ | |||
| HAL_StatusTypeDef HAL_COMP_RegisterCallback(COMP_HandleTypeDef *hcomp, HAL_COMP_CallbackIDTypeDef CallbackID, pCOMP_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_COMP_UnRegisterCallback(COMP_HandleTypeDef *hcomp, HAL_COMP_CallbackIDTypeDef CallbackID); | |||
| #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -782,6 +905,7 @@ void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp); | |||
| * @{ | |||
| */ | |||
| HAL_COMP_StateTypeDef HAL_COMP_GetState(COMP_HandleTypeDef *hcomp); | |||
| uint32_t HAL_COMP_GetError(COMP_HandleTypeDef *hcomp); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -802,6 +926,6 @@ HAL_COMP_StateTypeDef HAL_COMP_GetState(COMP_HandleTypeDef *hcomp); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_COMP_H */ | |||
| #endif /* STM32H7xx_HAL_COMP_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,44 +2,26 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_conf_template.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief HAL configuration template file. | |||
| * This file should be copied to the application folder and renamed | |||
| * to stm32h7xx_hal_conf.h. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_CONF_H | |||
| #define __STM32H7xx_HAL_CONF_H | |||
| #ifndef STM32H7xx_HAL_CONF_H | |||
| #define STM32H7xx_HAL_CONF_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -64,7 +46,9 @@ | |||
| #define HAL_DFSDM_MODULE_ENABLED | |||
| #define HAL_DMA_MODULE_ENABLED | |||
| #define HAL_DMA2D_MODULE_ENABLED | |||
| #define HAL_DSI_MODULE_ENABLED | |||
| #define HAL_ETH_MODULE_ENABLED | |||
| #define HAL_EXTI_MODULE_ENABLED | |||
| #define HAL_FDCAN_MODULE_ENABLED | |||
| #define HAL_FLASH_MODULE_ENABLED | |||
| #define HAL_GPIO_MODULE_ENABLED | |||
| @@ -88,6 +72,7 @@ | |||
| #define HAL_PCD_MODULE_ENABLED | |||
| #define HAL_PWR_MODULE_ENABLED | |||
| #define HAL_QSPI_MODULE_ENABLED | |||
| #define HAL_RAMECC_MODULE_ENABLED | |||
| #define HAL_RCC_MODULE_ENABLED | |||
| #define HAL_RNG_MODULE_ENABLED | |||
| #define HAL_RTC_MODULE_ENABLED | |||
| @@ -149,6 +134,12 @@ | |||
| #define LSE_STARTUP_TIMEOUT ((uint32_t)5000) /*!< Time out for LSE start up, in ms */ | |||
| #endif /* LSE_STARTUP_TIMEOUT */ | |||
| #if !defined (LSI_VALUE) | |||
| #define LSI_VALUE ((uint32_t)32000) /*!< 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 clock source for I2S peripheral | |||
| * This value is used by the I2S HAL module to compute the I2S clock source | |||
| @@ -170,6 +161,43 @@ | |||
| #define USE_RTOS 0 | |||
| #define USE_SD_TRANSCEIVER 1U /*!< use uSD Transceiver */ | |||
| #define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */ | |||
| #define USE_HAL_CEC_REGISTER_CALLBACKS 0U /* CEC register callback disabled */ | |||
| #define USE_HAL_COMP_REGISTER_CALLBACKS 0U /* COMP register callback disabled */ | |||
| #define USE_HAL_CRYP_REGISTER_CALLBACKS 0U /* CRYP register callback disabled */ | |||
| #define USE_HAL_DAC_REGISTER_CALLBACKS 0U /* DAC register callback disabled */ | |||
| #define USE_HAL_DCMI_REGISTER_CALLBACKS 0U /* DCMI register callback disabled */ | |||
| #define USE_HAL_DFSDM_REGISTER_CALLBACKS 0U /* DFSDM register callback disabled */ | |||
| #define USE_HAL_DMA2D_REGISTER_CALLBACKS 0U /* DMA2D register callback disabled */ | |||
| #define USE_HAL_DSI_REGISTER_CALLBACKS 0U /* DSI register callback disabled */ | |||
| #define USE_HAL_ETH_REGISTER_CALLBACKS 0U /* ETH register callback disabled */ | |||
| #define USE_HAL_FDCAN_REGISTER_CALLBACKS 0U /* FDCAN register callback disabled */ | |||
| #define USE_HAL_NAND_REGISTER_CALLBACKS 0U /* NAND register callback disabled */ | |||
| #define USE_HAL_NOR_REGISTER_CALLBACKS 0U /* NOR register callback disabled */ | |||
| #define USE_HAL_SDRAM_REGISTER_CALLBACKS 0U /* SDRAM register callback disabled */ | |||
| #define USE_HAL_SRAM_REGISTER_CALLBACKS 0U /* SRAM register callback disabled */ | |||
| #define USE_HAL_HASH_REGISTER_CALLBACKS 0U /* HASH register callback disabled */ | |||
| #define USE_HAL_HCD_REGISTER_CALLBACKS 0U /* HCD register callback disabled */ | |||
| #define USE_HAL_HRTIM_REGISTER_CALLBACKS 0U /* HRTIM register callback disabled */ | |||
| #define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ | |||
| #define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ | |||
| #define USE_HAL_JPEG_REGISTER_CALLBACKS 0U /* JPEG register callback disabled */ | |||
| #define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */ | |||
| #define USE_HAL_LTDC_REGISTER_CALLBACKS 0U /* LTDC register callback disabled */ | |||
| #define USE_HAL_MDIOS_REGISTER_CALLBACKS 0U /* MDIO register callback disabled */ | |||
| #define USE_HAL_OPAMP_REGISTER_CALLBACKS 0U /* MDIO register callback disabled */ | |||
| #define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */ | |||
| #define USE_HAL_QSPI_REGISTER_CALLBACKS 0U /* QSPI register callback disabled */ | |||
| #define USE_HAL_RNG_REGISTER_CALLBACKS 0U /* RNG register callback disabled */ | |||
| #define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */ | |||
| #define USE_HAL_SAI_REGISTER_CALLBACKS 0U /* SAI register callback disabled */ | |||
| #define USE_HAL_SPDIFRX_REGISTER_CALLBACKS 0U /* SPDIFRX register callback disabled */ | |||
| #define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U /* SMBUS register callback disabled */ | |||
| #define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */ | |||
| #define USE_HAL_SWPMI_REGISTER_CALLBACKS 0U /* SWPMI register callback disabled */ | |||
| #define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */ | |||
| #define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */ | |||
| /* ########################### Ethernet Configuration ######################### */ | |||
| #define ETH_TX_DESC_CNT 4 /* number of Ethernet Tx DMA descriptors */ | |||
| #define ETH_RX_DESC_CNT 4 /* number of Ethernet Rx DMA descriptors */ | |||
| @@ -188,15 +216,6 @@ | |||
| */ | |||
| /* #define USE_FULL_ASSERT 1 */ | |||
| /* ################## SPI peripheral configuration ########################## */ | |||
| /** | |||
| * @brief Used to activate CRC feature inside HAL SPI Driver | |||
| * Activated (1U): CRC code is compiled within HAL SPI driver | |||
| * Deactivated (0U): CRC code excluded from HAL SPI driver | |||
| */ | |||
| #define USE_SPI_CRC 1U | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| /** | |||
| @@ -215,6 +234,10 @@ | |||
| #include "stm32h7xx_hal_dma.h" | |||
| #endif /* HAL_DMA_MODULE_ENABLED */ | |||
| #ifdef HAL_MDMA_MODULE_ENABLED | |||
| #include "stm32h7xx_hal_mdma.h" | |||
| #endif /* HAL_MDMA_MODULE_ENABLED */ | |||
| #ifdef HAL_HASH_MODULE_ENABLED | |||
| #include "stm32h7xx_hal_hash.h" | |||
| #endif /* HAL_HASH_MODULE_ENABLED */ | |||
| @@ -227,6 +250,10 @@ | |||
| #include "stm32h7xx_hal_dma2d.h" | |||
| #endif /* HAL_DMA2D_MODULE_ENABLED */ | |||
| #ifdef HAL_DSI_MODULE_ENABLED | |||
| #include "stm32h7xx_hal_dsi.h" | |||
| #endif /* HAL_DSI_MODULE_ENABLED */ | |||
| #ifdef HAL_DFSDM_MODULE_ENABLED | |||
| #include "stm32h7xx_hal_dfsdm.h" | |||
| #endif /* HAL_DFSDM_MODULE_ENABLED */ | |||
| @@ -235,6 +262,10 @@ | |||
| #include "stm32h7xx_hal_eth.h" | |||
| #endif /* HAL_ETH_MODULE_ENABLED */ | |||
| #ifdef HAL_EXTI_MODULE_ENABLED | |||
| #include "stm32h7xx_hal_exti.h" | |||
| #endif /* HAL_EXTI_MODULE_ENABLED */ | |||
| #ifdef HAL_CORTEX_MODULE_ENABLED | |||
| #include "stm32h7xx_hal_cortex.h" | |||
| #endif /* HAL_CORTEX_MODULE_ENABLED */ | |||
| @@ -311,10 +342,6 @@ | |||
| #include "stm32h7xx_hal_mdios.h" | |||
| #endif /* HAL_MDIOS_MODULE_ENABLED */ | |||
| #ifdef HAL_MDMA_MODULE_ENABLED | |||
| #include "stm32h7xx_hal_mdma.h" | |||
| #endif /* HAL_MDMA_MODULE_ENABLED */ | |||
| #ifdef HAL_MMC_MODULE_ENABLED | |||
| #include "stm32h7xx_hal_mmc.h" | |||
| #endif /* HAL_MMC_MODULE_ENABLED */ | |||
| @@ -339,6 +366,10 @@ | |||
| #include "stm32h7xx_hal_qspi.h" | |||
| #endif /* HAL_QSPI_MODULE_ENABLED */ | |||
| #ifdef HAL_RAMECC_MODULE_ENABLED | |||
| #include "stm32h7xx_hal_ramecc.h" | |||
| #endif /* HAL_HCD_MODULE_ENABLED */ | |||
| #ifdef HAL_RNG_MODULE_ENABLED | |||
| #include "stm32h7xx_hal_rng.h" | |||
| #endif /* HAL_RNG_MODULE_ENABLED */ | |||
| @@ -417,18 +448,18 @@ | |||
| * If expr is true, it returns no value. | |||
| * @retval None | |||
| */ | |||
| #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) | |||
| #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) | |||
| /* Exported functions ------------------------------------------------------- */ | |||
| void assert_failed(uint8_t* file, uint32_t line); | |||
| void assert_failed(uint8_t *file, uint32_t line); | |||
| #else | |||
| #define assert_param(expr) ((void)0) | |||
| #define assert_param(expr) ((void)0U) | |||
| #endif /* USE_FULL_ASSERT */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_CONF_H */ | |||
| #endif /* STM32H7xx_HAL_CONF_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_cortex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of CORTEX HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_CORTEX_H | |||
| #define __STM32H7xx_HAL_CORTEX_H | |||
| #ifndef STM32H7xx_HAL_CORTEX_H | |||
| #define STM32H7xx_HAL_CORTEX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -255,6 +237,17 @@ typedef struct | |||
| #define MPU_REGION_NUMBER5 ((uint8_t)0x05) | |||
| #define MPU_REGION_NUMBER6 ((uint8_t)0x06) | |||
| #define MPU_REGION_NUMBER7 ((uint8_t)0x07) | |||
| #if !defined(CORE_CM4) | |||
| #define MPU_REGION_NUMBER8 ((uint8_t)0x08) | |||
| #define MPU_REGION_NUMBER9 ((uint8_t)0x09) | |||
| #define MPU_REGION_NUMBER10 ((uint8_t)0x0A) | |||
| #define MPU_REGION_NUMBER11 ((uint8_t)0x0B) | |||
| #define MPU_REGION_NUMBER12 ((uint8_t)0x0C) | |||
| #define MPU_REGION_NUMBER13 ((uint8_t)0x0D) | |||
| #define MPU_REGION_NUMBER14 ((uint8_t)0x0E) | |||
| #define MPU_REGION_NUMBER15 ((uint8_t)0x0F) | |||
| #endif /* !defined(CORE_CM4) */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -279,8 +272,11 @@ typedef struct | |||
| /** @defgroup CORTEX_CPU_Identifier CORTEX_CPU_Identifier | |||
| * @{ | |||
| */ | |||
| #define CM7_CPUID (uint32_t)0x00000003 | |||
| #define CM7_CPUID ((uint32_t)0x00000003) | |||
| #if defined(DUAL_CORE) | |||
| #define CM4_CPUID ((uint32_t)0x00000001) | |||
| #endif /*DUAL_CORE*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -310,6 +306,8 @@ uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb); | |||
| */ | |||
| /* Peripheral Control functions ***********************************************/ | |||
| #if (__MPU_PRESENT == 1) | |||
| void HAL_MPU_Enable(uint32_t MPU_Control); | |||
| void HAL_MPU_Disable(void); | |||
| void HAL_MPU_ConfigRegion(MPU_Region_InitTypeDef *MPU_Init); | |||
| #endif /* __MPU_PRESENT */ | |||
| uint32_t HAL_NVIC_GetPriorityGrouping(void); | |||
| @@ -345,11 +343,11 @@ uint32_t HAL_GetCurrentCPUID(void); | |||
| ((GROUP) == NVIC_PRIORITYGROUP_3) || \ | |||
| ((GROUP) == NVIC_PRIORITYGROUP_4)) | |||
| #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10) | |||
| #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10UL) | |||
| #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10) | |||
| #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10UL) | |||
| #define IS_NVIC_DEVICE_IRQ(IRQ) ((IRQ) >= 0x00) | |||
| #define IS_NVIC_DEVICE_IRQ(IRQ) (((int32_t)IRQ) >= 0x00) | |||
| #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SYSTICK_CLKSOURCE_HCLK) || \ | |||
| ((SOURCE) == SYSTICK_CLKSOURCE_HCLK_DIV8)) | |||
| @@ -381,14 +379,33 @@ uint32_t HAL_GetCurrentCPUID(void); | |||
| ((TYPE) == MPU_REGION_PRIV_RO) || \ | |||
| ((TYPE) == MPU_REGION_PRIV_RO_URO)) | |||
| #define IS_MPU_REGION_NUMBER(NUMBER) (((NUMBER) == MPU_REGION_NUMBER0) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER1) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER2) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER3) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER4) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER5) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER6) || \ | |||
| #if !defined(CORE_CM4) | |||
| #define IS_MPU_REGION_NUMBER(NUMBER) (((NUMBER) == MPU_REGION_NUMBER0) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER1) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER2) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER3) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER4) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER5) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER6) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER7) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER8) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER9) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER10) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER11) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER12) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER13) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER14) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER15)) | |||
| #else | |||
| #define IS_MPU_REGION_NUMBER(NUMBER) (((NUMBER) == MPU_REGION_NUMBER0) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER1) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER2) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER3) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER4) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER5) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER6) || \ | |||
| ((NUMBER) == MPU_REGION_NUMBER7)) | |||
| #endif /* !defined(CORE_CM4) */ | |||
| #define IS_MPU_REGION_SIZE(SIZE) (((SIZE) == MPU_REGION_SIZE_32B) || \ | |||
| ((SIZE) == MPU_REGION_SIZE_64B) || \ | |||
| @@ -422,51 +439,6 @@ uint32_t HAL_GetCurrentCPUID(void); | |||
| #define IS_MPU_SUB_REGION_DISABLE(SUBREGION) ((SUBREGION) < (uint16_t)0x00FF) | |||
| #endif /* __MPU_PRESENT */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup CORTEX_Private_Functions CORTEX Private Functions | |||
| * @brief CORTEX private functions | |||
| * @{ | |||
| */ | |||
| #if (__MPU_PRESENT == 1) | |||
| /** | |||
| * @brief Disables the MPU | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void HAL_MPU_Disable(void) | |||
| { | |||
| /* Disable fault exceptions */ | |||
| SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk; | |||
| /* Disable the MPU */ | |||
| MPU->CTRL &= ~MPU_CTRL_ENABLE_Msk; | |||
| } | |||
| /** | |||
| * @brief Enables the MPU | |||
| * @param MPU_Control: Specifies the control mode of the MPU during hard fault, | |||
| * NMI, FAULTMASK and privileged access to the default memory | |||
| * This parameter can be one of the following values: | |||
| * @arg MPU_HFNMI_PRIVDEF_NONE | |||
| * @arg MPU_HARDFAULT_NMI | |||
| * @arg MPU_PRIVILEGED_DEFAULT | |||
| * @arg MPU_HFNMI_PRIVDEF | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void HAL_MPU_Enable(uint32_t MPU_Control) | |||
| { | |||
| /* Enable the MPU */ | |||
| MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk; | |||
| /* Enable fault exceptions */ | |||
| SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; | |||
| } | |||
| #endif /* __MPU_PRESENT */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -483,7 +455,7 @@ __STATIC_INLINE void HAL_MPU_Enable(uint32_t MPU_Control) | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_CORTEX_H */ | |||
| #endif /* STM32H7xx_HAL_CORTEX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_crc.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of CRC HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_CRC_H | |||
| #define __STM32H7xx_HAL_CRC_H | |||
| #ifndef STM32H7xx_HAL_CRC_H | |||
| #define STM32H7xx_HAL_CRC_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -50,8 +32,7 @@ | |||
| * @{ | |||
| */ | |||
| /** @addtogroup CRC CRC | |||
| * @brief CRC HAL module driver | |||
| /** @addtogroup CRC | |||
| * @{ | |||
| */ | |||
| @@ -60,8 +41,8 @@ | |||
| * @{ | |||
| */ | |||
| /** @defgroup CRC_Exported_Types_Group1 CRC State Structure definition | |||
| * @{ | |||
| /** | |||
| * @brief CRC HAL State Structure definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| @@ -70,13 +51,10 @@ typedef enum | |||
| 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; | |||
| /** | |||
| * @} | |||
| */ | |||
| } HAL_CRC_StateTypeDef; | |||
| /** @defgroup CRC_Exported_Types_Group2 CRC Init Structure definition | |||
| * @{ | |||
| /** | |||
| * @brief CRC Init Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| @@ -84,46 +62,43 @@ typedef struct | |||
| If set to DEFAULT_POLYNOMIAL_ENABLE, resort to default | |||
| X^32 + X^26 + X^23 + X^22 + X^16 + X^12 + X^11 + X^10 +X^8 + X^7 + X^5 + X^4 + X^2+ X +1. | |||
| In that case, there is no need to set GeneratingPolynomial field. | |||
| If otherwise set to DEFAULT_POLYNOMIAL_DISABLE, GeneratingPolynomial and CRCLength fields must be set */ | |||
| If otherwise set to DEFAULT_POLYNOMIAL_DISABLE, GeneratingPolynomial and CRCLength fields must be set. */ | |||
| uint8_t DefaultInitValueUse; /*!< This parameter is a value of @ref CRC_Default_InitValue_Use and indicates if default init value is used. | |||
| If set to DEFAULT_INIT_VALUE_ENABLE, resort to default | |||
| 0xFFFFFFFF value. In that case, there is no need to set InitValue field. | |||
| If otherwise set to DEFAULT_INIT_VALUE_DISABLE, InitValue field must be set */ | |||
| If otherwise set to DEFAULT_INIT_VALUE_DISABLE, InitValue field must be set. */ | |||
| uint32_t GeneratingPolynomial; /*!< Set CRC generating polynomial. 7, 8, 16 or 32-bit long value for a polynomial degree | |||
| uint32_t GeneratingPolynomial; /*!< Set CRC generating polynomial as a 7, 8, 16 or 32-bit long value for a polynomial degree | |||
| respectively equal to 7, 8, 16 or 32. This field is written in normal representation, | |||
| e.g., for a polynomial of degree 7, X^7 + X^6 + X^5 + X^2 + 1 is written 0x65. | |||
| No need to specify it if DefaultPolynomialUse is set to DEFAULT_POLYNOMIAL_ENABLE */ | |||
| No need to specify it if DefaultPolynomialUse is set to DEFAULT_POLYNOMIAL_ENABLE. */ | |||
| uint32_t CRCLength; /*!< This parameter is a value of @ref CRC_Polynomial_Sizes and indicates CRC length. | |||
| Value can be either one of | |||
| CRC_POLYLENGTH_32B (32-bit CRC) | |||
| CRC_POLYLENGTH_16B (16-bit CRC) | |||
| CRC_POLYLENGTH_8B (8-bit CRC) | |||
| CRC_POLYLENGTH_7B (7-bit CRC) */ | |||
| @arg @ref CRC_POLYLENGTH_32B (32-bit CRC), | |||
| @arg @ref CRC_POLYLENGTH_16B (16-bit CRC), | |||
| @arg @ref CRC_POLYLENGTH_8B (8-bit CRC), | |||
| @arg @ref CRC_POLYLENGTH_7B (7-bit CRC). */ | |||
| uint32_t InitValue; /*!< Init value to initiate CRC computation. No need to specify it if DefaultInitValueUse | |||
| is set to DEFAULT_INIT_VALUE_ENABLE */ | |||
| is set to DEFAULT_INIT_VALUE_ENABLE. */ | |||
| uint32_t InputDataInversionMode; /*!< This parameter is a value of @ref CRCEx_Input_Data_Inversion and specifies input data inversion mode. | |||
| Can be either one of the following values | |||
| CRC_INPUTDATA_INVERSION_NONE no input data inversion | |||
| CRC_INPUTDATA_INVERSION_BYTE byte-wise inversion, 0x1A2B3C4D becomes 0x58D43CB2 | |||
| CRC_INPUTDATA_INVERSION_HALFWORD halfword-wise inversion, 0x1A2B3C4D becomes 0xD458B23C | |||
| CRC_INPUTDATA_INVERSION_WORD word-wise inversion, 0x1A2B3C4D becomes 0xB23CD458 */ | |||
| @arg @ref CRC_INPUTDATA_INVERSION_NONE no input data inversion | |||
| @arg @ref CRC_INPUTDATA_INVERSION_BYTE byte-wise inversion, 0x1A2B3C4D becomes 0x58D43CB2 | |||
| @arg @ref CRC_INPUTDATA_INVERSION_HALFWORD halfword-wise inversion, 0x1A2B3C4D becomes 0xD458B23C | |||
| @arg @ref CRC_INPUTDATA_INVERSION_WORD word-wise inversion, 0x1A2B3C4D becomes 0xB23CD458 */ | |||
| uint32_t OutputDataInversionMode; /*!< This parameter is a value of @ref CRCEx_Output_Data_Inversion and specifies output data (i.e. CRC) inversion mode. | |||
| Can be either | |||
| CRC_OUTPUTDATA_INVERSION_DISABLE no CRC inversion, or | |||
| CRC_OUTPUTDATA_INVERSION_ENABLE CRC 0x11223344 is converted into 0x22CC4488 */ | |||
| }CRC_InitTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| @arg @ref CRC_OUTPUTDATA_INVERSION_DISABLE no CRC inversion, | |||
| @arg @ref CRC_OUTPUTDATA_INVERSION_ENABLE CRC 0x11223344 is converted into 0x22CC4488 */ | |||
| } CRC_InitTypeDef; | |||
| /** @defgroup CRC_Exported_Types_Group3 CRC Handle Structure definition | |||
| * @{ | |||
| /** | |||
| * @brief CRC Handle Structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| @@ -137,30 +112,26 @@ typedef struct | |||
| uint32_t InputDataFormat; /*!< This parameter is a value of @ref CRC_Input_Buffer_Format and specifies input data format. | |||
| Can be either | |||
| CRC_INPUTDATA_FORMAT_BYTES input data is a stream of bytes (8-bit data) | |||
| CRC_INPUTDATA_FORMAT_HALFWORDS input data is a stream of half-words (16-bit data) | |||
| CRC_INPUTDATA_FORMAT_WORDS input data is a stream of words (32-bits data) | |||
| @arg @ref CRC_INPUTDATA_FORMAT_BYTES input data is a stream of bytes (8-bit data) | |||
| @arg @ref CRC_INPUTDATA_FORMAT_HALFWORDS input data is a stream of half-words (16-bit data) | |||
| @arg @ref CRC_INPUTDATA_FORMAT_WORDS input data is a stream of words (32-bit data) | |||
| Note that constant CRC_INPUT_FORMAT_UNDEFINED is defined but an initialization error | |||
| must occur if InputBufferFormat is not one of the three values listed above */ | |||
| }CRC_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| } CRC_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup CRC_Exported_Constants CRC exported constants | |||
| /** @defgroup CRC_Exported_Constants CRC Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup CRC_Default_Polynomial_Value Default CRC generating polynomial | |||
| * @{ | |||
| */ | |||
| #define DEFAULT_CRC32_POLY 0x04C11DB7U | |||
| #define DEFAULT_CRC32_POLY 0x04C11DB7U /*!< X^32 + X^26 + X^23 + X^22 + X^16 + X^12 + X^11 + X^10 +X^8 + X^7 + X^5 + X^4 + X^2+ X +1 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -168,8 +139,7 @@ typedef struct | |||
| /** @defgroup CRC_Default_InitValue Default CRC computation initialization value | |||
| * @{ | |||
| */ | |||
| #define DEFAULT_CRC_INITVALUE 0xFFFFFFFFU | |||
| #define DEFAULT_CRC_INITVALUE 0xFFFFFFFFU /*!< Initial CRC default value */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -177,10 +147,8 @@ typedef struct | |||
| /** @defgroup CRC_Default_Polynomial Indicates whether or not default polynomial is used | |||
| * @{ | |||
| */ | |||
| #define DEFAULT_POLYNOMIAL_ENABLE ((uint8_t)0x00U) | |||
| #define DEFAULT_POLYNOMIAL_DISABLE ((uint8_t)0x01U) | |||
| #define DEFAULT_POLYNOMIAL_ENABLE ((uint8_t)0x00U) /*!< Enable default generating polynomial 0x04C11DB7 */ | |||
| #define DEFAULT_POLYNOMIAL_DISABLE ((uint8_t)0x01U) /*!< Disable default generating polynomial 0x04C11DB7 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -188,20 +156,19 @@ typedef struct | |||
| /** @defgroup CRC_Default_InitValue_Use Indicates whether or not default init value is used | |||
| * @{ | |||
| */ | |||
| #define DEFAULT_INIT_VALUE_ENABLE ((uint8_t)0x00U) | |||
| #define DEFAULT_INIT_VALUE_DISABLE ((uint8_t)0x01U) | |||
| #define DEFAULT_INIT_VALUE_ENABLE ((uint8_t)0x00U) /*!< Enable initial CRC default value */ | |||
| #define DEFAULT_INIT_VALUE_DISABLE ((uint8_t)0x01U) /*!< Disable initial CRC default value */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CRC_Polynomial_Sizes Polynomial sizes to configure the IP | |||
| /** @defgroup CRC_Polynomial_Sizes Polynomial sizes to configure the peripheral | |||
| * @{ | |||
| */ | |||
| #define CRC_POLYLENGTH_32B ((uint32_t)0x00000000U) | |||
| #define CRC_POLYLENGTH_16B ((uint32_t)CRC_CR_POLYSIZE_0) | |||
| #define CRC_POLYLENGTH_8B ((uint32_t)CRC_CR_POLYSIZE_1) | |||
| #define CRC_POLYLENGTH_7B ((uint32_t)CRC_CR_POLYSIZE) | |||
| #define CRC_POLYLENGTH_32B 0x00000000U /*!< Resort to a 32-bit long generating polynomial */ | |||
| #define CRC_POLYLENGTH_16B CRC_CR_POLYSIZE_0 /*!< Resort to a 16-bit long generating polynomial */ | |||
| #define CRC_POLYLENGTH_8B CRC_CR_POLYSIZE_1 /*!< Resort to a 8-bit long generating polynomial */ | |||
| #define CRC_POLYLENGTH_7B CRC_CR_POLYSIZE /*!< Resort to a 7-bit long generating polynomial */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -209,26 +176,34 @@ typedef struct | |||
| /** @defgroup CRC_Polynomial_Size_Definitions CRC polynomial possible sizes actual definitions | |||
| * @{ | |||
| */ | |||
| #define HAL_CRC_LENGTH_32B 32U | |||
| #define HAL_CRC_LENGTH_16B 16U | |||
| #define HAL_CRC_LENGTH_8B 8U | |||
| #define HAL_CRC_LENGTH_7B 7U | |||
| #define HAL_CRC_LENGTH_32B 32U /*!< 32-bit long CRC */ | |||
| #define HAL_CRC_LENGTH_16B 16U /*!< 16-bit long CRC */ | |||
| #define HAL_CRC_LENGTH_8B 8U /*!< 8-bit long CRC */ | |||
| #define HAL_CRC_LENGTH_7B 7U /*!< 7-bit long CRC */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CRC_Input_Buffer_Format CRC input buffer format | |||
| /** @defgroup CRC_Input_Buffer_Format Input Buffer Format | |||
| * @{ | |||
| */ | |||
| /* WARNING: CRC_INPUT_FORMAT_UNDEFINED is created for reference purposes but | |||
| * an error is triggered in HAL_CRC_Init() if InputDataFormat field is set | |||
| * to CRC_INPUT_FORMAT_UNDEFINED: the format MUST be defined by the user for | |||
| * the CRC APIs to provide a correct result */ | |||
| #define CRC_INPUTDATA_FORMAT_UNDEFINED ((uint32_t)0x00000000U) | |||
| #define CRC_INPUTDATA_FORMAT_BYTES ((uint32_t)0x00000001U) | |||
| #define CRC_INPUTDATA_FORMAT_HALFWORDS ((uint32_t)0x00000002U) | |||
| #define CRC_INPUTDATA_FORMAT_WORDS ((uint32_t)0x00000003U) | |||
| #define CRC_INPUTDATA_FORMAT_UNDEFINED 0x00000000U /*!< Undefined input data format */ | |||
| #define CRC_INPUTDATA_FORMAT_BYTES 0x00000001U /*!< Input data in byte format */ | |||
| #define CRC_INPUTDATA_FORMAT_HALFWORDS 0x00000002U /*!< Input data in half-word format */ | |||
| #define CRC_INPUTDATA_FORMAT_WORDS 0x00000003U /*!< Input data in word format */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CRC_Aliases CRC API aliases | |||
| * @{ | |||
| */ | |||
| #define HAL_CRC_Input_Data_Reverse HAL_CRCEx_Input_Data_Reverse /*!< Aliased to HAL_CRCEx_Input_Data_Reverse for inter STM32 series compatibility */ | |||
| #define HAL_CRC_Output_Data_Reverse HAL_CRCEx_Output_Data_Reverse /*!< Aliased to HAL_CRCEx_Output_Data_Reverse for inter STM32 series compatibility */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -236,45 +211,47 @@ typedef struct | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macros -----------------------------------------------------------*/ | |||
| /** @defgroup CRC_Exported_Macros CRC exported macros | |||
| /* Exported macros -----------------------------------------------------------*/ | |||
| /** @defgroup CRC_Exported_Macros CRC Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset CRC handle state | |||
| * @param __HANDLE__: CRC handle. | |||
| /** @brief Reset CRC handle state. | |||
| * @param __HANDLE__ CRC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_CRC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CRC_STATE_RESET) | |||
| /** | |||
| * @brief Reset CRC Data Register. | |||
| * @param __HANDLE__: CRC handle | |||
| * @retval None. | |||
| * @param __HANDLE__ CRC handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_CRC_DR_RESET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_RESET) | |||
| /** | |||
| * @brief Set CRC INIT non-default value | |||
| * @param __HANDLE__ : CRC handle | |||
| * @param __INIT__ : 32-bit initial value | |||
| * @retval None. | |||
| * @param __HANDLE__ CRC handle | |||
| * @param __INIT__ 32-bit initial value | |||
| * @retval None | |||
| */ | |||
| #define __HAL_CRC_INITIALCRCVALUE_CONFIG(__HANDLE__, __INIT__) ((__HANDLE__)->Instance->INIT = (__INIT__)) | |||
| /** | |||
| * @brief Stores a 32-bit data in the Independent Data(ID) register. | |||
| * @param __HANDLE__: CRC handle | |||
| * @param __VALUE__: 32-bit value to be stored in the ID register | |||
| * @brief Store data in the Independent Data (ID) register. | |||
| * @param __HANDLE__ CRC handle | |||
| * @param __VALUE__ Value to be stored in the ID register | |||
| * @note Refer to the Reference Manual to get the authorized __VALUE__ length in bits | |||
| * @retval None | |||
| */ | |||
| #define __HAL_CRC_SET_IDR(__HANDLE__, __VALUE__) (WRITE_REG((__HANDLE__)->Instance->IDR, (__VALUE__))) | |||
| /** | |||
| * @brief Returns the 32-bit data stored in the Independent Data(ID) register. | |||
| * @param __HANDLE__: CRC handle | |||
| * @retval 32-bit value of the ID register | |||
| * @brief Return the data stored in the Independent Data (ID) register. | |||
| * @param __HANDLE__ CRC handle | |||
| * @note Refer to the Reference Manual to get the authorized __VALUE__ length in bits | |||
| * @retval Value of the ID register | |||
| */ | |||
| #define __HAL_CRC_GET_IDR(__HANDLE__) (((__HANDLE__)->Instance->IDR) & CRC_IDR_IDR) | |||
| /** | |||
| @@ -282,125 +259,70 @@ typedef struct | |||
| */ | |||
| /* Include CRC HAL Extension module */ | |||
| #include "stm32h7xx_hal_crc_ex.h" | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @defgroup CRC_Exported_Functions CRC Exported Functions | |||
| /* Private macros --------------------------------------------------------*/ | |||
| /** @defgroup CRC_Private_Macros CRC Private Macros | |||
| * @{ | |||
| */ | |||
| /** @defgroup CRC_Exported_Functions_Group1 Initialization/de-initialization functions | |||
| * @{ | |||
| */ | |||
| /* 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); | |||
| /** | |||
| * @} | |||
| */ | |||
| #define IS_DEFAULT_POLYNOMIAL(DEFAULT) (((DEFAULT) == DEFAULT_POLYNOMIAL_ENABLE) || \ | |||
| ((DEFAULT) == DEFAULT_POLYNOMIAL_DISABLE)) | |||
| /* Aliases for inter STM32 series compatibility */ | |||
| #define HAL_CRC_Input_Data_Reverse HAL_CRCEx_Input_Data_Reverse | |||
| #define HAL_CRC_Output_Data_Reverse HAL_CRCEx_Output_Data_Reverse | |||
| /** @defgroup CRC_Exported_Functions_Group2 Peripheral Control functions | |||
| * @{ | |||
| */ | |||
| /* 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 | |||
| * @{ | |||
| */ | |||
| /* Peripheral State and Error functions ***************************************/ | |||
| HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc); | |||
| /** | |||
| * @} | |||
| */ | |||
| #define IS_DEFAULT_INIT_VALUE(VALUE) (((VALUE) == DEFAULT_INIT_VALUE_ENABLE) || \ | |||
| ((VALUE) == DEFAULT_INIT_VALUE_DISABLE)) | |||
| /** | |||
| * @} | |||
| */ | |||
| #define IS_CRC_POL_LENGTH(LENGTH) (((LENGTH) == CRC_POLYLENGTH_32B) || \ | |||
| ((LENGTH) == CRC_POLYLENGTH_16B) || \ | |||
| ((LENGTH) == CRC_POLYLENGTH_8B) || \ | |||
| ((LENGTH) == CRC_POLYLENGTH_7B)) | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /** @defgroup CRC_Private_Types CRC Private Types | |||
| * @{ | |||
| */ | |||
| #define IS_CRC_INPUTDATA_FORMAT(FORMAT) (((FORMAT) == CRC_INPUTDATA_FORMAT_BYTES) || \ | |||
| ((FORMAT) == CRC_INPUTDATA_FORMAT_HALFWORDS) || \ | |||
| ((FORMAT) == CRC_INPUTDATA_FORMAT_WORDS)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private defines -----------------------------------------------------------*/ | |||
| /** @defgroup CRC_Private_Defines CRC Private Defines | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Include CRC HAL Extended module */ | |||
| #include "stm32h7xx_hal_crc_ex.h" | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /** @defgroup CRC_Private_Variables CRC Private Variables | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @defgroup CRC_Exported_Functions CRC Exported Functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup CRC_Private_Constants CRC Private Constants | |||
| /* Initialization and de-initialization 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); | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup CRC_Private_Macros CRC Private Macros | |||
| /* Peripheral Control functions ***********************************************/ | |||
| /** @defgroup CRC_Exported_Functions_Group2 Peripheral Control functions | |||
| * @{ | |||
| */ | |||
| #define IS_DEFAULT_POLYNOMIAL(__DEFAULT__) (((__DEFAULT__) == DEFAULT_POLYNOMIAL_ENABLE) || \ | |||
| ((__DEFAULT__) == DEFAULT_POLYNOMIAL_DISABLE)) | |||
| #define IS_DEFAULT_INIT_VALUE(__VALUE__) (((__VALUE__) == DEFAULT_INIT_VALUE_ENABLE) || \ | |||
| ((__VALUE__) == DEFAULT_INIT_VALUE_DISABLE)) | |||
| #define IS_CRC_POL_LENGTH(__LENGTH__) (((__LENGTH__) == CRC_POLYLENGTH_32B) || \ | |||
| ((__LENGTH__) == CRC_POLYLENGTH_16B) || \ | |||
| ((__LENGTH__) == CRC_POLYLENGTH_8B) || \ | |||
| ((__LENGTH__) == CRC_POLYLENGTH_7B)) | |||
| #define IS_CRC_INPUTDATA_FORMAT(__FORMAT__) (((__FORMAT__) == CRC_INPUTDATA_FORMAT_BYTES) || \ | |||
| ((__FORMAT__) == CRC_INPUTDATA_FORMAT_HALFWORDS) || \ | |||
| ((__FORMAT__) == CRC_INPUTDATA_FORMAT_WORDS)) | |||
| 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); | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions prototypes ----------------------------------------------*/ | |||
| /** @defgroup CRC_Private_Functions_Prototypes CRC Private Functions Prototypes | |||
| /* Peripheral State and Error functions ***************************************/ | |||
| /** @defgroup CRC_Exported_Functions_Group3 Peripheral State functions | |||
| * @{ | |||
| */ | |||
| HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc); | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup CRC_Private_Functions CRC Private Functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -417,7 +339,6 @@ HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_CRC_H */ | |||
| #endif /* STM32H7xx_HAL_CRC_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_crc_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of CRC HAL extension module. | |||
| * @brief Header file of CRC HAL extended module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_CRC_EX_H | |||
| #define __STM32H7xx_HAL_CRC_EX_H | |||
| #ifndef STM32H7xx_HAL_CRC_EX_H | |||
| #define STM32H7xx_HAL_CRC_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -50,74 +32,64 @@ | |||
| * @{ | |||
| */ | |||
| /** @defgroup CRCEx CRCEx | |||
| /** @addtogroup CRCEx | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup CRCEx_Exported_Constants CRC Extended exported constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup CRCEx_Input_Data_Inversion CRC Extended input data inversion modes | |||
| /** @defgroup CRCEx_Exported_Constants CRC Extended Exported Constants | |||
| * @{ | |||
| */ | |||
| #define CRC_INPUTDATA_INVERSION_NONE ((uint32_t)0x00000000U) | |||
| #define CRC_INPUTDATA_INVERSION_BYTE ((uint32_t)CRC_CR_REV_IN_0) | |||
| #define CRC_INPUTDATA_INVERSION_HALFWORD ((uint32_t)CRC_CR_REV_IN_1) | |||
| #define CRC_INPUTDATA_INVERSION_WORD ((uint32_t)CRC_CR_REV_IN) | |||
| #define IS_CRC_INPUTDATA_INVERSION_MODE(__MODE__) (((__MODE__) == CRC_INPUTDATA_INVERSION_NONE) || \ | |||
| ((__MODE__) == CRC_INPUTDATA_INVERSION_BYTE) || \ | |||
| ((__MODE__) == CRC_INPUTDATA_INVERSION_HALFWORD) || \ | |||
| ((__MODE__) == CRC_INPUTDATA_INVERSION_WORD)) | |||
| /** @defgroup CRCEx_Input_Data_Inversion Input Data Inversion Modes | |||
| * @{ | |||
| */ | |||
| #define CRC_INPUTDATA_INVERSION_NONE 0x00000000U /*!< No input data inversion */ | |||
| #define CRC_INPUTDATA_INVERSION_BYTE CRC_CR_REV_IN_0 /*!< Byte-wise input data inversion */ | |||
| #define CRC_INPUTDATA_INVERSION_HALFWORD CRC_CR_REV_IN_1 /*!< HalfWord-wise input data inversion */ | |||
| #define CRC_INPUTDATA_INVERSION_WORD CRC_CR_REV_IN /*!< Word-wise input data inversion */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CRCEx_Output_Data_Inversion CRC Extended output data inversion modes | |||
| /** @defgroup CRCEx_Output_Data_Inversion Output Data Inversion Modes | |||
| * @{ | |||
| */ | |||
| #define CRC_OUTPUTDATA_INVERSION_DISABLE ((uint32_t)0x00000000U) | |||
| #define CRC_OUTPUTDATA_INVERSION_ENABLE ((uint32_t)CRC_CR_REV_OUT) | |||
| #define IS_CRC_OUTPUTDATA_INVERSION_MODE(__MODE__) (((__MODE__) == CRC_OUTPUTDATA_INVERSION_DISABLE) || \ | |||
| ((__MODE__) == CRC_OUTPUTDATA_INVERSION_ENABLE)) | |||
| #define CRC_OUTPUTDATA_INVERSION_DISABLE 0x00000000U /*!< No output data inversion */ | |||
| #define CRC_OUTPUTDATA_INVERSION_ENABLE CRC_CR_REV_OUT /*!< Bit-wise output data inversion */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| * @} | |||
| */ | |||
| /** @defgroup CRCEx_Exported_Macros CRC Extended exported macros | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup CRCEx_Exported_Macros CRC Extended Exported Macros | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief Set CRC output reversal | |||
| * @param __HANDLE__ : CRC handle | |||
| * @retval None. | |||
| * @param __HANDLE__ CRC handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_CRC_OUTPUTREVERSAL_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_REV_OUT) | |||
| /** | |||
| * @brief Unset CRC output reversal | |||
| * @param __HANDLE__ : CRC handle | |||
| * @retval None. | |||
| * @param __HANDLE__ CRC handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_CRC_OUTPUTREVERSAL_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(CRC_CR_REV_OUT)) | |||
| /** | |||
| * @brief Set CRC non-default polynomial | |||
| * @param __HANDLE__ : CRC handle | |||
| * @param __POLYNOMIAL__: 7, 8, 16 or 32-bit polynomial | |||
| * @retval None. | |||
| * @param __HANDLE__ CRC handle | |||
| * @param __POLYNOMIAL__ 7, 8, 16 or 32-bit polynomial | |||
| * @retval None | |||
| */ | |||
| #define __HAL_CRC_POLYNOMIAL_CONFIG(__HANDLE__, __POLYNOMIAL__) ((__HANDLE__)->Instance->POL = (__POLYNOMIAL__)) | |||
| @@ -125,23 +97,37 @@ | |||
| * @} | |||
| */ | |||
| /* Private macros --------------------------------------------------------*/ | |||
| /** @defgroup CRCEx_Private_Macros CRC Extended Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_CRC_INPUTDATA_INVERSION_MODE(MODE) (((MODE) == CRC_INPUTDATA_INVERSION_NONE) || \ | |||
| ((MODE) == CRC_INPUTDATA_INVERSION_BYTE) || \ | |||
| ((MODE) == CRC_INPUTDATA_INVERSION_HALFWORD) || \ | |||
| ((MODE) == CRC_INPUTDATA_INVERSION_WORD)) | |||
| #define IS_CRC_OUTPUTDATA_INVERSION_MODE(MODE) (((MODE) == CRC_OUTPUTDATA_INVERSION_DISABLE) || \ | |||
| ((MODE) == CRC_OUTPUTDATA_INVERSION_ENABLE)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @defgroup CRCEx_Exported_Functions CRC Extended Exported Functions | |||
| /** @addtogroup CRCEx_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /** @defgroup CRCEx_Exported_Functions_Group1 Extended CRC features functions | |||
| /** @addtogroup CRCEx_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /* Initialization and de-initialization functions ****************************/ | |||
| HAL_StatusTypeDef HAL_CRCEx_Polynomial_Set(CRC_HandleTypeDef *hcrc, uint32_t Pol, uint32_t PolyLength); | |||
| HAL_StatusTypeDef HAL_CRCEx_Input_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t InputReverseMode); | |||
| HAL_StatusTypeDef HAL_CRCEx_Output_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t OutputReverseMode); | |||
| /* Peripheral Control functions ***********************************************/ | |||
| /* Peripheral State and Error functions ***************************************/ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -150,7 +136,6 @@ HAL_StatusTypeDef HAL_CRCEx_Output_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_ | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -163,6 +148,6 @@ HAL_StatusTypeDef HAL_CRCEx_Output_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_ | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_CRC_EX_H */ | |||
| #endif /* STM32H7xx_HAL_CRC_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_cryp.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of CRYP HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_CRYP_H | |||
| #define __STM32H7xx_HAL_CRYP_H | |||
| #ifndef STM32H7xx_HAL_CRYP_H | |||
| #define STM32H7xx_HAL_CRYP_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| @@ -70,18 +52,20 @@ typedef struct | |||
| This parameter can be a value of @ref CRYP_Data_Type */ | |||
| uint32_t KeySize; /*!< Used only in AES mode : 128, 192 or 256 bit key length in CRYP1. | |||
| This parameter can be a value of @ref CRYP_Key_Size */ | |||
| uint32_t* pKey; /*!< The key used for encryption/decryption */ | |||
| uint32_t* pInitVect; /*!< The initialization vector used also as initialization | |||
| uint32_t *pKey; /*!< The key used for encryption/decryption */ | |||
| uint32_t *pInitVect; /*!< The initialization vector used also as initialization | |||
| counter in CTR mode */ | |||
| uint32_t Algorithm; /*!< DES/ TDES Algorithm ECB/CBC | |||
| AES Algorithm ECB/CBC/CTR/GCM or CCM | |||
| This parameter can be a value of @ref CRYP_Algorithm_Mode */ | |||
| uint32_t* Header; /*!< used only in AES GCM and CCM Algorithm for authentication, | |||
| uint32_t *Header; /*!< used only in AES GCM and CCM Algorithm for authentication, | |||
| GCM : also known as Additional Authentication Data | |||
| CCM : named B1 composed of the associated data length and Associated Data. */ | |||
| uint32_t HeaderSize; /*!< The size of header buffer in word */ | |||
| uint32_t* B0; /*!< B0 is first authentication block used only in AES CCM mode */ | |||
| }CRYP_ConfigTypeDef; | |||
| uint32_t *B0; /*!< B0 is first authentication block used only in AES CCM mode */ | |||
| uint32_t DataWidthUnit; /*!< Data With Unit, this parameter can be value of @ref CRYP_Data_Width_Unit*/ | |||
| } CRYP_ConfigTypeDef; | |||
| /** | |||
| @@ -93,51 +77,99 @@ typedef enum | |||
| HAL_CRYP_STATE_RESET = 0x00U, /*!< CRYP not yet initialized or disabled */ | |||
| HAL_CRYP_STATE_READY = 0x01U, /*!< CRYP initialized and ready for use */ | |||
| HAL_CRYP_STATE_BUSY = 0x02U /*!< CRYP BUSY, internal processing is ongoing */ | |||
| }HAL_CRYP_STATETypeDef; | |||
| } HAL_CRYP_STATETypeDef; | |||
| /** | |||
| * @brief CRYP handle Structure definition | |||
| */ | |||
| #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1) | |||
| typedef struct __CRYP_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* (USE_HAL_CRYP_REGISTER_CALLBACKS) */ | |||
| { | |||
| CRYP_TypeDef *Instance; /*!< CRYP registers base address */ | |||
| CRYP_TypeDef *Instance; /*!< CRYP registers base address */ | |||
| CRYP_ConfigTypeDef Init; /*!< CRYP required parameters */ | |||
| uint32_t *pCrypInBuffPtr; /*!< Pointer to CRYP processing (encryption, decryption,...) buffer */ | |||
| uint32_t *pCrypOutBuffPtr; /*!< Pointer to CRYP processing (encryption, decryption,...) buffer */ | |||
| __IO uint16_t CrypHeaderCount; /*!< Counter of header data */ | |||
| __IO uint16_t CrypInCount; /*!< Counter of input data */ | |||
| __IO uint16_t CrypOutCount; /*!< Counter of output data */ | |||
| uint16_t Size; /*!< length of input data in word */ | |||
| uint32_t Phase; /*!< CRYP peripheral phase */ | |||
| CRYP_ConfigTypeDef Init; /*!< CRYP required parameters */ | |||
| DMA_HandleTypeDef *hdmain; /*!< CRYP In DMA handle parameters */ | |||
| uint32_t *pCrypInBuffPtr; /*!< Pointer to CRYP processing (encryption, decryption,...) buffer */ | |||
| DMA_HandleTypeDef *hdmaout; /*!< CRYP Out DMA handle parameters */ | |||
| uint32_t *pCrypOutBuffPtr; /*!< Pointer to CRYP processing (encryption, decryption,...) buffer */ | |||
| HAL_LockTypeDef Lock; /*!< CRYP locking object */ | |||
| __IO uint16_t CrypHeaderCount; /*!< Counter of header data */ | |||
| __IO HAL_CRYP_STATETypeDef State; /*!< CRYP peripheral state */ | |||
| __IO uint16_t CrypInCount; /*!< Counter of input data */ | |||
| __IO uint32_t ErrorCode; /*!< CRYP peripheral error code */ | |||
| __IO uint16_t CrypOutCount; /*!< Counter of output data */ | |||
| uint32_t Version; /*!< CRYP1 IP version*/ | |||
| uint16_t Size; /*!< length of input data in word */ | |||
| #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1) | |||
| void (*InCpltCallback)(struct __CRYP_HandleTypeDef *hcryp); /*!< CRYP Input FIFO transfer completed callback */ | |||
| void (*OutCpltCallback)(struct __CRYP_HandleTypeDef *hcryp); /*!< CRYP Output FIFO transfer completed callback */ | |||
| void (*ErrorCallback)(struct __CRYP_HandleTypeDef *hcryp); /*!< CRYP Error callback */ | |||
| uint32_t Phase; /*!< CRYP peripheral phase */ | |||
| void (* MspInitCallback)(struct __CRYP_HandleTypeDef *hcryp); /*!< CRYP Msp Init callback */ | |||
| void (* MspDeInitCallback)(struct __CRYP_HandleTypeDef *hcryp); /*!< CRYP Msp DeInit callback */ | |||
| DMA_HandleTypeDef *hdmain; /*!< CRYP In DMA handle parameters */ | |||
| #endif /* (USE_HAL_CRYP_REGISTER_CALLBACKS) */ | |||
| DMA_HandleTypeDef *hdmaout; /*!< CRYP Out DMA handle parameters */ | |||
| } CRYP_HandleTypeDef; | |||
| HAL_LockTypeDef Lock; /*!< CRYP locking object */ | |||
| __IO HAL_CRYP_STATETypeDef State; /*!< CRYP peripheral state */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1) | |||
| /** @defgroup HAL_CRYP_Callback_ID_enumeration_definition HAL CRYP Callback ID enumeration definition | |||
| * @brief HAL CRYP Callback ID enumeration definition | |||
| * @{ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_CRYP_INPUT_COMPLETE_CB_ID = 0x01U, /*!< CRYP Input FIFO transfer completed callback ID */ | |||
| HAL_CRYP_OUTPUT_COMPLETE_CB_ID = 0x02U, /*!< CRYP Output FIFO transfer completed callback ID */ | |||
| HAL_CRYP_ERROR_CB_ID = 0x03U, /*!< CRYP Error callback ID */ | |||
| HAL_CRYP_MSPINIT_CB_ID = 0x04U, /*!< CRYP MspInit callback ID */ | |||
| HAL_CRYP_MSPDEINIT_CB_ID = 0x05U /*!< CRYP MspDeInit callback ID */ | |||
| __IO uint32_t ErrorCode; /*!< CRYP peripheral error code */ | |||
| } HAL_CRYP_CallbackIDTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| }CRYP_HandleTypeDef; | |||
| /** @defgroup HAL_CRYP_Callback_pointer_definition HAL CRYP Callback pointer definition | |||
| * @brief HAL CRYP Callback pointer definition | |||
| * @{ | |||
| */ | |||
| typedef void (*pCRYP_CallbackTypeDef)(CRYP_HandleTypeDef *hcryp); /*!< pointer to a common CRYP callback function */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* USE_HAL_CRYP_REGISTER_CALLBACKS */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup CRYP_Exported_Constants CRYP Exported Constants | |||
| * @{ | |||
| @@ -154,11 +186,26 @@ typedef struct | |||
| #define HAL_CRYP_ERROR_TIMEOUT 0x00000010U /*!< Timeout error */ | |||
| #define HAL_CRYP_ERROR_NOT_SUPPORTED 0x00000020U /*!< Not supported mode */ | |||
| #define HAL_CRYP_ERROR_AUTH_TAG_SEQUENCE 0x00000040U /*!< Sequence are not respected only for GCM or CCM */ | |||
| #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1) | |||
| #define HAL_CRYP_ERROR_INVALID_CALLBACK ((uint32_t)0x00000080U) /*!< Invalid Callback error */ | |||
| #endif /* USE_HAL_CRYP_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CRYP_Data_Width_Unit CRYP Data Width Unit | |||
| * @{ | |||
| */ | |||
| #define CRYP_DATAWIDTHUNIT_WORD 0x00000000U /*!< By default, size unit is word */ | |||
| #define CRYP_DATAWIDTHUNIT_BYTE 0x00000001U /*!< By default, size unit is word */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CRYP_Algorithm_Mode CRYP Algorithm Mode | |||
| * @{ | |||
| */ | |||
| @@ -242,6 +289,20 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| /** @brief Reset CRYP handle state | |||
| * @param __HANDLE__ specifies the CRYP handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_CRYP_RESET_HANDLE_STATE(__HANDLE__) do{\ | |||
| (__HANDLE__)->State = HAL_CRYP_STATE_RESET;\ | |||
| (__HANDLE__)->MspInitCallback = NULL;\ | |||
| (__HANDLE__)->MspDeInitCallback = NULL;\ | |||
| }while(0) | |||
| #else | |||
| #define __HAL_CRYP_RESET_HANDLE_STATE(__HANDLE__) ( (__HANDLE__)->State = HAL_CRYP_STATE_RESET) | |||
| #endif /* USE_HAL_CRYP_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @brief Enable/Disable the CRYP peripheral. | |||
| * @param __HANDLE__: specifies the CRYP handle. | |||
| @@ -262,12 +323,12 @@ typedef struct | |||
| * @arg CRYP_FLAG_OFNE: Output FIFO is not empty | |||
| * @arg CRYP_FLAG_OFFU: Output FIFO is full | |||
| * @arg CRYP_FLAG_OUTRIS: Input FIFO service raw interrupt is pending | |||
| * @retval The state of __FLAG__ (TRUE or FALSE). | |||
| * @retval The state of __FLAG__ (TRUE or FALSE). | |||
| */ | |||
| #define CRYP_FLAG_MASK 0x0000001FU | |||
| #define __HAL_CRYP_GET_FLAG(__HANDLE__, __FLAG__) ((((uint8_t)((__FLAG__) >> 24)) == 0x01U)?((((__HANDLE__)->Instance->RISR) & ((__FLAG__) & CRYP_FLAG_MASK)) == ((__FLAG__) & CRYP_FLAG_MASK)): \ | |||
| ((((__HANDLE__)->Instance->RISR) & ((__FLAG__) & CRYP_FLAG_MASK)) == ((__FLAG__) & CRYP_FLAG_MASK))) | |||
| ((((__HANDLE__)->Instance->RISR) & ((__FLAG__) & CRYP_FLAG_MASK)) == ((__FLAG__) & CRYP_FLAG_MASK))) | |||
| /** @brief Check whether the specified CRYP interrupt is set or not. | |||
| * @param __HANDLE__: specifies the CRYP handle. | |||
| @@ -323,9 +384,13 @@ HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp); | |||
| HAL_StatusTypeDef HAL_CRYP_DeInit(CRYP_HandleTypeDef *hcryp); | |||
| void HAL_CRYP_MspInit(CRYP_HandleTypeDef *hcryp); | |||
| void HAL_CRYP_MspDeInit(CRYP_HandleTypeDef *hcryp); | |||
| HAL_StatusTypeDef HAL_CRYP_SetConfig(CRYP_HandleTypeDef *hcryp, CRYP_ConfigTypeDef *pConf ); | |||
| HAL_StatusTypeDef HAL_CRYP_GetConfig(CRYP_HandleTypeDef *hcryp, CRYP_ConfigTypeDef *pConf ); | |||
| HAL_StatusTypeDef HAL_CRYP_SetConfig(CRYP_HandleTypeDef *hcryp, CRYP_ConfigTypeDef *pConf); | |||
| HAL_StatusTypeDef HAL_CRYP_GetConfig(CRYP_HandleTypeDef *hcryp, CRYP_ConfigTypeDef *pConf); | |||
| #if (USE_HAL_CRYP_REGISTER_CALLBACKS == 1) | |||
| HAL_StatusTypeDef HAL_CRYP_RegisterCallback(CRYP_HandleTypeDef *hcryp, HAL_CRYP_CallbackIDTypeDef CallbackID, | |||
| pCRYP_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_CRYP_UnRegisterCallback(CRYP_HandleTypeDef *hcryp, HAL_CRYP_CallbackIDTypeDef CallbackID); | |||
| #endif /* USE_HAL_CRYP_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -335,8 +400,10 @@ HAL_StatusTypeDef HAL_CRYP_GetConfig(CRYP_HandleTypeDef *hcryp, CRYP_ConfigTypeD | |||
| */ | |||
| /* encryption/decryption ***********************************/ | |||
| HAL_StatusTypeDef HAL_CRYP_Encrypt(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_CRYP_Decrypt(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_CRYP_Encrypt(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output, | |||
| uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_CRYP_Decrypt(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output, | |||
| uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_CRYP_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output); | |||
| HAL_StatusTypeDef HAL_CRYP_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output); | |||
| HAL_StatusTypeDef HAL_CRYP_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint32_t *Input, uint16_t Size, uint32_t *Output); | |||
| @@ -376,14 +443,14 @@ uint32_t HAL_CRYP_GetError(CRYP_HandleTypeDef *hcryp); | |||
| */ | |||
| #define IS_CRYP_ALGORITHM(ALGORITHM) (((ALGORITHM) == CRYP_DES_ECB) || \ | |||
| ((ALGORITHM) == CRYP_DES_CBC) || \ | |||
| ((ALGORITHM) == CRYP_TDES_ECB) || \ | |||
| ((ALGORITHM) == CRYP_TDES_CBC) || \ | |||
| ((ALGORITHM) == CRYP_AES_ECB) || \ | |||
| ((ALGORITHM) == CRYP_AES_CBC) || \ | |||
| ((ALGORITHM) == CRYP_AES_CTR) || \ | |||
| ((ALGORITHM) == CRYP_AES_GCM) || \ | |||
| ((ALGORITHM) == CRYP_AES_CCM)) | |||
| ((ALGORITHM) == CRYP_DES_CBC) || \ | |||
| ((ALGORITHM) == CRYP_TDES_ECB) || \ | |||
| ((ALGORITHM) == CRYP_TDES_CBC) || \ | |||
| ((ALGORITHM) == CRYP_AES_ECB) || \ | |||
| ((ALGORITHM) == CRYP_AES_CBC) || \ | |||
| ((ALGORITHM) == CRYP_AES_CTR) || \ | |||
| ((ALGORITHM) == CRYP_AES_GCM) || \ | |||
| ((ALGORITHM) == CRYP_AES_CCM)) | |||
| #define IS_CRYP_KEYSIZE(KEYSIZE)(((KEYSIZE) == CRYP_KEYSIZE_128B) || \ | |||
| ((KEYSIZE) == CRYP_KEYSIZE_192B) || \ | |||
| @@ -461,6 +528,6 @@ uint32_t HAL_CRYP_GetError(CRYP_HandleTypeDef *hcryp); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_CRYP_H */ | |||
| #endif /* STM32H7xx_HAL_CRYP_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_cryp_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of CRYP HAL Extension module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_CRYP_EX_H | |||
| #define __STM32H7xx_HAL_CRYP_EX_H | |||
| #ifndef STM32H7xx_HAL_CRYP_EX_H | |||
| #define STM32H7xx_HAL_CRYP_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -57,7 +39,7 @@ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /** @defgroup CRYPEx_Private_Types CRYPEx Private Types | |||
| * @{ | |||
| */ | |||
| @@ -89,9 +71,9 @@ | |||
| * @{ | |||
| */ | |||
| /** | |||
| /** | |||
| * @} | |||
| */ | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup CRYPEx_Private_Functions CRYPEx Private Functions | |||
| @@ -136,6 +118,6 @@ HAL_StatusTypeDef HAL_CRYPEx_AESCCM_GenerateAuthTAG(CRYP_HandleTypeDef *hcryp, u | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_CRYP_EX_H */ | |||
| #endif /* STM32H7xx_HAL_CRYP_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_dac.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of DAC HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_DAC_H | |||
| #define __STM32H7xx_HAL_DAC_H | |||
| #ifndef STM32H7xx_HAL_DAC_H | |||
| #define STM32H7xx_HAL_DAC_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -66,18 +48,22 @@ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_DAC_STATE_RESET = 0x00, /*!< DAC not yet initialized or disabled */ | |||
| HAL_DAC_STATE_READY = 0x01, /*!< DAC initialized and ready for use */ | |||
| HAL_DAC_STATE_BUSY = 0x02, /*!< DAC internal processing is ongoing */ | |||
| HAL_DAC_STATE_TIMEOUT = 0x03, /*!< DAC timeout state */ | |||
| HAL_DAC_STATE_ERROR = 0x04 /*!< DAC error state */ | |||
| HAL_DAC_STATE_RESET = 0x00U, /*!< DAC not yet initialized or disabled */ | |||
| HAL_DAC_STATE_READY = 0x01U, /*!< DAC initialized and ready for use */ | |||
| HAL_DAC_STATE_BUSY = 0x02U, /*!< DAC internal processing is ongoing */ | |||
| HAL_DAC_STATE_TIMEOUT = 0x03U, /*!< DAC timeout state */ | |||
| HAL_DAC_STATE_ERROR = 0x04U /*!< DAC error state */ | |||
| }HAL_DAC_StateTypeDef; | |||
| /** | |||
| * @brief DAC handle Structure definition | |||
| */ | |||
| #if (USE_HAL_DAC_REGISTER_CALLBACKS == 1) | |||
| typedef struct __DAC_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_DAC_REGISTER_CALLBACKS */ | |||
| { | |||
| DAC_TypeDef *Instance; /*!< Register base address */ | |||
| @@ -91,6 +77,20 @@ typedef struct | |||
| __IO uint32_t ErrorCode; /*!< DAC Error code */ | |||
| #if (USE_HAL_DAC_REGISTER_CALLBACKS == 1) | |||
| void (* ConvCpltCallbackCh1)(struct __DAC_HandleTypeDef *hdac); | |||
| void (* ConvHalfCpltCallbackCh1)(struct __DAC_HandleTypeDef *hdac); | |||
| void (* ErrorCallbackCh1)(struct __DAC_HandleTypeDef *hdac); | |||
| void (* DMAUnderrunCallbackCh1)(struct __DAC_HandleTypeDef *hdac); | |||
| void (* ConvCpltCallbackCh2)(struct __DAC_HandleTypeDef *hdac); | |||
| void (* ConvHalfCpltCallbackCh2)(struct __DAC_HandleTypeDef *hdac); | |||
| void (* ErrorCallbackCh2)(struct __DAC_HandleTypeDef *hdac); | |||
| void (* DMAUnderrunCallbackCh2)(struct __DAC_HandleTypeDef *hdac); | |||
| void (* MspInitCallback)(struct __DAC_HandleTypeDef *hdac); | |||
| void (* MspDeInitCallback)(struct __DAC_HandleTypeDef *hdac); | |||
| #endif /* USE_HAL_DAC_REGISTER_CALLBACKS */ | |||
| }DAC_HandleTypeDef; | |||
| /** | |||
| @@ -141,6 +141,31 @@ typedef struct | |||
| }DAC_ChannelConfTypeDef; | |||
| #if (USE_HAL_DAC_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL DAC Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_DAC_CH1_COMPLETE_CB_ID = 0x00U, /*!< DAC CH1 Complete Callback ID */ | |||
| HAL_DAC_CH1_HALF_COMPLETE_CB_ID = 0x01U, /*!< DAC CH1 half Complete Callback ID */ | |||
| HAL_DAC_CH1_ERROR_ID = 0x02U, /*!< DAC CH1 error Callback ID */ | |||
| HAL_DAC_CH1_UNDERRUN_CB_ID = 0x03U, /*!< DAC CH1 underrun Callback ID */ | |||
| HAL_DAC_CH2_COMPLETE_CB_ID = 0x04U, /*!< DAC CH2 Complete Callback ID */ | |||
| HAL_DAC_CH2_HALF_COMPLETE_CB_ID = 0x05U, /*!< DAC CH2 half Complete Callback ID */ | |||
| HAL_DAC_CH2_ERROR_ID = 0x06U, /*!< DAC CH2 error Callback ID */ | |||
| HAL_DAC_CH2_UNDERRUN_CB_ID = 0x07U, /*!< DAC CH2 underrun Callback ID */ | |||
| HAL_DAC_MSP_INIT_CB_ID = 0x08U, /*!< DAC MspInit Callback ID */ | |||
| HAL_DAC_MSP_DEINIT_CB_ID = 0x09U, /*!< DAC MspDeInit Callback ID */ | |||
| HAL_DAC_ALL_CB_ID = 0x0AU /*!< DAC All ID */ | |||
| } HAL_DAC_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL DAC Callback pointer definition | |||
| */ | |||
| typedef void (*pDAC_CallbackTypeDef)(DAC_HandleTypeDef *hdac); | |||
| #endif /* USE_HAL_DAC_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -154,11 +179,14 @@ typedef struct | |||
| /** @defgroup DAC_Error_Code DAC Error Code | |||
| * @{ | |||
| */ | |||
| #define HAL_DAC_ERROR_NONE 0x00 /*!< No error */ | |||
| #define HAL_DAC_ERROR_DMAUNDERRUNCH1 0x01 /*!< DAC channel1 DMA underrun error */ | |||
| #define HAL_DAC_ERROR_DMAUNDERRUNCH2 0x02 /*!< DAC channel2 DMA underrun error */ | |||
| #define HAL_DAC_ERROR_DMA 0x04 /*!< DMA error */ | |||
| #define HAL_DAC_ERROR_TIMEOUT 0x08 /*!< Timeout error */ | |||
| #define HAL_DAC_ERROR_NONE 0x00U /*!< No error */ | |||
| #define HAL_DAC_ERROR_DMAUNDERRUNCH1 0x01U /*!< DAC channel1 DMA underrun error */ | |||
| #define HAL_DAC_ERROR_DMAUNDERRUNCH2 0x02U /*!< DAC channel2 DMA underrun error */ | |||
| #define HAL_DAC_ERROR_DMA 0x04U /*!< DMA error */ | |||
| #define HAL_DAC_ERROR_TIMEOUT 0x08U /*!< Timeout error */ | |||
| #if (USE_HAL_DAC_REGISTER_CALLBACKS == 1) | |||
| #define HAL_DAC_ERROR_INVALID_CALLBACK 0x10U /*!< Invalid callback error */ | |||
| #endif /* USE_HAL_DAC_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -166,21 +194,21 @@ typedef struct | |||
| /** @defgroup DAC_trigger_selection DAC trigger selection | |||
| * @{ | |||
| */ | |||
| #define DAC_TRIGGER_NONE ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC_DHRxxxx register has been loaded, and not by external trigger */ | |||
| #define DAC_TRIGGER_SOFTWARE ((uint32_t)(DAC_CR_TEN1)) /*!< Conversion started by software trigger for DAC channel */ | |||
| #define DAC_TRIGGER_T1_TRGO ((uint32_t)(DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM1 TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_T2_TRGO ((uint32_t)(DAC_CR_TSEL1_1 | DAC_CR_TEN1)) /*!< TIM2 TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_T4_TRGO ((uint32_t)(DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM4 TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_T5_TRGO ((uint32_t)(DAC_CR_TSEL1_2 |DAC_CR_TEN1)) /*!< TIM5 TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_T6_TRGO ((uint32_t)(DAC_CR_TSEL1_2 | DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_T7_TRGO ((uint32_t)(DAC_CR_TSEL1_2 | DAC_CR_TSEL1_1 | DAC_CR_TEN1)) /*!< TIM7 TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_T8_TRGO ((uint32_t)(DAC_CR_TSEL1_2 | DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM8 TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_T15_TRGO ((uint32_t)(DAC_CR_TSEL1_3 | DAC_CR_TEN1)) /*!< TIM15 TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_HR1_TRGO1 ((uint32_t)(DAC_CR_TSEL1_3 | DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< HR1 TRGO1 selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_HR1_TRGO2 ((uint32_t)(DAC_CR_TSEL1_3 | DAC_CR_TSEL1_1 | DAC_CR_TEN1)) /*!< HR1 TRGO2 selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_LP1_OUT ((uint32_t)(DAC_CR_TSEL1_3 | DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< LP1 OUT TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_LP2_OUT ((uint32_t)(DAC_CR_TSEL1_3 | DAC_CR_TSEL1_2 | DAC_CR_TEN1)) /*!< LP2 OUT TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_EXT_IT9 ((uint32_t)(DAC_CR_TSEL1_3 | DAC_CR_TSEL1_2 | DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< EXTI Line9 event selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_NONE 0x00000000U /*!< Conversion is automatic once the DAC_DHRxxxx register has been loaded, and not by external trigger */ | |||
| #define DAC_TRIGGER_SOFTWARE (DAC_CR_TEN1) /*!< Conversion started by software trigger for DAC channel */ | |||
| #define DAC_TRIGGER_T1_TRGO (DAC_CR_TSEL1_0 | DAC_CR_TEN1) /*!< TIM1 TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_T2_TRGO (DAC_CR_TSEL1_1 | DAC_CR_TEN1) /*!< TIM2 TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_T4_TRGO (DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0 | DAC_CR_TEN1) /*!< TIM4 TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_T5_TRGO (DAC_CR_TSEL1_2 |DAC_CR_TEN1) /*!< TIM5 TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_T6_TRGO (DAC_CR_TSEL1_2 | DAC_CR_TSEL1_0 | DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_T7_TRGO (DAC_CR_TSEL1_2 | DAC_CR_TSEL1_1 | DAC_CR_TEN1) /*!< TIM7 TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_T8_TRGO (DAC_CR_TSEL1_2 | DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0 | DAC_CR_TEN1) /*!< TIM8 TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_T15_TRGO (DAC_CR_TSEL1_3 | DAC_CR_TEN1) /*!< TIM15 TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_HR1_TRGO1 (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_0 | DAC_CR_TEN1) /*!< HR1 TRGO1 selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_HR1_TRGO2 (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_1 | DAC_CR_TEN1) /*!< HR1 TRGO2 selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_LP1_OUT (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0 | DAC_CR_TEN1) /*!< LP1 OUT TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_LP2_OUT (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_2 | DAC_CR_TEN1) /*!< LP2 OUT TRGO selected as external conversion trigger for DAC channel */ | |||
| #define DAC_TRIGGER_EXT_IT9 (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_2 | DAC_CR_TSEL1_0 | DAC_CR_TEN1) /*!< EXTI Line9 event selected as external conversion trigger for DAC channel */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -188,8 +216,8 @@ typedef struct | |||
| /** @defgroup DAC_output_buffer DAC output buffer | |||
| * @{ | |||
| */ | |||
| #define DAC_OUTPUTBUFFER_ENABLE ((uint32_t)0x00000000) | |||
| #define DAC_OUTPUTBUFFER_DISABLE ((uint32_t)DAC_MCR_MODE1_1) | |||
| #define DAC_OUTPUTBUFFER_ENABLE 0x00000000U | |||
| #define DAC_OUTPUTBUFFER_DISABLE DAC_MCR_MODE1_1 | |||
| /** | |||
| * @} | |||
| @@ -198,8 +226,8 @@ typedef struct | |||
| /** @defgroup DAC_ConnectOnChipPeripheral DAC ConnectOnChipPeripheral | |||
| * @{ | |||
| */ | |||
| #define DAC_CHIPCONNECT_DISABLE ((uint32_t)0x00000000) | |||
| #define DAC_CHIPCONNECT_ENABLE ((uint32_t)DAC_MCR_MODE1_0) | |||
| #define DAC_CHIPCONNECT_DISABLE 0x00000000U | |||
| #define DAC_CHIPCONNECT_ENABLE DAC_MCR_MODE1_0 | |||
| /** | |||
| * @} | |||
| @@ -209,18 +237,18 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| #define DAC_TRIMMING_FACTORY ((uint32_t)0x00000000) /*!< Factory trimming */ | |||
| #define DAC_TRIMMING_USER ((uint32_t)0x00000001) /*!< User trimming */ | |||
| #define DAC_TRIMMING_FACTORY 0x00000000U /*!< Factory trimming */ | |||
| #define DAC_TRIMMING_USER 0x00000001U /*!< User trimming */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DAC_SampleAndHold. Mode is Sample and hold (low power or normal) | |||
| /** @defgroup DAC_SampleAndHold DAC Sample and hold | |||
| * @{ | |||
| */ | |||
| #define DAC_SAMPLEANDHOLD_DISABLE ((uint32_t)0x00000000) | |||
| #define DAC_SAMPLEANDHOLD_ENABLE ((uint32_t)DAC_MCR_MODE1_2) | |||
| #define DAC_SAMPLEANDHOLD_DISABLE 0x00000000U | |||
| #define DAC_SAMPLEANDHOLD_ENABLE DAC_MCR_MODE1_2 | |||
| /** | |||
| @@ -231,8 +259,8 @@ typedef struct | |||
| /** @defgroup DAC_Channel_selection DAC Channel selection | |||
| * @{ | |||
| */ | |||
| #define DAC_CHANNEL_1 ((uint32_t)0x00000000) | |||
| #define DAC_CHANNEL_2 ((uint32_t)0x00000010) | |||
| #define DAC_CHANNEL_1 0x00000000U | |||
| #define DAC_CHANNEL_2 0x00000010U | |||
| /** | |||
| * @} | |||
| @@ -241,9 +269,9 @@ typedef struct | |||
| /** @defgroup DAC_data_alignment DAC data alignment | |||
| * @{ | |||
| */ | |||
| #define DAC_ALIGN_12B_R ((uint32_t)0x00000000) | |||
| #define DAC_ALIGN_12B_L ((uint32_t)0x00000004) | |||
| #define DAC_ALIGN_8B_R ((uint32_t)0x00000008) | |||
| #define DAC_ALIGN_12B_R 0x00000000U | |||
| #define DAC_ALIGN_12B_L 0x00000004U | |||
| #define DAC_ALIGN_8B_R 0x00000008U | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -251,8 +279,8 @@ typedef struct | |||
| /** @defgroup DAC_flags_definition DAC flags definition | |||
| * @{ | |||
| */ | |||
| #define DAC_FLAG_DMAUDR1 ((uint32_t)DAC_SR_DMAUDR1) | |||
| #define DAC_FLAG_DMAUDR2 ((uint32_t)DAC_SR_DMAUDR2) | |||
| #define DAC_FLAG_DMAUDR1 DAC_SR_DMAUDR1 | |||
| #define DAC_FLAG_DMAUDR2 DAC_SR_DMAUDR2 | |||
| /** | |||
| * @} | |||
| @@ -261,8 +289,8 @@ typedef struct | |||
| /** @defgroup DAC_IT_definition DAC IT definition | |||
| * @{ | |||
| */ | |||
| #define DAC_IT_DMAUDR1 ((uint32_t)DAC_SR_DMAUDR1) | |||
| #define DAC_IT_DMAUDR2 ((uint32_t)DAC_SR_DMAUDR2) | |||
| #define DAC_IT_DMAUDR1 DAC_SR_DMAUDR1 | |||
| #define DAC_IT_DMAUDR2 DAC_SR_DMAUDR2 | |||
| /** | |||
| * @} | |||
| @@ -279,48 +307,56 @@ typedef struct | |||
| */ | |||
| /** @brief Reset DAC handle state. | |||
| * @param __HANDLE__: specifies the DAC handle. | |||
| * @param __HANDLE__ specifies the DAC handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_DAC_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_DAC_RESET_HANDLE_STATE(__HANDLE__) do { \ | |||
| (__HANDLE__)->State = HAL_DAC_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_DAC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DAC_STATE_RESET) | |||
| #endif /* USE_HAL_DAC_REGISTER_CALLBACKS */ | |||
| /** @brief Enable the DAC channel. | |||
| * @param __HANDLE__: specifies the DAC handle. | |||
| * @param __DAC_Channel__: specifies the DAC channel | |||
| * @param __HANDLE__ specifies the DAC handle. | |||
| * @param __DAC_Channel__ specifies the DAC channel | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DAC_ENABLE(__HANDLE__, __DAC_Channel__) \ | |||
| ((__HANDLE__)->Instance->CR |= (DAC_CR_EN1 << (__DAC_Channel__))) | |||
| ((__HANDLE__)->Instance->CR |= (DAC_CR_EN1 << ((__DAC_Channel__) & 0x10UL))) | |||
| /** @brief Disable the DAC channel. | |||
| * @param __HANDLE__: specifies the DAC handle | |||
| * @param __DAC_Channel__: specifies the DAC channel. | |||
| * @param __HANDLE__ specifies the DAC handle | |||
| * @param __DAC_Channel__ specifies the DAC channel. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DAC_DISABLE(__HANDLE__, __DAC_Channel__) \ | |||
| ((__HANDLE__)->Instance->CR &= ~(DAC_CR_EN1 << (__DAC_Channel__))) | |||
| ((__HANDLE__)->Instance->CR &= ~(DAC_CR_EN1 << ((__DAC_Channel__) & 0x10UL))) | |||
| /** @brief Set DHR12R1 alignment. | |||
| * @param __ALIGNMENT__: specifies the DAC alignment | |||
| * @param __ALIGNMENT__ specifies the DAC alignment | |||
| * @retval None | |||
| */ | |||
| #define DAC_DHR12R1_ALIGNMENT(__ALIGNMENT__) (((uint32_t)0x00000008) + (__ALIGNMENT__)) | |||
| #define DAC_DHR12R1_ALIGNMENT(__ALIGNMENT__) (0x00000008U + (__ALIGNMENT__)) | |||
| /** @brief Set DHR12R2 alignment. | |||
| * @param __ALIGNMENT__: specifies the DAC alignment | |||
| * @param __ALIGNMENT__ specifies the DAC alignment | |||
| * @retval None | |||
| */ | |||
| #define DAC_DHR12R2_ALIGNMENT(__ALIGNMENT__) (((uint32_t)0x00000014) + (__ALIGNMENT__)) | |||
| #define DAC_DHR12R2_ALIGNMENT(__ALIGNMENT__) (0x00000014U + (__ALIGNMENT__)) | |||
| /** @brief Set DHR12RD alignment. | |||
| * @param __ALIGNMENT__: specifies the DAC alignment | |||
| * @param __ALIGNMENT__ specifies the DAC alignment | |||
| * @retval None | |||
| */ | |||
| #define DAC_DHR12RD_ALIGNMENT(__ALIGNMENT__) (((uint32_t)0x00000020) + (__ALIGNMENT__)) | |||
| #define DAC_DHR12RD_ALIGNMENT(__ALIGNMENT__) (0x00000020U + (__ALIGNMENT__)) | |||
| /** @brief Enable the DAC interrupt. | |||
| * @param __HANDLE__: specifies the DAC handle | |||
| * @param __INTERRUPT__: specifies the DAC interrupt. | |||
| * @param __HANDLE__ specifies the DAC handle | |||
| * @param __INTERRUPT__ specifies the DAC interrupt. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg DAC_IT_DMAUDR1: DAC channel 1 DMA underrun interrupt | |||
| * @arg DAC_IT_DMAUDR2: DAC channel 2 DMA underrun interrupt | |||
| @@ -329,8 +365,8 @@ typedef struct | |||
| #define __HAL_DAC_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR) |= (__INTERRUPT__)) | |||
| /** @brief Disable the DAC interrupt. | |||
| * @param __HANDLE__: specifies the DAC handle | |||
| * @param __INTERRUPT__: specifies the DAC interrupt. | |||
| * @param __HANDLE__ specifies the DAC handle | |||
| * @param __INTERRUPT__ specifies the DAC interrupt. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg DAC_IT_DMAUDR1: DAC channel 1 DMA underrun interrupt | |||
| * @arg DAC_IT_DMAUDR2: DAC channel 2 DMA underrun interrupt | |||
| @@ -339,8 +375,8 @@ typedef struct | |||
| #define __HAL_DAC_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR) &= ~(__INTERRUPT__)) | |||
| /** @brief Check whether the specified DAC interrupt source is enabled or not. | |||
| * @param __HANDLE__: DAC handle | |||
| * @param __INTERRUPT__: DAC interrupt source to check | |||
| * @param __HANDLE__ DAC handle | |||
| * @param __INTERRUPT__ DAC interrupt source to check | |||
| * This parameter can be any combination of the following values: | |||
| * @arg DAC_IT_DMAUDR1: DAC channel 1 DMA underrun interrupt | |||
| * @arg DAC_IT_DMAUDR2: DAC channel 2 DMA underrun interrupt | |||
| @@ -349,8 +385,8 @@ typedef struct | |||
| #define __HAL_DAC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR & (__INTERRUPT__)) == (__INTERRUPT__)) | |||
| /** @brief Get the selected DAC's flag status. | |||
| * @param __HANDLE__: specifies the DAC handle. | |||
| * @param __FLAG__: specifies the DAC flag to get. | |||
| * @param __HANDLE__ specifies the DAC handle. | |||
| * @param __FLAG__ specifies the DAC flag to get. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg DAC_FLAG_DMAUDR1: DAC channel 1 DMA underrun flag | |||
| * @arg DAC_FLAG_DMAUDR2: DAC channel 2 DMA underrun flag | |||
| @@ -359,8 +395,8 @@ typedef struct | |||
| #define __HAL_DAC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__)) | |||
| /** @brief Clear the DAC's flag. | |||
| * @param __HANDLE__: specifies the DAC handle. | |||
| * @param __FLAG__: specifies the DAC flag to clear. | |||
| * @param __HANDLE__ specifies the DAC handle. | |||
| * @param __FLAG__ specifies the DAC flag to clear. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg DAC_FLAG_DMAUDR1: DAC channel 1 DMA underrun flag | |||
| * @arg DAC_FLAG_DMAUDR2: DAC channel 2 DMA underrun flag | |||
| @@ -387,9 +423,9 @@ typedef struct | |||
| ((ALIGN) == DAC_ALIGN_12B_L) || \ | |||
| ((ALIGN) == DAC_ALIGN_8B_R)) | |||
| #define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0) | |||
| #define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0U) | |||
| #define IS_DAC_REFRESHTIME(TIME) ((TIME) <= 0x000000FF) | |||
| #define IS_DAC_REFRESHTIME(TIME) ((TIME) <= 0x000000FFU) | |||
| /** | |||
| * @} | |||
| @@ -432,6 +468,11 @@ void HAL_DAC_ConvCpltCallbackCh1(DAC_HandleTypeDef* hdac); | |||
| void HAL_DAC_ConvHalfCpltCallbackCh1(DAC_HandleTypeDef* hdac); | |||
| void HAL_DAC_ErrorCallbackCh1(DAC_HandleTypeDef *hdac); | |||
| void HAL_DAC_DMAUnderrunCallbackCh1(DAC_HandleTypeDef *hdac); | |||
| #if (USE_HAL_DAC_REGISTER_CALLBACKS == 1) | |||
| /* DAC callback registering/unregistering */ | |||
| HAL_StatusTypeDef HAL_DAC_RegisterCallback(DAC_HandleTypeDef *hdac, HAL_DAC_CallbackIDTypeDef CallbackId, pDAC_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_DAC_UnRegisterCallback(DAC_HandleTypeDef *hdac, HAL_DAC_CallbackIDTypeDef CallbackId); | |||
| #endif /* USE_HAL_DAC_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -474,7 +515,7 @@ uint32_t HAL_DAC_GetError(DAC_HandleTypeDef *hdac); | |||
| #endif | |||
| #endif /*__STM32H7xx_HAL_DAC_H */ | |||
| #endif /*STM32H7xx_HAL_DAC_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_dac_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of DAC HAL Extended module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_DAC_EX_H | |||
| #define __STM32H7xx_HAL_DAC_EX_H | |||
| #ifndef STM32H7xx_HAL_DAC_EX_H | |||
| #define STM32H7xx_HAL_DAC_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -68,30 +50,30 @@ | |||
| /** @defgroup DACEx_lfsrunmask_triangleamplitude DACEx lfsrunmask triangle amplitude | |||
| * @{ | |||
| */ | |||
| #define DAC_LFSRUNMASK_BIT0 ((uint32_t)0x00000000) /*!< Unmask DAC channel LFSR bit0 for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS1_0 ((uint32_t)DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[1:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS2_0 ((uint32_t)DAC_CR_MAMP1_1) /*!< Unmask DAC channel LFSR bit[2:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS3_0 ((uint32_t)DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0)/*!< Unmask DAC channel LFSR bit[3:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS4_0 ((uint32_t)DAC_CR_MAMP1_2) /*!< Unmask DAC channel LFSR bit[4:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS5_0 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[5:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS6_0 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1) /*!< Unmask DAC channel LFSR bit[6:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS7_0 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[7:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS8_0 ((uint32_t)DAC_CR_MAMP1_3) /*!< Unmask DAC channel LFSR bit[8:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS9_0 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[9:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS10_0 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1) /*!< Unmask DAC channel LFSR bit[10:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS11_0 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[11:0] for noise wave generation */ | |||
| #define DAC_TRIANGLEAMPLITUDE_1 ((uint32_t)0x00000000) /*!< Select max triangle amplitude of 1 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_3 ((uint32_t)DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 3 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_7 ((uint32_t)DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 7 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_15 ((uint32_t)DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 15 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_31 ((uint32_t)DAC_CR_MAMP1_2) /*!< Select max triangle amplitude of 31 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_63 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 63 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_127 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 127 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_255 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 255 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_511 ((uint32_t)DAC_CR_MAMP1_3) /*!< Select max triangle amplitude of 511 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_1023 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 1023 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_2047 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 2047 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_4095 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 4095 */ | |||
| #define DAC_LFSRUNMASK_BIT0 0x00000000U /*!< Unmask DAC channel LFSR bit0 for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS1_0 ( DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[1:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS2_0 ( DAC_CR_MAMP1_1 ) /*!< Unmask DAC channel LFSR bit[2:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS3_0 ( DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[3:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS4_0 ( DAC_CR_MAMP1_2 ) /*!< Unmask DAC channel LFSR bit[4:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS5_0 ( DAC_CR_MAMP1_2 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[5:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS6_0 ( DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 ) /*!< Unmask DAC channel LFSR bit[6:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS7_0 ( DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[7:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS8_0 (DAC_CR_MAMP1_3 ) /*!< Unmask DAC channel LFSR bit[8:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS9_0 (DAC_CR_MAMP1_3 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[9:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS10_0 (DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 ) /*!< Unmask DAC channel LFSR bit[10:0] for noise wave generation */ | |||
| #define DAC_LFSRUNMASK_BITS11_0 (DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[11:0] for noise wave generation */ | |||
| #define DAC_TRIANGLEAMPLITUDE_1 0x00000000U /*!< Select max triangle amplitude of 1 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_3 ( DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 3 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_7 ( DAC_CR_MAMP1_1 ) /*!< Select max triangle amplitude of 7 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_15 ( DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 15 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_31 ( DAC_CR_MAMP1_2 ) /*!< Select max triangle amplitude of 31 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_63 ( DAC_CR_MAMP1_2 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 63 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_127 ( DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 ) /*!< Select max triangle amplitude of 127 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_255 ( DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 255 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_511 (DAC_CR_MAMP1_3 ) /*!< Select max triangle amplitude of 511 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_1023 (DAC_CR_MAMP1_3 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 1023 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_2047 (DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 ) /*!< Select max triangle amplitude of 2047 */ | |||
| #define DAC_TRIANGLEAMPLITUDE_4095 (DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 4095 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -125,17 +107,17 @@ | |||
| ((TRIGGER) == DAC_TRIGGER_EXT_IT9) || \ | |||
| ((TRIGGER) == DAC_TRIGGER_SOFTWARE)) | |||
| #define IS_DAC_SAMPLETIME(TIME) ((TIME) <= 0x000003FF) | |||
| #define IS_DAC_SAMPLETIME(TIME) ((TIME) <= 0x000003FFU) | |||
| #define IS_DAC_HOLDTIME(TIME) ((TIME) <= 0x000003FF) | |||
| #define IS_DAC_HOLDTIME(TIME) ((TIME) <= 0x000003FFU) | |||
| #define IS_DAC_SAMPLEANDHOLD(MODE) (((MODE) == DAC_SAMPLEANDHOLD_DISABLE) || \ | |||
| ((MODE) == DAC_SAMPLEANDHOLD_ENABLE)) | |||
| #define IS_DAC_TRIMMINGVALUE(TRIMMINGVALUE) ((TRIMMINGVALUE) <= 0x1F) | |||
| #define IS_DAC_TRIMMINGVALUE(TRIMMINGVALUE) ((TRIMMINGVALUE) <= 0x1FU) | |||
| #define IS_DAC_NEWTRIMMINGVALUE(TRIMMINGVALUE) ((TRIMMINGVALUE) <= 0x1F) | |||
| #define IS_DAC_NEWTRIMMINGVALUE(TRIMMINGVALUE) ((TRIMMINGVALUE) <= 0x1FU) | |||
| #define IS_DAC_CHIP_CONNECTION(CONNECT) (((CONNECT) == DAC_CHIPCONNECT_DISABLE) || \ | |||
| ((CONNECT) == DAC_CHIPCONNECT_ENABLE)) | |||
| @@ -243,6 +225,6 @@ void DAC_DMAHalfConvCpltCh2(DMA_HandleTypeDef *hdma); | |||
| } | |||
| #endif | |||
| #endif /*__STM32H7xx_HAL_DAC_EX_H */ | |||
| #endif /*STM32H7xx_HAL_DAC_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_dcmi.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of DCMI HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_DCMI_H | |||
| #define __STM32H7xx_HAL_DCMI_H | |||
| #ifndef STM32H7xx_HAL_DCMI_H | |||
| #define STM32H7xx_HAL_DCMI_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -46,7 +28,7 @@ | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_hal_def.h" | |||
| #if defined (DCMI) | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| @@ -129,7 +111,11 @@ typedef struct | |||
| /** | |||
| * @brief DCMI handle Structure definition | |||
| */ | |||
| #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1) | |||
| typedef struct __DCMI_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */ | |||
| { | |||
| DCMI_TypeDef *Instance; /*!< DCMI Register base address */ | |||
| @@ -151,7 +137,40 @@ typedef struct | |||
| __IO uint32_t ErrorCode; /*!< DCMI Error code */ | |||
| #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1) | |||
| void (* LineEventCallback) ( struct __DCMI_HandleTypeDef * hdcmi); /*!< DCMI Line Event callback */ | |||
| void (* FrameEventCallback) ( struct __DCMI_HandleTypeDef * hdcmi); /*!< DCMI Frame Event callback */ | |||
| void (* VsyncEventCallback) ( struct __DCMI_HandleTypeDef * hdcmi); /*!< DCMI Vsync Event callback */ | |||
| void (* ErrorCallback) ( struct __DCMI_HandleTypeDef * hdcmi); /*!< DCMI Error callback */ | |||
| void (* MspInitCallback) ( struct __DCMI_HandleTypeDef * hdcmi); /*!< DCMI Msp Init callback */ | |||
| void (* MspDeInitCallback) ( struct __DCMI_HandleTypeDef * hdcmi); /*!< DCMI Msp DeInit callback */ | |||
| #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */ | |||
| }DCMI_HandleTypeDef; | |||
| #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL DCMI Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_DCMI_FRAME_EVENT_CB_ID = 0x00U, /*!< DCMI Frame event Callback ID */ | |||
| HAL_DCMI_VSYNC_EVENT_CB_ID = 0x01U, /*!< DCMI Vsync event Callback ID */ | |||
| HAL_DCMI_LINE_EVENT_CB_ID = 0x02U, /*!< DCMI Line event Callback ID */ | |||
| HAL_DCMI_ERROR_CB_ID = 0x03U, /*!< DCMI Error Callback ID */ | |||
| HAL_DCMI_MSPINIT_CB_ID = 0x04U, /*!< DCMI MspInit callback ID */ | |||
| HAL_DCMI_MSPDEINIT_CB_ID = 0x05U /*!< DCMI MspDeInit callback ID */ | |||
| }HAL_DCMI_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL DCMI Callback pointer definition | |||
| */ | |||
| typedef void (*pDCMI_CallbackTypeDef)(DCMI_HandleTypeDef * hdcmi); /*!< pointer to a DCMI callback function */ | |||
| #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -169,6 +188,9 @@ typedef struct | |||
| #define HAL_DCMI_ERROR_SYNC (0x00000002U) /*!< Synchronization error */ | |||
| #define HAL_DCMI_ERROR_TIMEOUT (0x00000020U) /*!< Timeout error */ | |||
| #define HAL_DCMI_ERROR_DMA (0x00000040U) /*!< DMA error */ | |||
| #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1) | |||
| #define HAL_DCMI_ERROR_INVALID_CALLBACK ((uint32_t)0x00000080U) /*!< Invalid Callback error */ | |||
| #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -371,21 +393,29 @@ typedef struct | |||
| */ | |||
| /** @brief Reset DCMI handle state | |||
| * @param __HANDLE__: specifies the DCMI handle. | |||
| * @param __HANDLE__ specifies the DCMI handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->State = HAL_DCMI_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DCMI_STATE_RESET) | |||
| #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @brief Enable the DCMI. | |||
| * @param __HANDLE__: DCMI handle | |||
| * @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 | |||
| * @param __HANDLE__ DCMI handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DCMI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(DCMI_CR_ENABLE)) | |||
| @@ -393,8 +423,8 @@ typedef struct | |||
| /* Interrupt & Flag management */ | |||
| /** | |||
| * @brief Get the DCMI pending flag. | |||
| * @param __HANDLE__: DCMI handle | |||
| * @param __FLAG__: Get the specified 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) | |||
| @@ -417,8 +447,8 @@ typedef struct | |||
| /** | |||
| * @brief Clear the DCMI pending flags. | |||
| * @param __HANDLE__: DCMI handle | |||
| * @param __FLAG__: specifies the flag to clear. | |||
| * @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_OVFRI: Overflow flag mask | |||
| @@ -431,8 +461,8 @@ typedef struct | |||
| /** | |||
| * @brief Enable the specified DCMI interrupts. | |||
| * @param __HANDLE__: DCMI handle | |||
| * @param __INTERRUPT__: specifies the DCMI interrupt sources to be enabled. | |||
| * @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_OVF: Overflow interrupt mask | |||
| @@ -445,8 +475,8 @@ typedef struct | |||
| /** | |||
| * @brief Disable the specified DCMI interrupts. | |||
| * @param __HANDLE__: DCMI handle | |||
| * @param __INTERRUPT__: specifies the DCMI interrupt sources to be enabled. | |||
| * @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_OVF: Overflow interrupt mask | |||
| @@ -459,8 +489,8 @@ typedef struct | |||
| /** | |||
| * @brief Check whether the specified DCMI interrupt has occurred or not. | |||
| * @param __HANDLE__: DCMI handle | |||
| * @param __INTERRUPT__: specifies the DCMI interrupt source to check. | |||
| * @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_OVF: Overflow interrupt mask | |||
| @@ -488,6 +518,13 @@ 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); | |||
| /* Callbacks Register/UnRegister functions ***********************************/ | |||
| #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1) | |||
| HAL_StatusTypeDef HAL_DCMI_RegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID, pDCMI_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_DCMI_UnRegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID); | |||
| #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -615,10 +652,12 @@ uint32_t HAL_DCMI_GetError(DCMI_HandleTypeDef *hdcmi); | |||
| * @} | |||
| */ | |||
| #endif /* DCMI */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_DCMI_H */ | |||
| #endif /* STM32H7xx_HAL_DCMI_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,43 +2,25 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_def.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief This file contains HAL common defines, enumeration, macros and | |||
| * structures definitions. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_DEF | |||
| #define __STM32H7xx_HAL_DEF | |||
| #ifndef STM32H7xx_HAL_DEF | |||
| #define STM32H7xx_HAL_DEF | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -47,7 +29,8 @@ | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx.h" | |||
| #include "Legacy/stm32_hal_legacy.h" | |||
| #include <stdio.h> | |||
| #include <stddef.h> | |||
| #include <math.h> | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| @@ -72,14 +55,11 @@ typedef enum | |||
| } HAL_LockTypeDef; | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| #ifndef NULL | |||
| #define NULL (void *) 0 | |||
| #endif | |||
| #define HAL_MAX_DELAY 0xFFFFFFFF | |||
| #define HAL_MAX_DELAY 0xFFFFFFFFU | |||
| #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET) | |||
| #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET) | |||
| #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) == (BIT)) | |||
| #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U) | |||
| #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \ | |||
| do{ \ | |||
| @@ -180,14 +160,14 @@ typedef enum | |||
| Available memory areas are declared in the 'Target' tab of the 'Options for Target' | |||
| dialog. | |||
| */ | |||
| #define __RAM_FUNC HAL_StatusTypeDef | |||
| #define __RAM_FUNC | |||
| #elif defined ( __ICCARM__ ) | |||
| /* ICCARM Compiler | |||
| --------------- | |||
| RAM functions are defined using a specific toolchain keyword "__ramfunc". | |||
| */ | |||
| #define __RAM_FUNC __ramfunc HAL_StatusTypeDef | |||
| #define __RAM_FUNC __ramfunc | |||
| #elif defined ( __GNUC__ ) | |||
| /* GNU Compiler | |||
| @@ -195,7 +175,7 @@ typedef enum | |||
| RAM functions are defined using a specific toolchain attribute | |||
| "__attribute__((section(".RamFunc")))". | |||
| */ | |||
| #define __RAM_FUNC HAL_StatusTypeDef __attribute__((section(".RamFunc"))) | |||
| #define __RAM_FUNC __attribute__((section(".RamFunc"))) | |||
| #endif | |||
| @@ -203,6 +183,6 @@ typedef enum | |||
| } | |||
| #endif | |||
| #endif /* ___STM32H7xx_HAL_DEF */ | |||
| #endif /* STM32H7xx_HAL_DEF */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_dfsdm.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of DFSDM HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_DFSDM_H | |||
| #define __STM32H7xx_HAL_DFSDM_H | |||
| #ifndef STM32H7xx_HAL_DFSDM_H | |||
| #define STM32H7xx_HAL_DFSDM_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -64,9 +46,9 @@ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_DFSDM_CHANNEL_STATE_RESET = 0x00, /*!< DFSDM channel not initialized */ | |||
| HAL_DFSDM_CHANNEL_STATE_READY = 0x01, /*!< DFSDM channel initialized and ready for use */ | |||
| HAL_DFSDM_CHANNEL_STATE_ERROR = 0xFF /*!< DFSDM channel state error */ | |||
| 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; | |||
| /** | |||
| @@ -134,24 +116,52 @@ typedef struct | |||
| /** | |||
| * @brief DFSDM channel handle structure definition | |||
| */ | |||
| #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1) | |||
| typedef struct __DFSDM_Channel_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_DFSDM_REGISTER_CALLBACKS */ | |||
| { | |||
| DFSDM_Channel_TypeDef *Instance; /*!< DFSDM channel instance */ | |||
| DFSDM_Channel_InitTypeDef Init; /*!< DFSDM channel init parameters */ | |||
| HAL_DFSDM_Channel_StateTypeDef State; /*!< DFSDM channel state */ | |||
| #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1) | |||
| void (*CkabCallback) (struct __DFSDM_Channel_HandleTypeDef *hdfsdm_channel); /*!< DFSDM channel clock absence detection callback */ | |||
| void (*ScdCallback) (struct __DFSDM_Channel_HandleTypeDef *hdfsdm_channel); /*!< DFSDM channel short circuit detection callback */ | |||
| void (*MspInitCallback) (struct __DFSDM_Channel_HandleTypeDef *hdfsdm_channel); /*!< DFSDM channel MSP init callback */ | |||
| void (*MspDeInitCallback) (struct __DFSDM_Channel_HandleTypeDef *hdfsdm_channel); /*!< DFSDM channel MSP de-init callback */ | |||
| #endif | |||
| }DFSDM_Channel_HandleTypeDef; | |||
| #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief DFSDM channel callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_DFSDM_CHANNEL_CKAB_CB_ID = 0x00U, /*!< DFSDM channel clock absence detection callback ID */ | |||
| HAL_DFSDM_CHANNEL_SCD_CB_ID = 0x01U, /*!< DFSDM channel short circuit detection callback ID */ | |||
| HAL_DFSDM_CHANNEL_MSPINIT_CB_ID = 0x02U, /*!< DFSDM channel MSP init callback ID */ | |||
| HAL_DFSDM_CHANNEL_MSPDEINIT_CB_ID = 0x03U /*!< DFSDM channel MSP de-init callback ID */ | |||
| }HAL_DFSDM_Channel_CallbackIDTypeDef; | |||
| /** | |||
| * @brief DFSDM channel callback pointer definition | |||
| */ | |||
| typedef void (*pDFSDM_Channel_CallbackTypeDef)(DFSDM_Channel_HandleTypeDef *hdfsdm_channel); | |||
| #endif | |||
| /** | |||
| * @brief HAL DFSDM Filter states definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_DFSDM_FILTER_STATE_RESET = 0x00, /*!< DFSDM filter not initialized */ | |||
| HAL_DFSDM_FILTER_STATE_READY = 0x01, /*!< DFSDM filter initialized and ready for use */ | |||
| HAL_DFSDM_FILTER_STATE_REG = 0x02, /*!< DFSDM filter regular conversion in progress */ | |||
| HAL_DFSDM_FILTER_STATE_INJ = 0x03, /*!< DFSDM filter injected conversion in progress */ | |||
| HAL_DFSDM_FILTER_STATE_REG_INJ = 0x04, /*!< DFSDM filter regular and injected conversions in progress */ | |||
| HAL_DFSDM_FILTER_STATE_ERROR = 0xFF /*!< DFSDM filter state error */ | |||
| 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; | |||
| /** | |||
| @@ -206,7 +216,11 @@ typedef struct | |||
| /** | |||
| * @brief DFSDM filter handle structure definition | |||
| */ | |||
| #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1) | |||
| typedef struct __DFSDM_Filter_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_DFSDM_REGISTER_CALLBACKS */ | |||
| { | |||
| DFSDM_Filter_TypeDef *Instance; /*!< DFSDM filter instance */ | |||
| DFSDM_Filter_InitTypeDef Init; /*!< DFSDM filter init parameters */ | |||
| @@ -221,6 +235,17 @@ typedef struct | |||
| uint32_t InjConvRemaining; /*!< Injected conversions remaining */ | |||
| HAL_DFSDM_Filter_StateTypeDef State; /*!< DFSDM filter state */ | |||
| uint32_t ErrorCode; /*!< DFSDM filter error code */ | |||
| #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1) | |||
| void (*AwdCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter, | |||
| uint32_t Channel, uint32_t Threshold); /*!< DFSDM filter analog watchdog callback */ | |||
| void (*RegConvCpltCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter regular conversion complete callback */ | |||
| void (*RegConvHalfCpltCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter half regular conversion complete callback */ | |||
| void (*InjConvCpltCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter injected conversion complete callback */ | |||
| void (*InjConvHalfCpltCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter half injected conversion complete callback */ | |||
| void (*ErrorCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter error callback */ | |||
| void (*MspInitCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter MSP init callback */ | |||
| void (*MspDeInitCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter MSP de-init callback */ | |||
| #endif | |||
| }DFSDM_Filter_HandleTypeDef; | |||
| /** | |||
| @@ -242,6 +267,28 @@ typedef struct | |||
| This parameter can be a values combination of @ref DFSDM_BreakSignals */ | |||
| }DFSDM_Filter_AwdParamTypeDef; | |||
| #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief DFSDM filter callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_DFSDM_FILTER_REGCONV_COMPLETE_CB_ID = 0x00U, /*!< DFSDM filter regular conversion complete callback ID */ | |||
| HAL_DFSDM_FILTER_REGCONV_HALFCOMPLETE_CB_ID = 0x01U, /*!< DFSDM filter half regular conversion complete callback ID */ | |||
| HAL_DFSDM_FILTER_INJCONV_COMPLETE_CB_ID = 0x02U, /*!< DFSDM filter injected conversion complete callback ID */ | |||
| HAL_DFSDM_FILTER_INJCONV_HALFCOMPLETE_CB_ID = 0x03U, /*!< DFSDM filter half injected conversion complete callback ID */ | |||
| HAL_DFSDM_FILTER_ERROR_CB_ID = 0x04U, /*!< DFSDM filter error callback ID */ | |||
| HAL_DFSDM_FILTER_MSPINIT_CB_ID = 0x05U, /*!< DFSDM filter MSP init callback ID */ | |||
| HAL_DFSDM_FILTER_MSPDEINIT_CB_ID = 0x06U /*!< DFSDM filter MSP de-init callback ID */ | |||
| }HAL_DFSDM_Filter_CallbackIDTypeDef; | |||
| /** | |||
| * @brief DFSDM filter callback pointer definition | |||
| */ | |||
| typedef void (*pDFSDM_Filter_CallbackTypeDef)(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| typedef void (*pDFSDM_Filter_AwdCallbackTypeDef)(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel, uint32_t Threshold); | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -255,7 +302,7 @@ typedef struct | |||
| /** @defgroup DFSDM_Channel_OuputClock DFSDM channel output clock selection | |||
| * @{ | |||
| */ | |||
| #define DFSDM_CHANNEL_OUTPUT_CLOCK_SYSTEM ((uint32_t)0x00000000) /*!< Source for ouput clock is system clock */ | |||
| #define DFSDM_CHANNEL_OUTPUT_CLOCK_SYSTEM 0x00000000U /*!< Source for ouput clock is system clock */ | |||
| #define DFSDM_CHANNEL_OUTPUT_CLOCK_AUDIO DFSDM_CHCFGR1_CKOUTSRC /*!< Source for ouput clock is audio clock */ | |||
| /** | |||
| * @} | |||
| @@ -264,7 +311,7 @@ typedef struct | |||
| /** @defgroup DFSDM_Channel_InputMultiplexer DFSDM channel input multiplexer | |||
| * @{ | |||
| */ | |||
| #define DFSDM_CHANNEL_EXTERNAL_INPUTS ((uint32_t)0x00000000) /*!< Data are taken from external inputs */ | |||
| #define DFSDM_CHANNEL_EXTERNAL_INPUTS 0x00000000U /*!< Data are taken from external inputs */ | |||
| #define DFSDM_CHANNEL_ADC_OUTPUT DFSDM_CHCFGR1_DATMPX_0 /*!< Data are taken from ADC output */ | |||
| #define DFSDM_CHANNEL_INTERNAL_REGISTER DFSDM_CHCFGR1_DATMPX_1 /*!< Data are taken from internal register */ | |||
| /** | |||
| @@ -274,7 +321,7 @@ typedef struct | |||
| /** @defgroup DFSDM_Channel_DataPacking DFSDM channel input data packing | |||
| * @{ | |||
| */ | |||
| #define DFSDM_CHANNEL_STANDARD_MODE ((uint32_t)0x00000000) /*!< Standard data packing mode */ | |||
| #define DFSDM_CHANNEL_STANDARD_MODE 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 */ | |||
| /** | |||
| @@ -284,7 +331,7 @@ typedef struct | |||
| /** @defgroup DFSDM_Channel_InputPins DFSDM channel input pins | |||
| * @{ | |||
| */ | |||
| #define DFSDM_CHANNEL_SAME_CHANNEL_PINS ((uint32_t)0x00000000) /*!< Input from pins on same channel */ | |||
| #define DFSDM_CHANNEL_SAME_CHANNEL_PINS 0x00000000U /*!< Input from pins on same channel */ | |||
| #define DFSDM_CHANNEL_FOLLOWING_CHANNEL_PINS DFSDM_CHCFGR1_CHINSEL /*!< Input from pins on following channel */ | |||
| /** | |||
| * @} | |||
| @@ -293,7 +340,7 @@ typedef struct | |||
| /** @defgroup DFSDM_Channel_SerialInterfaceType DFSDM channel serial interface type | |||
| * @{ | |||
| */ | |||
| #define DFSDM_CHANNEL_SPI_RISING ((uint32_t)0x00000000) /*!< SPI with rising edge */ | |||
| #define DFSDM_CHANNEL_SPI_RISING 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 */ | |||
| @@ -304,7 +351,7 @@ typedef struct | |||
| /** @defgroup DFSDM_Channel_SpiClock DFSDM channel SPI clock selection | |||
| * @{ | |||
| */ | |||
| #define DFSDM_CHANNEL_SPI_CLOCK_EXTERNAL ((uint32_t)0x00000000) /*!< External SPI clock */ | |||
| #define DFSDM_CHANNEL_SPI_CLOCK_EXTERNAL 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 */ | |||
| @@ -315,7 +362,7 @@ typedef struct | |||
| /** @defgroup DFSDM_Channel_AwdFilterOrder DFSDM channel analog watchdog filter order | |||
| * @{ | |||
| */ | |||
| #define DFSDM_CHANNEL_FASTSINC_ORDER ((uint32_t)0x00000000) /*!< FastSinc filter type */ | |||
| #define DFSDM_CHANNEL_FASTSINC_ORDER 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 */ | |||
| @@ -326,9 +373,9 @@ typedef struct | |||
| /** @defgroup DFSDM_Filter_Trigger DFSDM filter conversion trigger | |||
| * @{ | |||
| */ | |||
| #define DFSDM_FILTER_SW_TRIGGER ((uint32_t)0x00000000) /*!< Software trigger */ | |||
| #define DFSDM_FILTER_SYNC_TRIGGER ((uint32_t)0x00000001) /*!< Synchronous with DFSDM0 */ | |||
| #define DFSDM_FILTER_EXT_TRIGGER ((uint32_t)0x00000002) /*!< External trigger (only for injected conversion) */ | |||
| #define DFSDM_FILTER_SW_TRIGGER 0x00000000U /*!< Software trigger */ | |||
| #define DFSDM_FILTER_SYNC_TRIGGER 0x00000001U /*!< Synchronous with DFSDM_FLT0 */ | |||
| #define DFSDM_FILTER_EXT_TRIGGER 0x00000002U /*!< External trigger (only for injected conversion) */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -336,22 +383,22 @@ typedef struct | |||
| /** @defgroup DFSDM_Filter_ExtTrigger DFSDM filter external trigger | |||
| * @{ | |||
| */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM1_TRGO ((uint32_t)0x00000000) /*!< For DFSDM 0, 1, 2 and 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM1_TRGO2 DFSDM_FLTCR1_JEXTSEL_0 /*!< For DFSDM 0, 1, 2 and 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM8_TRGO DFSDM_FLTCR1_JEXTSEL_1 /*!< For DFSDM 0, 1, 2 and 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM8_TRGO2 (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM 0, 1 and 2 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM3_TRGO DFSDM_FLTCR1_JEXTSEL_2 /*!< For DFSDM 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM4_TRGO (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM 0, 1 and 2 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM16_OC1 (DFSDM_FLTCR1_JEXTSEL_2 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM6_TRGO (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM 0 and 1 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM7_TRGO DFSDM_FLTCR1_JEXTSEL_3 /*!< For DFSDM 2 and 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM1_TRGO 0x00000000U /*!< For DFSDM 0, 1, 2 and 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM1_TRGO2 DFSDM_FLTCR1_JEXTSEL_0 /*!< For DFSDM 0, 1, 2 and 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM8_TRGO DFSDM_FLTCR1_JEXTSEL_1 /*!< For DFSDM 0, 1, 2 and 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM8_TRGO2 (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM 0, 1 and 2 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM3_TRGO DFSDM_FLTCR1_JEXTSEL_2 /*!< For DFSDM 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM4_TRGO (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM 0, 1 and 2 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM16_OC1 (DFSDM_FLTCR1_JEXTSEL_2 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM6_TRGO (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM 0 and 1 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_TIM7_TRGO DFSDM_FLTCR1_JEXTSEL_3 /*!< For DFSDM 2 and 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_HRTIM1_ADCTRG1 (DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_0) | |||
| #define DFSDM_FILTER_EXT_TRIG_HRTIM1_ADCTRG3 (DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_1) | |||
| #define DFSDM_FILTER_EXT_TRIG_EXTI11 (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3) /*!< For DFSDM 0, 1, 2 and 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_EXTI15 (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_0) /*!< For DFSDM 0, 1, 2 and 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_LPTIM1 (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM 0, 1, 2 and 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_LPTIM2 (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_1 | DFSDM_FLTCR1_JEXTSEL_0) /*!< For DFSDM 0, 1, 2 and 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_LPTIM3 (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM 0, 1, 2 and 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_EXTI11 (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3) /*!< For DFSDM 0, 1, 2 and 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_EXTI15 (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_0) /*!< For DFSDM 0, 1, 2 and 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_LPTIM1_OUT (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM 0, 1, 2 and 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_LPTIM2_OUT (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_1 | DFSDM_FLTCR1_JEXTSEL_0) /*!< For DFSDM 0, 1, 2 and 3 */ | |||
| #define DFSDM_FILTER_EXT_TRIG_LPTIM3_OUT (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM 0, 1, 2 and 3 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -369,7 +416,7 @@ typedef struct | |||
| /** @defgroup DFSDM_Filter_SincOrder DFSDM filter sinc order | |||
| * @{ | |||
| */ | |||
| #define DFSDM_FILTER_FASTSINC_ORDER ((uint32_t)0x00000000) /*!< FastSinc filter type */ | |||
| #define DFSDM_FILTER_FASTSINC_ORDER 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 */ | |||
| @@ -382,7 +429,7 @@ typedef struct | |||
| /** @defgroup DFSDM_Filter_AwdDataSource DFSDM filter analog watchdog data source | |||
| * @{ | |||
| */ | |||
| #define DFSDM_FILTER_AWD_FILTER_DATA ((uint32_t)0x00000000) /*!< From digital filter */ | |||
| #define DFSDM_FILTER_AWD_FILTER_DATA 0x00000000U /*!< From digital filter */ | |||
| #define DFSDM_FILTER_AWD_CHANNEL_DATA DFSDM_FLTCR1_AWFSEL /*!< From analog watchdog channel */ | |||
| /** | |||
| * @} | |||
| @@ -391,10 +438,13 @@ typedef struct | |||
| /** @defgroup DFSDM_Filter_ErrorCode DFSDM filter error code | |||
| * @{ | |||
| */ | |||
| #define DFSDM_FILTER_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */ | |||
| #define DFSDM_FILTER_ERROR_REGULAR_OVERRUN ((uint32_t)0x00000001) /*!< Overrun occurs during regular conversion */ | |||
| #define DFSDM_FILTER_ERROR_INJECTED_OVERRUN ((uint32_t)0x00000002) /*!< Overrun occurs during injected conversion */ | |||
| #define DFSDM_FILTER_ERROR_DMA ((uint32_t)0x00000003) /*!< DMA error occurs */ | |||
| #define DFSDM_FILTER_ERROR_NONE 0x00000000U /*!< No error */ | |||
| #define DFSDM_FILTER_ERROR_REGULAR_OVERRUN 0x00000001U /*!< Overrun occurs during regular conversion */ | |||
| #define DFSDM_FILTER_ERROR_INJECTED_OVERRUN 0x00000002U /*!< Overrun occurs during injected conversion */ | |||
| #define DFSDM_FILTER_ERROR_DMA 0x00000003U /*!< DMA error occurs */ | |||
| #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1) | |||
| #define DFSDM_FILTER_ERROR_INVALID_CALLBACK 0x00000004U /*!< Invalid callback error occurs */ | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -402,11 +452,11 @@ typedef struct | |||
| /** @defgroup DFSDM_BreakSignals DFSDM break signals | |||
| * @{ | |||
| */ | |||
| #define DFSDM_NO_BREAK_SIGNAL ((uint32_t)0x00000000) /*!< No break signal */ | |||
| #define DFSDM_BREAK_SIGNAL_0 ((uint32_t)0x00000001) /*!< Break signal 0 */ | |||
| #define DFSDM_BREAK_SIGNAL_1 ((uint32_t)0x00000002) /*!< Break signal 1 */ | |||
| #define DFSDM_BREAK_SIGNAL_2 ((uint32_t)0x00000004) /*!< Break signal 2 */ | |||
| #define DFSDM_BREAK_SIGNAL_3 ((uint32_t)0x00000008) /*!< Break signal 3 */ | |||
| #define DFSDM_NO_BREAK_SIGNAL 0x00000000U /*!< No break signal */ | |||
| #define DFSDM_BREAK_SIGNAL_0 0x00000001U /*!< Break signal 0 */ | |||
| #define DFSDM_BREAK_SIGNAL_1 0x00000002U /*!< Break signal 1 */ | |||
| #define DFSDM_BREAK_SIGNAL_2 0x00000004U /*!< Break signal 2 */ | |||
| #define DFSDM_BREAK_SIGNAL_3 0x00000008U /*!< Break signal 3 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -422,14 +472,14 @@ typedef struct | |||
| - the channel mask is 0x00000020 (bit 5 is set) | |||
| - the channel number 5 is 0x00050000 | |||
| --> Consequently, channel 5 definition is 0x00000020 | 0x00050000 = 0x00050020 */ | |||
| #define DFSDM_CHANNEL_0 ((uint32_t)0x00000001) | |||
| #define DFSDM_CHANNEL_1 ((uint32_t)0x00010002) | |||
| #define DFSDM_CHANNEL_2 ((uint32_t)0x00020004) | |||
| #define DFSDM_CHANNEL_3 ((uint32_t)0x00030008) | |||
| #define DFSDM_CHANNEL_4 ((uint32_t)0x00040010) | |||
| #define DFSDM_CHANNEL_5 ((uint32_t)0x00050020) | |||
| #define DFSDM_CHANNEL_6 ((uint32_t)0x00060040) | |||
| #define DFSDM_CHANNEL_7 ((uint32_t)0x00070080) | |||
| #define DFSDM_CHANNEL_0 0x00000001U | |||
| #define DFSDM_CHANNEL_1 0x00010002U | |||
| #define DFSDM_CHANNEL_2 0x00020004U | |||
| #define DFSDM_CHANNEL_3 0x00030008U | |||
| #define DFSDM_CHANNEL_4 0x00040010U | |||
| #define DFSDM_CHANNEL_5 0x00050020U | |||
| #define DFSDM_CHANNEL_6 0x00060040U | |||
| #define DFSDM_CHANNEL_7 0x00070080U | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -437,8 +487,8 @@ typedef struct | |||
| /** @defgroup DFSDM_ContinuousMode DFSDM Continuous Mode | |||
| * @{ | |||
| */ | |||
| #define DFSDM_CONTINUOUS_CONV_OFF ((uint32_t)0x00000000) /*!< Conversion are not continuous */ | |||
| #define DFSDM_CONTINUOUS_CONV_ON ((uint32_t)0x00000001) /*!< Conversion are continuous */ | |||
| #define DFSDM_CONTINUOUS_CONV_OFF 0x00000000U /*!< Conversion are not continuous */ | |||
| #define DFSDM_CONTINUOUS_CONV_ON 0x00000001U /*!< Conversion are continuous */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -446,8 +496,8 @@ typedef struct | |||
| /** @defgroup DFSDM_AwdThreshold DFSDM analog watchdog threshold | |||
| * @{ | |||
| */ | |||
| #define DFSDM_AWD_HIGH_THRESHOLD ((uint32_t)0x00000000) /*!< Analog watchdog high threshold */ | |||
| #define DFSDM_AWD_LOW_THRESHOLD ((uint32_t)0x00000001) /*!< Analog watchdog low threshold */ | |||
| #define DFSDM_AWD_HIGH_THRESHOLD 0x00000000U /*!< Analog watchdog high threshold */ | |||
| #define DFSDM_AWD_LOW_THRESHOLD 0x00000001U /*!< Analog watchdog low threshold */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -463,21 +513,37 @@ typedef struct | |||
| */ | |||
| /** @brief Reset DFSDM channel handle state. | |||
| * @param __HANDLE__: DFSDM channel handle. | |||
| * @param __HANDLE__ DFSDM channel handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_DFSDM_CHANNEL_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->State = HAL_DFSDM_CHANNEL_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_DFSDM_CHANNEL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DFSDM_CHANNEL_STATE_RESET) | |||
| #endif | |||
| /** @brief Reset DFSDM filter handle state. | |||
| * @param __HANDLE__: DFSDM filter handle. | |||
| * @param __HANDLE__ DFSDM filter handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_DFSDM_FILTER_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->State = HAL_DFSDM_FILTER_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_DFSDM_FILTER_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DFSDM_FILTER_STATE_RESET) | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| /* End of exported macros -----------------------------------------------------------*/ | |||
| /* End of exported macros ----------------------------------------------------*/ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup DFSDM_Exported_Functions DFSDM Exported Functions | |||
| @@ -492,6 +558,15 @@ HAL_StatusTypeDef HAL_DFSDM_ChannelInit(DFSDM_Channel_HandleTypeDef *hdfsdm_chan | |||
| 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); | |||
| #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1) | |||
| /* Channel callbacks register/unregister functions ****************************/ | |||
| HAL_StatusTypeDef HAL_DFSDM_Channel_RegisterCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, | |||
| HAL_DFSDM_Channel_CallbackIDTypeDef CallbackID, | |||
| pDFSDM_Channel_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_DFSDM_Channel_UnRegisterCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, | |||
| HAL_DFSDM_Channel_CallbackIDTypeDef CallbackID); | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -539,6 +614,18 @@ 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); | |||
| #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1) | |||
| /* Filter callbacks register/unregister functions ****************************/ | |||
| HAL_StatusTypeDef HAL_DFSDM_Filter_RegisterCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, | |||
| HAL_DFSDM_Filter_CallbackIDTypeDef CallbackID, | |||
| pDFSDM_Filter_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_DFSDM_Filter_UnRegisterCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, | |||
| HAL_DFSDM_Filter_CallbackIDTypeDef CallbackID); | |||
| HAL_StatusTypeDef HAL_DFSDM_Filter_RegisterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, | |||
| pDFSDM_Filter_AwdCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_DFSDM_Filter_UnRegisterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter); | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -622,7 +709,7 @@ uint32_t HAL_DFSDM_FilterGetError(DFSDM_Filter_HandleTypeDe | |||
| */ | |||
| #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) ((2 <= (DIVIDER)) && ((DIVIDER) <= 256)) | |||
| #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_ADC_OUTPUT) || \ | |||
| ((INPUT) == DFSDM_CHANNEL_INTERNAL_REGISTER)) | |||
| @@ -643,10 +730,10 @@ uint32_t HAL_DFSDM_FilterGetError(DFSDM_Filter_HandleTypeDe | |||
| ((ORDER) == DFSDM_CHANNEL_SINC1_ORDER) || \ | |||
| ((ORDER) == DFSDM_CHANNEL_SINC2_ORDER) || \ | |||
| ((ORDER) == DFSDM_CHANNEL_SINC3_ORDER)) | |||
| #define IS_DFSDM_CHANNEL_FILTER_OVS_RATIO(RATIO) ((1 <= (RATIO)) && ((RATIO) <= 32)) | |||
| #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) <= 0x1F) | |||
| #define IS_DFSDM_CHANNEL_SCD_THRESHOLD(VALUE) ((VALUE) <= 0xFF) | |||
| #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) || \ | |||
| @@ -661,13 +748,13 @@ uint32_t HAL_DFSDM_FilterGetError(DFSDM_Filter_HandleTypeDe | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM16_OC1) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM6_TRGO) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM7_TRGO) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_HRTIM1_ADCTRG1) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_HRTIM1_ADCTRG3) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_HRTIM1_ADCTRG1) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_HRTIM1_ADCTRG3) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI11) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI15) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM1) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM2) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM3)) | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM1_OUT) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM2_OUT) || \ | |||
| ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM3_OUT)) | |||
| #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)) | |||
| @@ -677,12 +764,12 @@ uint32_t HAL_DFSDM_FilterGetError(DFSDM_Filter_HandleTypeDe | |||
| ((ORDER) == DFSDM_FILTER_SINC3_ORDER) || \ | |||
| ((ORDER) == DFSDM_FILTER_SINC4_ORDER) || \ | |||
| ((ORDER) == DFSDM_FILTER_SINC5_ORDER)) | |||
| #define IS_DFSDM_FILTER_OVS_RATIO(RATIO) ((1 <= (RATIO)) && ((RATIO) <= 1024)) | |||
| #define IS_DFSDM_FILTER_INTEGRATOR_OVS_RATIO(RATIO) ((1 <= (RATIO)) && ((RATIO) <= 256)) | |||
| #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) <= 0xF) | |||
| #define IS_DFSDM_BREAK_SIGNALS(VALUE) ((VALUE) <= 0xFU) | |||
| #define IS_DFSDM_REGULAR_CHANNEL(CHANNEL) (((CHANNEL) == DFSDM_CHANNEL_0) || \ | |||
| ((CHANNEL) == DFSDM_CHANNEL_1) || \ | |||
| ((CHANNEL) == DFSDM_CHANNEL_2) || \ | |||
| @@ -691,13 +778,13 @@ uint32_t HAL_DFSDM_FilterGetError(DFSDM_Filter_HandleTypeDe | |||
| ((CHANNEL) == DFSDM_CHANNEL_5) || \ | |||
| ((CHANNEL) == DFSDM_CHANNEL_6) || \ | |||
| ((CHANNEL) == DFSDM_CHANNEL_7)) | |||
| #define IS_DFSDM_INJECTED_CHANNEL(CHANNEL) (((CHANNEL) != 0) && ((CHANNEL) <= 0x000F00FF)) | |||
| #define IS_DFSDM_INJECTED_CHANNEL(CHANNEL) (((CHANNEL) != 0U) && ((CHANNEL) <= 0x000F00FFU)) | |||
| #define IS_DFSDM_CONTINUOUS_MODE(MODE) (((MODE) == DFSDM_CONTINUOUS_CONV_OFF) || \ | |||
| ((MODE) == DFSDM_CONTINUOUS_CONV_ON)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* End of private macros ------------------------------------------------------------*/ | |||
| /* End of private macros -----------------------------------------------------*/ | |||
| /** | |||
| * @} | |||
| @@ -711,6 +798,6 @@ uint32_t HAL_DFSDM_FilterGetError(DFSDM_Filter_HandleTypeDe | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_DFSDM_H */ | |||
| #endif /* STM32H7xx_HAL_DFSDM_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_dma.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of DMA HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_DMA_H | |||
| #define __STM32H7xx_HAL_DMA_H | |||
| #ifndef STM32H7xx_HAL_DMA_H | |||
| #define STM32H7xx_HAL_DMA_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -233,7 +215,7 @@ typedef struct __DMA_HandleTypeDef | |||
| * @brief DMA Request selection | |||
| * @{ | |||
| */ | |||
| /* D2 Domain : DMAMUX1 requests */ | |||
| /* DMAMUX1 requests */ | |||
| #define DMA_REQUEST_MEM2MEM 0U /*!< memory to memory transfer */ | |||
| #define DMA_REQUEST_GENERATOR0 1U /*!< DMAMUX1 request generator 0 */ | |||
| @@ -314,8 +296,8 @@ typedef struct __DMA_HandleTypeDef | |||
| #define DMA_REQUEST_UART5_RX 65U /*!< DMAMUX1 UART5 RX request */ | |||
| #define DMA_REQUEST_UART5_TX 66U /*!< DMAMUX1 UART5 TX request */ | |||
| #define DMA_REQUEST_DAC1_CH1 67U /*!< DMAMUX1 DAC1 Channel 1 request */ | |||
| #define DMA_REQUEST_DAC1_CH2 68U /*!< DMAMUX1 DAC1 Channel 2 request */ | |||
| #define DMA_REQUEST_DAC1_CH1 67U /*!< DMAMUX1 DAC1 Channel 1 request */ | |||
| #define DMA_REQUEST_DAC1_CH2 68U /*!< DMAMUX1 DAC1 Channel 2 request */ | |||
| #define DMA_REQUEST_TIM6_UP 69U /*!< DMAMUX1 TIM6 UP request */ | |||
| #define DMA_REQUEST_TIM7_UP 70U /*!< DMAMUX1 TIM7 UP request */ | |||
| @@ -380,10 +362,10 @@ typedef struct __DMA_HandleTypeDef | |||
| #define DMA_REQUEST_SAI3_A 113U /*!< DMAMUX1 SAI3 A request */ | |||
| #define DMA_REQUEST_SAI3_B 114U /*!< DMAMUX1 SAI3 B request */ | |||
| #define DMA_REQUEST_ADC3 115U /*!< DMAMUX1 ADC3 request */ | |||
| #define DMA_REQUEST_ADC3 115U /*!< DMAMUX1 ADC3 request */ | |||
| /* D3 Domain : DMAMUX2 requests */ | |||
| /* DMAMUX2 requests */ | |||
| #define BDMA_REQUEST_MEM2MEM 0U /*!< memory to memory transfer */ | |||
| #define BDMA_REQUEST_GENERATOR0 1U /*!< DMAMUX2 request generator 0 */ | |||
| #define BDMA_REQUEST_GENERATOR1 2U /*!< DMAMUX2 request generator 1 */ | |||
| @@ -442,9 +424,9 @@ typedef struct __DMA_HandleTypeDef | |||
| * @brief DMA peripheral data size | |||
| * @{ | |||
| */ | |||
| #define DMA_PDATAALIGN_BYTE ((uint32_t)0x00000000U) /*!< Peripheral data alignment: Byte */ | |||
| #define DMA_PDATAALIGN_HALFWORD ((uint32_t)DMA_SxCR_PSIZE_0) /*!< Peripheral data alignment: HalfWord */ | |||
| #define DMA_PDATAALIGN_WORD ((uint32_t)DMA_SxCR_PSIZE_1) /*!< Peripheral data alignment: Word */ | |||
| #define DMA_PDATAALIGN_BYTE ((uint32_t)0x00000000U) /*!< Peripheral data alignment: Byte */ | |||
| #define DMA_PDATAALIGN_HALFWORD ((uint32_t)DMA_SxCR_PSIZE_0) /*!< Peripheral data alignment: HalfWord */ | |||
| #define DMA_PDATAALIGN_WORD ((uint32_t)DMA_SxCR_PSIZE_1) /*!< Peripheral data alignment: Word */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -453,7 +435,7 @@ typedef struct __DMA_HandleTypeDef | |||
| * @brief DMA memory data size | |||
| * @{ | |||
| */ | |||
| #define DMA_MDATAALIGN_BYTE ((uint32_t)0x00000000U) /*!< Memory data alignment: Byte */ | |||
| #define DMA_MDATAALIGN_BYTE ((uint32_t)0x00000000U) /*!< Memory data alignment: Byte */ | |||
| #define DMA_MDATAALIGN_HALFWORD ((uint32_t)DMA_SxCR_MSIZE_0) /*!< Memory data alignment: HalfWord */ | |||
| #define DMA_MDATAALIGN_WORD ((uint32_t)DMA_SxCR_MSIZE_1) /*!< Memory data alignment: Word */ | |||
| /** | |||
| @@ -464,9 +446,11 @@ typedef struct __DMA_HandleTypeDef | |||
| * @brief DMA mode | |||
| * @{ | |||
| */ | |||
| #define DMA_NORMAL ((uint32_t)0x00000000U) /*!< Normal mode */ | |||
| #define DMA_CIRCULAR ((uint32_t)DMA_SxCR_CIRC) /*!< Circular mode */ | |||
| #define DMA_PFCTRL ((uint32_t)DMA_SxCR_PFCTRL) /*!< Peripheral flow control mode */ | |||
| #define DMA_NORMAL ((uint32_t)0x00000000U) /*!< Normal mode */ | |||
| #define DMA_CIRCULAR ((uint32_t)DMA_SxCR_CIRC) /*!< Circular mode */ | |||
| #define DMA_PFCTRL ((uint32_t)DMA_SxCR_PFCTRL) /*!< Peripheral flow control mode */ | |||
| #define DMA_DOUBLE_BUFFER_M0 ((uint32_t)DMA_SxCR_DBM) /*!< Double buffer mode with first target memory M0 */ | |||
| #define DMA_DOUBLE_BUFFER_M1 ((uint32_t)(DMA_SxCR_DBM | DMA_SxCR_CT)) /*!< Double buffer mode with first target memory M1 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -475,7 +459,7 @@ typedef struct __DMA_HandleTypeDef | |||
| * @brief DMA priority levels | |||
| * @{ | |||
| */ | |||
| #define DMA_PRIORITY_LOW ((uint32_t)0x00000000U) /*!< Priority level: Low */ | |||
| #define DMA_PRIORITY_LOW ((uint32_t)0x00000000U) /*!< Priority level: Low */ | |||
| #define DMA_PRIORITY_MEDIUM ((uint32_t)DMA_SxCR_PL_0) /*!< Priority level: Medium */ | |||
| #define DMA_PRIORITY_HIGH ((uint32_t)DMA_SxCR_PL_1) /*!< Priority level: High */ | |||
| #define DMA_PRIORITY_VERY_HIGH ((uint32_t)DMA_SxCR_PL) /*!< Priority level: Very High */ | |||
| @@ -546,8 +530,8 @@ typedef struct __DMA_HandleTypeDef | |||
| * @brief DMA flag definitions | |||
| * @{ | |||
| */ | |||
| #define DMA_FLAG_FEIF0_4 ((uint32_t)0x00800001U) | |||
| #define DMA_FLAG_DMEIF0_4 ((uint32_t)0x00800004U) | |||
| #define DMA_FLAG_FEIF0_4 ((uint32_t)0x00000001U) | |||
| #define DMA_FLAG_DMEIF0_4 ((uint32_t)0x00000004U) | |||
| #define DMA_FLAG_TEIF0_4 ((uint32_t)0x00000008U) | |||
| #define DMA_FLAG_HTIF0_4 ((uint32_t)0x00000010U) | |||
| #define DMA_FLAG_TCIF0_4 ((uint32_t)0x00000020U) | |||
| @@ -638,7 +622,7 @@ typedef struct __DMA_HandleTypeDef | |||
| * - DMA_FIFOStatus_Empty: when FIFO is empty | |||
| * - DMA_FIFOStatus_Full: when FIFO is full | |||
| */ | |||
| #define __HAL_DMA_GET_FS(__HANDLE__) ((IS_D2_DMA_INSTANCE(__HANDLE__))? (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->FCR & (DMA_SxFCR_FS)) : 0) | |||
| #define __HAL_DMA_GET_FS(__HANDLE__) ((IS_DMA_STREAM_INSTANCE((__HANDLE__)->Instance))? (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->FCR & (DMA_SxFCR_FS)) : 0) | |||
| /** | |||
| * @brief Enable the specified DMA Stream. | |||
| @@ -646,7 +630,7 @@ typedef struct __DMA_HandleTypeDef | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DMA_ENABLE(__HANDLE__) \ | |||
| ((IS_D2_DMA_INSTANCE(__HANDLE__))? (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->CR |= DMA_SxCR_EN) : \ | |||
| ((IS_DMA_STREAM_INSTANCE((__HANDLE__)->Instance))? (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->CR |= DMA_SxCR_EN) : \ | |||
| (((BDMA_Channel_TypeDef *)(__HANDLE__)->Instance)->CCR |= BDMA_CCR_EN)) | |||
| /** | |||
| @@ -655,7 +639,7 @@ typedef struct __DMA_HandleTypeDef | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DMA_DISABLE(__HANDLE__) \ | |||
| ((IS_D2_DMA_INSTANCE(__HANDLE__))? (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->CR &= ~DMA_SxCR_EN) : \ | |||
| ((IS_DMA_STREAM_INSTANCE((__HANDLE__)->Instance))? (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->CR &= ~DMA_SxCR_EN) : \ | |||
| (((BDMA_Channel_TypeDef *)(__HANDLE__)->Instance)->CCR &= ~BDMA_CCR_EN)) | |||
| /* Interrupt & Flag management */ | |||
| @@ -682,14 +666,14 @@ typedef struct __DMA_HandleTypeDef | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream3))? DMA_FLAG_TCIF3_7 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream7))? DMA_FLAG_TCIF3_7 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream7))? DMA_FLAG_TCIF3_7 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel0))? BDMA_FLAG_TC0 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel1))? BDMA_FLAG_TC1 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel2))? BDMA_FLAG_TC2 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel3))? BDMA_FLAG_TC3 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel4))? BDMA_FLAG_TC4 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel5))? BDMA_FLAG_TC5 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel6))? BDMA_FLAG_TC6 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel7))? BDMA_FLAG_TC7 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel0))? BDMA_FLAG_TC0 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel1))? BDMA_FLAG_TC1 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel2))? BDMA_FLAG_TC2 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel3))? BDMA_FLAG_TC3 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel4))? BDMA_FLAG_TC4 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel5))? BDMA_FLAG_TC5 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel6))? BDMA_FLAG_TC6 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel7))? BDMA_FLAG_TC7 :\ | |||
| (uint32_t)0x00000000) | |||
| /** | |||
| @@ -714,14 +698,14 @@ typedef struct __DMA_HandleTypeDef | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream3))? DMA_FLAG_HTIF3_7 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream7))? DMA_FLAG_HTIF3_7 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream7))? DMA_FLAG_HTIF3_7 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel0))? BDMA_FLAG_HT0 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel1))? BDMA_FLAG_HT1 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel2))? BDMA_FLAG_HT2 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel3))? BDMA_FLAG_HT3 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel4))? BDMA_FLAG_HT4 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel5))? BDMA_FLAG_HT5 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel6))? BDMA_FLAG_HT6 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel7))? BDMA_FLAG_HT7 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel0))? BDMA_FLAG_HT0 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel1))? BDMA_FLAG_HT1 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel2))? BDMA_FLAG_HT2 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel3))? BDMA_FLAG_HT3 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel4))? BDMA_FLAG_HT4 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel5))? BDMA_FLAG_HT5 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel6))? BDMA_FLAG_HT6 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel7))? BDMA_FLAG_HT7 :\ | |||
| (uint32_t)0x00000000) | |||
| /** | |||
| @@ -746,14 +730,14 @@ typedef struct __DMA_HandleTypeDef | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream3))? DMA_FLAG_TEIF3_7 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA1_Stream7))? DMA_FLAG_TEIF3_7 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)DMA2_Stream7))? DMA_FLAG_TEIF3_7 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel0))? BDMA_FLAG_TE0 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel1))? BDMA_FLAG_TE1 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel2))? BDMA_FLAG_TE2 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel3))? BDMA_FLAG_TE3 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel4))? BDMA_FLAG_TE4 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel5))? BDMA_FLAG_TE5 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel6))? BDMA_FLAG_TE6 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel7))? BDMA_FLAG_TE7 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel0))? BDMA_FLAG_TE0 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel1))? BDMA_FLAG_TE1 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel2))? BDMA_FLAG_TE2 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel3))? BDMA_FLAG_TE3 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel4))? BDMA_FLAG_TE4 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel5))? BDMA_FLAG_TE5 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel6))? BDMA_FLAG_TE6 :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) == ((uint32_t)BDMA_Channel7))? BDMA_FLAG_TE7 :\ | |||
| (uint32_t)0x00000000) | |||
| /** | |||
| @@ -858,22 +842,21 @@ typedef struct __DMA_HandleTypeDef | |||
| ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream7)? (DMA2->LIFCR = (__FLAG__)) :\ | |||
| ((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Stream3)? (DMA1->HIFCR = (__FLAG__)) : (DMA1->LIFCR = (__FLAG__))) | |||
| #define D2_TO_D3_DMA_IT(__DMA_IT__) \ | |||
| #define DMA_TO_BDMA_IT(__DMA_IT__) \ | |||
| ((((__DMA_IT__) & (DMA_IT_TC | DMA_IT_HT | DMA_IT_TE)) == (DMA_IT_TC | DMA_IT_HT | DMA_IT_TE)) ? (BDMA_CCR_TCIE | BDMA_CCR_HTIE |BDMA_CCR_TEIE) :\ | |||
| (((__DMA_IT__) & (DMA_IT_TC | DMA_IT_HT)) == (DMA_IT_TC | DMA_IT_HT)) ? (BDMA_CCR_TCIE | BDMA_CCR_HTIE) :\ | |||
| (((__DMA_IT__) & (DMA_IT_HT | DMA_IT_TE)) == (DMA_IT_HT | DMA_IT_TE)) ? (BDMA_CCR_HTIE |BDMA_CCR_TEIE) :\ | |||
| (((__DMA_IT__) & (DMA_IT_TC | DMA_IT_TE)) == (DMA_IT_TC | DMA_IT_TE)) ? (BDMA_CCR_TCIE |BDMA_CCR_TEIE) :\ | |||
| ((__DMA_IT__) == DMA_IT_TC) ? BDMA_CCR_TCIE :\ | |||
| ((__DMA_IT__) == DMA_IT_HT) ? BDMA_CCR_HTIE :\ | |||
| ((__DMA_IT__) == DMA_IT_TE) ? BDMA_CCR_TEIE :\ | |||
| (uint32_t)0x00000000) | |||
| (((__DMA_IT__) & (DMA_IT_TC | DMA_IT_HT)) == (DMA_IT_TC | DMA_IT_HT)) ? (BDMA_CCR_TCIE | BDMA_CCR_HTIE) :\ | |||
| (((__DMA_IT__) & (DMA_IT_HT | DMA_IT_TE)) == (DMA_IT_HT | DMA_IT_TE)) ? (BDMA_CCR_HTIE |BDMA_CCR_TEIE) :\ | |||
| (((__DMA_IT__) & (DMA_IT_TC | DMA_IT_TE)) == (DMA_IT_TC | DMA_IT_TE)) ? (BDMA_CCR_TCIE |BDMA_CCR_TEIE) :\ | |||
| ((__DMA_IT__) == DMA_IT_TC) ? BDMA_CCR_TCIE :\ | |||
| ((__DMA_IT__) == DMA_IT_HT) ? BDMA_CCR_HTIE :\ | |||
| ((__DMA_IT__) == DMA_IT_TE) ? BDMA_CCR_TEIE :\ | |||
| (uint32_t)0x00000000) | |||
| #define __HAL_DMA_D3_ENABLE_IT(__HANDLE__, __INTERRUPT__) \ | |||
| (((BDMA_Channel_TypeDef *)(__HANDLE__)->Instance)->CCR |= (D2_TO_D3_DMA_IT(__INTERRUPT__))) | |||
| #define __HAL_BDMA_CHANNEL_ENABLE_IT(__HANDLE__, __INTERRUPT__) \ | |||
| (((BDMA_Channel_TypeDef *)(__HANDLE__)->Instance)->CCR |= (DMA_TO_BDMA_IT(__INTERRUPT__))) | |||
| #define __HAL_DMA_D2_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) != DMA_IT_FE)? \ | |||
| #define __HAL_DMA_STREAM_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) != DMA_IT_FE)? \ | |||
| (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->CR |= (__INTERRUPT__)) : (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->FCR |= (__INTERRUPT__))) | |||
| /** | |||
| @@ -888,14 +871,14 @@ typedef struct __DMA_HandleTypeDef | |||
| * @arg DMA_IT_DME: Direct mode error interrupt. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((IS_D2_DMA_INSTANCE(__HANDLE__))?\ | |||
| (__HAL_DMA_D2_ENABLE_IT((__HANDLE__), (__INTERRUPT__))) :\ | |||
| (__HAL_DMA_D3_ENABLE_IT((__HANDLE__), (__INTERRUPT__)))) | |||
| #define __HAL_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((IS_DMA_STREAM_INSTANCE((__HANDLE__)->Instance))?\ | |||
| (__HAL_DMA_STREAM_ENABLE_IT((__HANDLE__), (__INTERRUPT__))) :\ | |||
| (__HAL_BDMA_CHANNEL_ENABLE_IT((__HANDLE__), (__INTERRUPT__)))) | |||
| #define __HAL_DMA_D3_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((BDMA_Channel_TypeDef *)(__HANDLE__)->Instance)->CCR &= ~(D2_TO_D3_DMA_IT(__INTERRUPT__))) | |||
| #define __HAL_BDMA_CHANNEL_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((BDMA_Channel_TypeDef *)(__HANDLE__)->Instance)->CCR &= ~(DMA_TO_BDMA_IT(__INTERRUPT__))) | |||
| #define __HAL_DMA_D2_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) != DMA_IT_FE)? \ | |||
| #define __HAL_DMA_STREAM_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) != DMA_IT_FE)? \ | |||
| (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->CR &= ~(__INTERRUPT__)) : (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->FCR &= ~(__INTERRUPT__))) | |||
| /** | |||
| @@ -910,14 +893,14 @@ typedef struct __DMA_HandleTypeDef | |||
| * @arg DMA_IT_DME: Direct mode error interrupt. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_DMA_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((IS_D2_DMA_INSTANCE(__HANDLE__))?\ | |||
| (__HAL_DMA_D2_DISABLE_IT((__HANDLE__), (__INTERRUPT__))) :\ | |||
| (__HAL_DMA_D3_DISABLE_IT((__HANDLE__), (__INTERRUPT__)))) | |||
| #define __HAL_DMA_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((IS_DMA_STREAM_INSTANCE((__HANDLE__)->Instance))?\ | |||
| (__HAL_DMA_STREAM_DISABLE_IT((__HANDLE__), (__INTERRUPT__))) :\ | |||
| (__HAL_BDMA_CHANNEL_DISABLE_IT((__HANDLE__), (__INTERRUPT__)))) | |||
| #define __HAL_DMA_D3_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((BDMA_Channel_TypeDef *)(__HANDLE__)->Instance)->CCR & (D2_TO_D3_DMA_IT(__INTERRUPT__)))) | |||
| #define __HAL_BDMA_CHANNEL_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((BDMA_Channel_TypeDef *)(__HANDLE__)->Instance)->CCR & (DMA_TO_BDMA_IT(__INTERRUPT__)))) | |||
| #define __HAL_DMA_D2_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) != DMA_IT_FE)? \ | |||
| #define __HAL_DMA_STREAM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) != DMA_IT_FE)? \ | |||
| (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->CR & (__INTERRUPT__)) : \ | |||
| (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->FCR & (__INTERRUPT__))) | |||
| @@ -933,9 +916,9 @@ typedef struct __DMA_HandleTypeDef | |||
| * @arg DMA_IT_DME: Direct mode error interrupt. | |||
| * @retval The state of DMA_IT. | |||
| */ | |||
| #define __HAL_DMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((IS_D2_DMA_INSTANCE(__HANDLE__))? \ | |||
| (__HAL_DMA_D2_GET_IT_SOURCE((__HANDLE__), (__INTERRUPT__))) :\ | |||
| (__HAL_DMA_D3_GET_IT_SOURCE((__HANDLE__), (__INTERRUPT__)))) | |||
| #define __HAL_DMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((IS_DMA_STREAM_INSTANCE((__HANDLE__)->Instance))? \ | |||
| (__HAL_DMA_STREAM_GET_IT_SOURCE((__HANDLE__), (__INTERRUPT__))) :\ | |||
| (__HAL_BDMA_CHANNEL_GET_IT_SOURCE((__HANDLE__), (__INTERRUPT__)))) | |||
| /** | |||
| * @brief Writes the number of data units to be transferred on the DMA Stream. | |||
| @@ -954,7 +937,7 @@ typedef struct __DMA_HandleTypeDef | |||
| * | |||
| * @retval The number of remaining data units in the current DMAy Streamx transfer. | |||
| */ | |||
| #define __HAL_DMA_SET_COUNTER(__HANDLE__, __COUNTER__) ((IS_D2_DMA_INSTANCE(__HANDLE__))? \ | |||
| #define __HAL_DMA_SET_COUNTER(__HANDLE__, __COUNTER__) ((IS_DMA_STREAM_INSTANCE((__HANDLE__)->Instance))? \ | |||
| (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->NDTR = (uint16_t)(__COUNTER__)) :\ | |||
| (((BDMA_Channel_TypeDef *)(__HANDLE__)->Instance)->CNDTR = (uint16_t)(__COUNTER__))) | |||
| @@ -964,7 +947,7 @@ typedef struct __DMA_HandleTypeDef | |||
| * | |||
| * @retval The number of remaining data units in the current DMA Stream transfer. | |||
| */ | |||
| #define __HAL_DMA_GET_COUNTER(__HANDLE__) ((IS_D2_DMA_INSTANCE(__HANDLE__))?\ | |||
| #define __HAL_DMA_GET_COUNTER(__HANDLE__) ((IS_DMA_STREAM_INSTANCE((__HANDLE__)->Instance))? \ | |||
| (((DMA_Stream_TypeDef *)(__HANDLE__)->Instance)->NDTR) :\ | |||
| (((BDMA_Channel_TypeDef *)(__HANDLE__)->Instance)->CNDTR)) | |||
| @@ -1036,13 +1019,9 @@ uint32_t HAL_DMA_GetError(DMA_HandleTypeDef *hdma); | |||
| * @{ | |||
| */ | |||
| #define IS_DMA_D2_REQUEST(REQUEST) (((REQUEST) <= DMA_REQUEST_ADC3)) | |||
| #define IS_BDMA_D3_REQUEST(REQUEST) (((REQUEST) <= BDMA_REQUEST_ADC3)) | |||
| #define IS_D2_DMA_INSTANCE(__HANDLE__) (((uint32_t)((__HANDLE__)->Instance) >= ((uint32_t)DMA1_Stream0)) && ((uint32_t)((__HANDLE__)->Instance) <= ((uint32_t)DMA2_Stream7))) | |||
| #define IS_D3_DMA_INSTANCE(__HANDLE__) (((uint32_t)((__HANDLE__)->Instance) >= ((uint32_t)BDMA_Channel0)) && ((uint32_t)((__HANDLE__)->Instance) <= ((uint32_t)BDMA_Channel7))) | |||
| #define IS_DMA_REQUEST(REQUEST) (((REQUEST) <= DMA_REQUEST_ADC3)) | |||
| #define IS_BDMA_REQUEST(REQUEST) (((REQUEST) <= BDMA_REQUEST_ADC3)) | |||
| #define IS_DMA_DIRECTION(DIRECTION) (((DIRECTION) == DMA_PERIPH_TO_MEMORY ) || \ | |||
| ((DIRECTION) == DMA_MEMORY_TO_PERIPH) || \ | |||
| @@ -1064,9 +1043,11 @@ uint32_t HAL_DMA_GetError(DMA_HandleTypeDef *hdma); | |||
| ((SIZE) == DMA_MDATAALIGN_HALFWORD) || \ | |||
| ((SIZE) == DMA_MDATAALIGN_WORD )) | |||
| #define IS_DMA_MODE(MODE) (((MODE) == DMA_NORMAL ) || \ | |||
| ((MODE) == DMA_CIRCULAR) || \ | |||
| ((MODE) == DMA_PFCTRL)) | |||
| #define IS_DMA_MODE(MODE) (((MODE) == DMA_NORMAL ) || \ | |||
| ((MODE) == DMA_CIRCULAR) || \ | |||
| ((MODE) == DMA_PFCTRL) || \ | |||
| ((MODE) == DMA_DOUBLE_BUFFER_M0) || \ | |||
| ((MODE) == DMA_DOUBLE_BUFFER_M1)) | |||
| #define IS_DMA_PRIORITY(PRIORITY) (((PRIORITY) == DMA_PRIORITY_LOW ) || \ | |||
| ((PRIORITY) == DMA_PRIORITY_MEDIUM) || \ | |||
| @@ -1115,6 +1096,6 @@ uint32_t HAL_DMA_GetError(DMA_HandleTypeDef *hdma); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_DMA_H */ | |||
| #endif /* STM32H7xx_HAL_DMA_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_dma2d.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of DMA2D HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_DMA2D_H | |||
| #define __STM32H7xx_HAL_DMA2D_H | |||
| #ifndef STM32H7xx_HAL_DMA2D_H | |||
| #define STM32H7xx_HAL_DMA2D_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -61,21 +43,6 @@ | |||
| */ | |||
| #define MAX_DMA2D_LAYER 2U /*!< DMA2D maximum number of layers */ | |||
| /** | |||
| * @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 | |||
| */ | |||
| @@ -104,12 +71,15 @@ typedef struct | |||
| uint32_t OutputOffset; /*!< Specifies the Offset value. | |||
| This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x3FFF. */ | |||
| uint32_t AlphaInverted; /*!< Select regular or inverted alpha value for the output pixel format converter. | |||
| This parameter can be one value of @ref DMA2D_Alpha_Inverted */ | |||
| This parameter can be one value of @ref DMA2D_Alpha_Inverted. */ | |||
| uint32_t RedBlueSwap; /*!< Select regular mode (RGB or ARGB) or swap mode (BGR or ABGR) | |||
| for the output pixel format converter. | |||
| This parameter can be one value of @ref DMA2D_RB_Swap. */ | |||
| } DMA2D_InitTypeDef; | |||
| @@ -135,15 +105,15 @@ typedef struct | |||
| - 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]. */ | |||
| uint32_t AlphaInverted; /*!< Select regular or inverted alpha value. | |||
| This parameter can be one value of @ref DMA2D_Alpha_Inverted.*/ | |||
| This parameter can be one value of @ref DMA2D_Alpha_Inverted. */ | |||
| uint32_t RedBlueSwap; /*!< Select regular mode (RGB or ARGB) or swap mode (BGR or ABGR). | |||
| This parameter can be one value of @ref DMA2D_RB_Swap. */ | |||
| uint32_t ChromaSubSampling; /*!< Configure the chroma sub-sampling mode for the YCbCr color mode | |||
| This parameter can be one value of @ref DMA2D_Chroma_Sub_Sampling */ | |||
| } DMA2D_LayerCfgTypeDef; | |||
| /** | |||
| @@ -172,6 +142,17 @@ typedef struct __DMA2D_HandleTypeDef | |||
| void (* XferErrorCallback)(struct __DMA2D_HandleTypeDef * hdma2d); /*!< DMA2D transfer error callback. */ | |||
| #if (USE_HAL_DMA2D_REGISTER_CALLBACKS == 1) | |||
| void (* LineEventCallback)( struct __DMA2D_HandleTypeDef * hdma2d); /*!< DMA2D line event callback. */ | |||
| void (* CLUTLoadingCpltCallback)( struct __DMA2D_HandleTypeDef * hdma2d); /*!< DMA2D CLUT loading completion callback. */ | |||
| void (* MspInitCallback)( struct __DMA2D_HandleTypeDef * hdma2d); /*!< DMA2D Msp Init callback. */ | |||
| void (* MspDeInitCallback)( struct __DMA2D_HandleTypeDef * hdma2d); /*!< DMA2D Msp DeInit callback. */ | |||
| #endif /* (USE_HAL_DMA2D_REGISTER_CALLBACKS) */ | |||
| DMA2D_LayerCfgTypeDef LayerCfg[MAX_DMA2D_LAYER]; /*!< DMA2D Layers parameters */ | |||
| HAL_LockTypeDef Lock; /*!< DMA2D lock. */ | |||
| @@ -180,6 +161,13 @@ typedef struct __DMA2D_HandleTypeDef | |||
| __IO uint32_t ErrorCode; /*!< DMA2D error code. */ | |||
| } DMA2D_HandleTypeDef; | |||
| #if (USE_HAL_DMA2D_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL DMA2D Callback pointer definition | |||
| */ | |||
| typedef void (*pDMA2D_CallbackTypeDef)(DMA2D_HandleTypeDef * hdma2d); /*!< Pointer to a DMA2D common callback function */ | |||
| #endif /* USE_HAL_DMA2D_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -192,11 +180,15 @@ typedef struct __DMA2D_HandleTypeDef | |||
| /** @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 */ | |||
| #define HAL_DMA2D_ERROR_NONE 0x00000000U /*!< No error */ | |||
| #define HAL_DMA2D_ERROR_TE 0x00000001U /*!< Transfer error */ | |||
| #define HAL_DMA2D_ERROR_CE 0x00000002U /*!< Configuration error */ | |||
| #define HAL_DMA2D_ERROR_CAE 0x00000004U /*!< CLUT access error */ | |||
| #define HAL_DMA2D_ERROR_TIMEOUT 0x00000020U /*!< Timeout error */ | |||
| #if (USE_HAL_DMA2D_REGISTER_CALLBACKS == 1) | |||
| #define HAL_DMA2D_ERROR_INVALID_CALLBACK 0x00000040U /*!< Invalid callback error */ | |||
| #endif /* USE_HAL_UART_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -204,9 +196,9 @@ typedef struct __DMA2D_HandleTypeDef | |||
| /** @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_M2M 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 */ | |||
| /** | |||
| * @} | |||
| @@ -215,7 +207,7 @@ typedef struct __DMA2D_HandleTypeDef | |||
| /** @defgroup DMA2D_Output_Color_Mode DMA2D Output Color Mode | |||
| * @{ | |||
| */ | |||
| #define DMA2D_OUTPUT_ARGB8888 ((uint32_t)0x00000000U) /*!< ARGB8888 DMA2D color mode */ | |||
| #define DMA2D_OUTPUT_ARGB8888 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 */ | |||
| @@ -227,18 +219,18 @@ typedef struct __DMA2D_HandleTypeDef | |||
| /** @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 */ | |||
| #define DMA2D_INPUT_YCBCR ((uint32_t)0x0000000BU) /*!< YCbCr color mode */ | |||
| #define DMA2D_INPUT_ARGB8888 0x00000000U /*!< ARGB8888 color mode */ | |||
| #define DMA2D_INPUT_RGB888 0x00000001U /*!< RGB888 color mode */ | |||
| #define DMA2D_INPUT_RGB565 0x00000002U /*!< RGB565 color mode */ | |||
| #define DMA2D_INPUT_ARGB1555 0x00000003U /*!< ARGB1555 color mode */ | |||
| #define DMA2D_INPUT_ARGB4444 0x00000004U /*!< ARGB4444 color mode */ | |||
| #define DMA2D_INPUT_L8 0x00000005U /*!< L8 color mode */ | |||
| #define DMA2D_INPUT_AL44 0x00000006U /*!< AL44 color mode */ | |||
| #define DMA2D_INPUT_AL88 0x00000007U /*!< AL88 color mode */ | |||
| #define DMA2D_INPUT_L4 0x00000008U /*!< L4 color mode */ | |||
| #define DMA2D_INPUT_A8 0x00000009U /*!< A8 color mode */ | |||
| #define DMA2D_INPUT_A4 0x0000000AU /*!< A4 color mode */ | |||
| #define DMA2D_INPUT_YCBCR 0x0000000BU /*!< YCbCr color mode */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -246,55 +238,55 @@ typedef struct __DMA2D_HandleTypeDef | |||
| /** @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 | |||
| #define DMA2D_NO_MODIF_ALPHA 0x00000000U /*!< No modification of the alpha channel value */ | |||
| #define DMA2D_REPLACE_ALPHA 0x00000001U /*!< Replace original alpha channel value by programmed alpha value */ | |||
| #define DMA2D_COMBINE_ALPHA 0x00000002U /*!< Replace original alpha channel value by programmed alpha value | |||
| with original alpha channel value */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DMA2D_Alpha_Inverted DMA2D ALPHA Inversion | |||
| /** @defgroup DMA2D_Alpha_Inverted DMA2D Alpha Inversion | |||
| * @{ | |||
| */ | |||
| #define DMA2D_REGULAR_ALPHA ((uint32_t)0x00000000U) /*!< No modification of the alpha channel value */ | |||
| #define DMA2D_INVERTED_ALPHA ((uint32_t)0x00000001U) /*!< Invert the alpha channel value */ | |||
| #define DMA2D_REGULAR_ALPHA 0x00000000U /*!< No modification of the alpha channel value */ | |||
| #define DMA2D_INVERTED_ALPHA 0x00000001U /*!< Invert the alpha channel value */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DMA2D_RB_Swap DMA2D Red and Blue Swap | |||
| * @{ | |||
| */ | |||
| #define DMA2D_RB_REGULAR ((uint32_t)0x00000000U) /*!< Select regular mode (RGB or ARGB) */ | |||
| #define DMA2D_RB_SWAP ((uint32_t)0x00000001U) /*!< Select swap mode (BGR or ABGR) */ | |||
| #define DMA2D_RB_REGULAR 0x00000000U /*!< Select regular mode (RGB or ARGB) */ | |||
| #define DMA2D_RB_SWAP 0x00000001U /*!< Select swap mode (BGR or ABGR) */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DMA2D_Chroma_Sub_Sampling DMA2D Chroma Sub Sampling | |||
| * @{ | |||
| */ | |||
| #define DMA2D_NO_CSS ((uint32_t)0x00000000) /*!< No chroma sub-sampling 4:4:4 */ | |||
| #define DMA2D_CSS_422 ((uint32_t)0x00000001) /*!< chroma sub-sampling 4:2:2 */ | |||
| #define DMA2D_CSS_420 ((uint32_t)0x00000002) /*!< chroma sub-sampling 4:2:0 */ | |||
| #define DMA2D_NO_CSS 0x00000000U /*!< No chroma sub-sampling 4:4:4 */ | |||
| #define DMA2D_CSS_422 0x00000001U /*!< chroma sub-sampling 4:2:2 */ | |||
| #define DMA2D_CSS_420 0x00000002U /*!< chroma sub-sampling 4:2:0 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @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 */ | |||
| #define DMA2D_CCM_ARGB8888 0x00000000U /*!< ARGB8888 DMA2D CLUT color mode */ | |||
| #define DMA2D_CCM_RGB888 0x00000001U /*!< RGB888 DMA2D CLUT color mode */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup DMA2D_Interrupts DMA2D Interrupts | |||
| * @{ | |||
| */ | |||
| @@ -329,6 +321,21 @@ typedef struct __DMA2D_HandleTypeDef | |||
| * @} | |||
| */ | |||
| #if (USE_HAL_DMA2D_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL DMA2D common Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_DMA2D_MSPINIT_CB_ID = 0x00U, /*!< DMA2D MspInit callback ID */ | |||
| HAL_DMA2D_MSPDEINIT_CB_ID = 0x01U, /*!< DMA2D MspDeInit callback ID */ | |||
| HAL_DMA2D_TRANSFERCOMPLETE_CB_ID = 0x02U, /*!< DMA2D transfer complete callback ID */ | |||
| HAL_DMA2D_TRANSFERERROR_CB_ID = 0x03U, /*!< DMA2D transfer error callback ID */ | |||
| HAL_DMA2D_LINEEVENT_CB_ID = 0x04U, /*!< DMA2D line event callback ID */ | |||
| HAL_DMA2D_CLUTLOADINGCPLT_CB_ID = 0x05U, /*!< DMA2D CLUT loading completion callback ID */ | |||
| }HAL_DMA2D_CallbackIDTypeDef; | |||
| #endif /* USE_HAL_DMA2D_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| @@ -339,14 +346,23 @@ typedef struct __DMA2D_HandleTypeDef | |||
| */ | |||
| /** @brief Reset DMA2D handle state | |||
| * @param __HANDLE__: specifies the DMA2D handle. | |||
| * @param __HANDLE__ specifies the DMA2D handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_DMA2D_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_DMA2D_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->State = HAL_DMA2D_STATE_RESET;\ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| }while(0) | |||
| #else | |||
| #define __HAL_DMA2D_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DMA2D_STATE_RESET) | |||
| #endif /* USE_HAL_DMA2D_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @brief Enable the DMA2D. | |||
| * @param __HANDLE__: DMA2D handle | |||
| * @param __HANDLE__ DMA2D handle | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_DMA2D_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DMA2D_CR_START) | |||
| @@ -355,8 +371,8 @@ typedef struct __DMA2D_HandleTypeDef | |||
| /* Interrupt & Flag management */ | |||
| /** | |||
| * @brief Get the DMA2D pending flags. | |||
| * @param __HANDLE__: DMA2D handle | |||
| * @param __FLAG__: flag to check. | |||
| * @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 | |||
| @@ -370,8 +386,8 @@ typedef struct __DMA2D_HandleTypeDef | |||
| /** | |||
| * @brief Clear the DMA2D pending flags. | |||
| * @param __HANDLE__: DMA2D handle | |||
| * @param __FLAG__: specifies the flag to clear. | |||
| * @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 | |||
| @@ -385,8 +401,8 @@ typedef struct __DMA2D_HandleTypeDef | |||
| /** | |||
| * @brief Enable the specified DMA2D interrupts. | |||
| * @param __HANDLE__: DMA2D handle | |||
| * @param __INTERRUPT__: specifies the DMA2D interrupt sources to be enabled. | |||
| * @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 | |||
| @@ -400,8 +416,8 @@ typedef struct __DMA2D_HandleTypeDef | |||
| /** | |||
| * @brief Disable the specified DMA2D interrupts. | |||
| * @param __HANDLE__: DMA2D handle | |||
| * @param __INTERRUPT__: specifies the DMA2D interrupt sources to be disabled. | |||
| * @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 | |||
| @@ -415,8 +431,8 @@ typedef struct __DMA2D_HandleTypeDef | |||
| /** | |||
| * @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. | |||
| * @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 | |||
| @@ -446,6 +462,11 @@ 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); | |||
| /* Callbacks Register/UnRegister functions ***********************************/ | |||
| #if (USE_HAL_DMA2D_REGISTER_CALLBACKS == 1) | |||
| HAL_StatusTypeDef HAL_DMA2D_RegisterCallback(DMA2D_HandleTypeDef *hdma2d, HAL_DMA2D_CallbackIDTypeDef CallbackID, pDMA2D_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_DMA2D_UnRegisterCallback(DMA2D_HandleTypeDef *hdma2d, HAL_DMA2D_CallbackIDTypeDef CallbackID); | |||
| #endif /* USE_HAL_DMA2D_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| @@ -528,7 +549,24 @@ uint32_t HAL_DMA2D_GetError(DMA2D_HandleTypeDef *hdma2d); | |||
| /** @defgroup DMA2D_Color_Value DMA2D Color Value | |||
| * @{ | |||
| */ | |||
| #define DMA2D_COLOR_VALUE ((uint32_t)0x000000FFU) /*!< Color value mask */ | |||
| #define DMA2D_COLOR_VALUE 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_Layers DMA2D Layers | |||
| * @{ | |||
| */ | |||
| #define DMA2D_BACKGROUND_LAYER 0x00000000U /*!< DMA2D Background Layer (layer 0) */ | |||
| #define DMA2D_FOREGROUND_LAYER 0x00000001U /*!< DMA2D Foreground Layer (layer 1) */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -553,7 +591,7 @@ uint32_t HAL_DMA2D_GetError(DMA2D_HandleTypeDef *hdma2d); | |||
| /** @defgroup DMA2D_CLUT_Size DMA2D CLUT Size | |||
| * @{ | |||
| */ | |||
| #define DMA2D_CLUT_SIZE (DMA2D_FGPFCCR_CS >> 8) /*!< DMA2D maximum CLUT size */ | |||
| #define DMA2D_CLUT_SIZE (DMA2D_FGPFCCR_CS >> 8U) /*!< DMA2D maximum CLUT size */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -567,22 +605,27 @@ uint32_t HAL_DMA2D_GetError(DMA2D_HandleTypeDef *hdma2d); | |||
| /** @defgroup DMA2D_Private_Macros DMA2D Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_DMA2D_LAYER(LAYER) ((LAYER) <= MAX_DMA2D_LAYER) | |||
| #define IS_DMA2D_LAYER(LAYER) (((LAYER) == DMA2D_BACKGROUND_LAYER) || ((LAYER) == DMA2D_FOREGROUND_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) || ((INPUT_CM) == DMA2D_INPUT_YCBCR)) | |||
| #define IS_DMA2D_ALPHA_MODE(AlphaMode) (((AlphaMode) == DMA2D_NO_MODIF_ALPHA) || \ | |||
| ((AlphaMode) == DMA2D_REPLACE_ALPHA) || \ | |||
| ((AlphaMode) == DMA2D_COMBINE_ALPHA)) | |||
| @@ -593,9 +636,11 @@ uint32_t HAL_DMA2D_GetError(DMA2D_HandleTypeDef *hdma2d); | |||
| #define IS_DMA2D_RB_SWAP(RB_Swap) (((RB_Swap) == DMA2D_RB_REGULAR) || \ | |||
| ((RB_Swap) == DMA2D_RB_SWAP)) | |||
| #define IS_DMA2D_CHROMA_SUB_SAMPLING (CSS) (((CSS) == DMA2D_NO_CSS) || \ | |||
| ((CSS) == DMA2D_CSS_422) || \ | |||
| ((CSS) == DMA2D_CSS_420)) | |||
| #define IS_DMA2D_CHROMA_SUB_SAMPLING(CSS) (((CSS) == DMA2D_NO_CSS) || \ | |||
| ((CSS) == DMA2D_CSS_422) || \ | |||
| ((CSS) == DMA2D_CSS_420)) | |||
| #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) | |||
| @@ -623,7 +668,7 @@ uint32_t HAL_DMA2D_GetError(DMA2D_HandleTypeDef *hdma2d); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_DMA2D_H */ | |||
| #endif /* STM32H7xx_HAL_DMA2D_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_dma_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of DMA HAL extension module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_DMA_EX_H | |||
| #define __STM32H7xx_HAL_DMA_EX_H | |||
| #ifndef STM32H7xx_HAL_DMA_EX_H | |||
| #define STM32H7xx_HAL_DMA_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -125,31 +107,31 @@ typedef struct | |||
| * @brief DMAEx MUX SyncSignalID selection | |||
| * @{ | |||
| */ | |||
| #define HAL_DMAMUX1_SYNC_DMAMUX1_CH0_EVT 0U /*!< D2 Domain synchronization Signal is DMAMUX1 Channel0 Event */ | |||
| #define HAL_DMAMUX1_SYNC_DMAMUX1_CH1_EVT 1U /*!< D2 Domain synchronization Signal is DMAMUX1 Channel1 Event */ | |||
| #define HAL_DMAMUX1_SYNC_DMAMUX1_CH2_EVT 2U /*!< D2 Domain synchronization Signal is DMAMUX1 Channel2 Event */ | |||
| #define HAL_DMAMUX1_SYNC_LPTIM1_OUT 3U /*!< D2 Domain synchronization Signal is LPTIM1 OUT */ | |||
| #define HAL_DMAMUX1_SYNC_LPTIM2_OUT 4U /*!< D2 Domain synchronization Signal is LPTIM2 OUT */ | |||
| #define HAL_DMAMUX1_SYNC_LPTIM3_OUT 5U /*!< D2 Domain synchronization Signal is LPTIM3 OUT */ | |||
| #define HAL_DMAMUX1_SYNC_EXTI0 6U /*!< D2 Domain synchronization Signal is EXTI0 IT */ | |||
| #define HAL_DMAMUX1_SYNC_TIM12_TRGO 7U /*!< D2 Domain synchronization Signal is TIM12 TRGO */ | |||
| #define HAL_DMAMUX2_SYNC_DMAMUX2_CH0_EVT 0U /*!< D3 Domain synchronization Signal is DMAMUX2 Channel0 Event */ | |||
| #define HAL_DMAMUX2_SYNC_DMAMUX2_CH1_EVT 1U /*!< D3 Domain synchronization Signal is DMAMUX2 Channel1 Event */ | |||
| #define HAL_DMAMUX2_SYNC_DMAMUX2_CH2_EVT 2U /*!< D3 Domain synchronization Signal is DMAMUX2 Channel2 Event */ | |||
| #define HAL_DMAMUX2_SYNC_DMAMUX2_CH3_EVT 3U /*!< D3 Domain synchronization Signal is DMAMUX2 Channel3 Event */ | |||
| #define HAL_DMAMUX2_SYNC_DMAMUX2_CH4_EVT 4U /*!< D3 Domain synchronization Signal is DMAMUX2 Channel4 Event */ | |||
| #define HAL_DMAMUX2_SYNC_DMAMUX2_CH5_EVT 5U /*!< D3 Domain synchronization Signal is DMAMUX2 Channel5 Event */ | |||
| #define HAL_DMAMUX2_SYNC_LPUART1_RX_WKUP 6U /*!< D3 Domain synchronization Signal is LPUART1 RX Wakeup */ | |||
| #define HAL_DMAMUX2_SYNC_LPUART1_TX_WKUP 7U /*!< D3 Domain synchronization Signal is LPUART1 TX Wakeup */ | |||
| #define HAL_DMAMUX2_SYNC_LPTIM2_OUT 8U /*!< D3 Domain synchronization Signal is LPTIM2 output */ | |||
| #define HAL_DMAMUX2_SYNC_LPTIM3_OUT 9U /*!< D3 Domain synchronization Signal is LPTIM3 output */ | |||
| #define HAL_DMAMUX2_SYNC_I2C4_WKUP 10U /*!< D3 Domain synchronization Signal is I2C4 Wakeup */ | |||
| #define HAL_DMAMUX2_SYNC_SPI6_WKUP 11U /*!< D3 Domain synchronization Signal is SPI6 Wakeup */ | |||
| #define HAL_DMAMUX2_SYNC_COMP1_OUT 12U /*!< D3 Domain synchronization Signal is Comparator 1 output */ | |||
| #define HAL_DMAMUX2_SYNC_RTC_WKUP 13U /*!< D3 Domain synchronization Signal is RTC Wakeup */ | |||
| #define HAL_DMAMUX2_SYNC_EXTI0 14U /*!< D3 Domain synchronization Signal is EXTI0 IT */ | |||
| #define HAL_DMAMUX2_SYNC_EXTI2 15U /*!< D3 Domain synchronization Signal is EXTI2 IT */ | |||
| #define HAL_DMAMUX1_SYNC_DMAMUX1_CH0_EVT 0U /*!< DMAMUX1 synchronization Signal is DMAMUX1 Channel0 Event */ | |||
| #define HAL_DMAMUX1_SYNC_DMAMUX1_CH1_EVT 1U /*!< DMAMUX1 synchronization Signal is DMAMUX1 Channel1 Event */ | |||
| #define HAL_DMAMUX1_SYNC_DMAMUX1_CH2_EVT 2U /*!< DMAMUX1 synchronization Signal is DMAMUX1 Channel2 Event */ | |||
| #define HAL_DMAMUX1_SYNC_LPTIM1_OUT 3U /*!< DMAMUX1 synchronization Signal is LPTIM1 OUT */ | |||
| #define HAL_DMAMUX1_SYNC_LPTIM2_OUT 4U /*!< DMAMUX1 synchronization Signal is LPTIM2 OUT */ | |||
| #define HAL_DMAMUX1_SYNC_LPTIM3_OUT 5U /*!< DMAMUX1 synchronization Signal is LPTIM3 OUT */ | |||
| #define HAL_DMAMUX1_SYNC_EXTI0 6U /*!< DMAMUX1 synchronization Signal is EXTI0 IT */ | |||
| #define HAL_DMAMUX1_SYNC_TIM12_TRGO 7U /*!< DMAMUX1 synchronization Signal is TIM12 TRGO */ | |||
| #define HAL_DMAMUX2_SYNC_DMAMUX2_CH0_EVT 0U /*!< DMAMUX2 synchronization Signal is DMAMUX2 Channel0 Event */ | |||
| #define HAL_DMAMUX2_SYNC_DMAMUX2_CH1_EVT 1U /*!< DMAMUX2 synchronization Signal is DMAMUX2 Channel1 Event */ | |||
| #define HAL_DMAMUX2_SYNC_DMAMUX2_CH2_EVT 2U /*!< DMAMUX2 synchronization Signal is DMAMUX2 Channel2 Event */ | |||
| #define HAL_DMAMUX2_SYNC_DMAMUX2_CH3_EVT 3U /*!< DMAMUX2 synchronization Signal is DMAMUX2 Channel3 Event */ | |||
| #define HAL_DMAMUX2_SYNC_DMAMUX2_CH4_EVT 4U /*!< DMAMUX2 synchronization Signal is DMAMUX2 Channel4 Event */ | |||
| #define HAL_DMAMUX2_SYNC_DMAMUX2_CH5_EVT 5U /*!< DMAMUX2 synchronization Signal is DMAMUX2 Channel5 Event */ | |||
| #define HAL_DMAMUX2_SYNC_LPUART1_RX_WKUP 6U /*!< DMAMUX2 synchronization Signal is LPUART1 RX Wakeup */ | |||
| #define HAL_DMAMUX2_SYNC_LPUART1_TX_WKUP 7U /*!< DMAMUX2 synchronization Signal is LPUART1 TX Wakeup */ | |||
| #define HAL_DMAMUX2_SYNC_LPTIM2_OUT 8U /*!< DMAMUX2 synchronization Signal is LPTIM2 output */ | |||
| #define HAL_DMAMUX2_SYNC_LPTIM3_OUT 9U /*!< DMAMUX2 synchronization Signal is LPTIM3 output */ | |||
| #define HAL_DMAMUX2_SYNC_I2C4_WKUP 10U /*!< DMAMUX2 synchronization Signal is I2C4 Wakeup */ | |||
| #define HAL_DMAMUX2_SYNC_SPI6_WKUP 11U /*!< DMAMUX2 synchronization Signal is SPI6 Wakeup */ | |||
| #define HAL_DMAMUX2_SYNC_COMP1_OUT 12U /*!< DMAMUX2 synchronization Signal is Comparator 1 output */ | |||
| #define HAL_DMAMUX2_SYNC_RTC_WKUP 13U /*!< DMAMUX2 synchronization Signal is RTC Wakeup */ | |||
| #define HAL_DMAMUX2_SYNC_EXTI0 14U /*!< DMAMUX2 synchronization Signal is EXTI0 IT */ | |||
| #define HAL_DMAMUX2_SYNC_EXTI2 15U /*!< DMAMUX2 synchronization Signal is EXTI2 IT */ | |||
| /** | |||
| * @} | |||
| @@ -173,45 +155,45 @@ typedef struct | |||
| * @brief DMAEx MUX SignalGeneratorID selection | |||
| * @{ | |||
| */ | |||
| #define HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH0_EVT 0U /*!< D2 domain Request generator Signal is DMAMUX1 Channel0 Event */ | |||
| #define HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH1_EVT 1U /*!< D2 domain Request generator Signal is DMAMUX1 Channel1 Event */ | |||
| #define HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH2_EVT 2U /*!< D2 domain Request generator Signal is DMAMUX1 Channel2 Event */ | |||
| #define HAL_DMAMUX1_REQ_GEN_LPTIM1_OUT 3U /*!< D2 domain Request generator Signal is LPTIM1 OUT */ | |||
| #define HAL_DMAMUX1_REQ_GEN_LPTIM2_OUT 4U /*!< D2 domain Request generator Signal is LPTIM2 OUT */ | |||
| #define HAL_DMAMUX1_REQ_GEN_LPTIM3_OUT 5U /*!< D2 domain Request generator Signal is LPTIM3 OUT */ | |||
| #define HAL_DMAMUX1_REQ_GEN_EXTI0 6U /*!< D2 domain Request generator Signal is EXTI0 IT */ | |||
| #define HAL_DMAMUX1_REQ_GEN_TIM12_TRGO 7U /*!< D2 domain Request generator Signal is TIM12 TRGO */ | |||
| #define HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH0_EVT 0U /*!< D3 domain Request generator Signal is DMAMUX2 Channel0 Event */ | |||
| #define HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH1_EVT 1U /*!< D3 domain Request generator Signal is DMAMUX2 Channel1 Event */ | |||
| #define HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH2_EVT 2U /*!< D3 domain Request generator Signal is DMAMUX2 Channel2 Event */ | |||
| #define HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH3_EVT 3U /*!< D3 domain Request generator Signal is DMAMUX2 Channel3 Event */ | |||
| #define HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH4_EVT 4U /*!< D3 domain Request generator Signal is DMAMUX2 Channel4 Event */ | |||
| #define HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH5_EVT 5U /*!< D3 domain Request generator Signal is DMAMUX2 Channel5 Event */ | |||
| #define HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH6_EVT 6U /*!< D3 domain Request generator Signal is DMAMUX2 Channel6 Event */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPUART1_RX_WKUP 7U /*!< D3 domain Request generator Signal is LPUART1 RX Wakeup */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPUART1_TX_WKUP 8U /*!< D3 domain Request generator Signal is LPUART1 TX Wakeup */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPTIM2_WKUP 9U /*!< D3 domain Request generator Signal is LPTIM2 Wakeup */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPTIM2_OUT 10U /*!< D3 domain Request generator Signal is LPTIM2 OUT */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPTIM3_WKUP 11U /*!< D3 domain Request generator Signal is LPTIM3 Wakeup */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPTIM3_OUT 12U /*!< D3 domain Request generator Signal is LPTIM3 OUT */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPTIM4_WKUP 13U /*!< D3 domain Request generator Signal is LPTIM4 Wakeup */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPTIM5_WKUP 14U /*!< D3 domain Request generator Signal is LPTIM5 Wakeup */ | |||
| #define HAL_DMAMUX2_REQ_GEN_I2C4_WKUP 15U /*!< D3 domain Request generator Signal is I2C4 Wakeup */ | |||
| #define HAL_DMAMUX2_REQ_GEN_SPI6_WKUP 16U /*!< D3 domain Request generator Signal is SPI6 Wakeup */ | |||
| #define HAL_DMAMUX2_REQ_GEN_COMP1_OUT 17U /*!< D3 domain Request generator Signal is Comparator 1 output */ | |||
| #define HAL_DMAMUX2_REQ_GEN_COMP2_OUT 18U /*!< D3 domain Request generator Signal is Comparator 2 output */ | |||
| #define HAL_DMAMUX2_REQ_GEN_RTC_WKUP 19U /*!< D3 domain Request generator Signal is RTC Wakeup */ | |||
| #define HAL_DMAMUX2_REQ_GEN_EXTI0 20U /*!< D3 domain Request generator Signal is EXTI0 */ | |||
| #define HAL_DMAMUX2_REQ_GEN_EXTI2 21U /*!< D3 domain Request generator Signal is EXTI2 */ | |||
| #define HAL_DMAMUX2_REQ_GEN_I2C4_IT_EVT 22U /*!< D3 domain Request generator Signal is I2C4 IT Event */ | |||
| #define HAL_DMAMUX2_REQ_GEN_SPI6_IT 23U /*!< D3 domain Request generator Signal is SPI6 IT */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPUART1_TX_IT 24U /*!< D3 domain Request generator Signal is LPUART1 Tx IT */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPUART1_RX_IT 25U /*!< D3 domain Request generator Signal is LPUART1 Rx IT */ | |||
| #define HAL_DMAMUX2_REQ_GEN_ADC3_IT 26U /*!< D3 domain Request generator Signal is ADC3 IT */ | |||
| #define HAL_DMAMUX2_REQ_GEN_ADC3_AWD1_OUT 27U /*!< D3 domain Request generator Signal is ADC3 Analog Watchdog 1 output */ | |||
| #define HAL_DMAMUX2_REQ_GEN_BDMA_CH0_IT 28U /*!< D3 domain Request generator Signal is BDMA Channel 0 IT */ | |||
| #define HAL_DMAMUX2_REQ_GEN_BDMA_CH1_IT 29U /*!< D3 domain Request generator Signal is BDMA Channel 1 IT */ | |||
| #define HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH0_EVT 0U /*!< DMAMUX1 Request generator Signal is DMAMUX1 Channel0 Event */ | |||
| #define HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH1_EVT 1U /*!< DMAMUX1 Request generator Signal is DMAMUX1 Channel1 Event */ | |||
| #define HAL_DMAMUX1_REQ_GEN_DMAMUX1_CH2_EVT 2U /*!< DMAMUX1 Request generator Signal is DMAMUX1 Channel2 Event */ | |||
| #define HAL_DMAMUX1_REQ_GEN_LPTIM1_OUT 3U /*!< DMAMUX1 Request generator Signal is LPTIM1 OUT */ | |||
| #define HAL_DMAMUX1_REQ_GEN_LPTIM2_OUT 4U /*!< DMAMUX1 Request generator Signal is LPTIM2 OUT */ | |||
| #define HAL_DMAMUX1_REQ_GEN_LPTIM3_OUT 5U /*!< DMAMUX1 Request generator Signal is LPTIM3 OUT */ | |||
| #define HAL_DMAMUX1_REQ_GEN_EXTI0 6U /*!< DMAMUX1 Request generator Signal is EXTI0 IT */ | |||
| #define HAL_DMAMUX1_REQ_GEN_TIM12_TRGO 7U /*!< DMAMUX1 Request generator Signal is TIM12 TRGO */ | |||
| #define HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH0_EVT 0U /*!< DMAMUX2 Request generator Signal is DMAMUX2 Channel0 Event */ | |||
| #define HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH1_EVT 1U /*!< DMAMUX2 Request generator Signal is DMAMUX2 Channel1 Event */ | |||
| #define HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH2_EVT 2U /*!< DMAMUX2 Request generator Signal is DMAMUX2 Channel2 Event */ | |||
| #define HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH3_EVT 3U /*!< DMAMUX2 Request generator Signal is DMAMUX2 Channel3 Event */ | |||
| #define HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH4_EVT 4U /*!< DMAMUX2 Request generator Signal is DMAMUX2 Channel4 Event */ | |||
| #define HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH5_EVT 5U /*!< DMAMUX2 Request generator Signal is DMAMUX2 Channel5 Event */ | |||
| #define HAL_DMAMUX2_REQ_GEN_DMAMUX2_CH6_EVT 6U /*!< DMAMUX2 Request generator Signal is DMAMUX2 Channel6 Event */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPUART1_RX_WKUP 7U /*!< DMAMUX2 Request generator Signal is LPUART1 RX Wakeup */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPUART1_TX_WKUP 8U /*!< DMAMUX2 Request generator Signal is LPUART1 TX Wakeup */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPTIM2_WKUP 9U /*!< DMAMUX2 Request generator Signal is LPTIM2 Wakeup */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPTIM2_OUT 10U /*!< DMAMUX2 Request generator Signal is LPTIM2 OUT */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPTIM3_WKUP 11U /*!< DMAMUX2 Request generator Signal is LPTIM3 Wakeup */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPTIM3_OUT 12U /*!< DMAMUX2 Request generator Signal is LPTIM3 OUT */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPTIM4_WKUP 13U /*!< DMAMUX2 Request generator Signal is LPTIM4 Wakeup */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPTIM5_WKUP 14U /*!< DMAMUX2 Request generator Signal is LPTIM5 Wakeup */ | |||
| #define HAL_DMAMUX2_REQ_GEN_I2C4_WKUP 15U /*!< DMAMUX2 Request generator Signal is I2C4 Wakeup */ | |||
| #define HAL_DMAMUX2_REQ_GEN_SPI6_WKUP 16U /*!< DMAMUX2 Request generator Signal is SPI6 Wakeup */ | |||
| #define HAL_DMAMUX2_REQ_GEN_COMP1_OUT 17U /*!< DMAMUX2 Request generator Signal is Comparator 1 output */ | |||
| #define HAL_DMAMUX2_REQ_GEN_COMP2_OUT 18U /*!< DMAMUX2 Request generator Signal is Comparator 2 output */ | |||
| #define HAL_DMAMUX2_REQ_GEN_RTC_WKUP 19U /*!< DMAMUX2 Request generator Signal is RTC Wakeup */ | |||
| #define HAL_DMAMUX2_REQ_GEN_EXTI0 20U /*!< DMAMUX2 Request generator Signal is EXTI0 */ | |||
| #define HAL_DMAMUX2_REQ_GEN_EXTI2 21U /*!< DMAMUX2 Request generator Signal is EXTI2 */ | |||
| #define HAL_DMAMUX2_REQ_GEN_I2C4_IT_EVT 22U /*!< DMAMUX2 Request generator Signal is I2C4 IT Event */ | |||
| #define HAL_DMAMUX2_REQ_GEN_SPI6_IT 23U /*!< DMAMUX2 Request generator Signal is SPI6 IT */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPUART1_TX_IT 24U /*!< DMAMUX2 Request generator Signal is LPUART1 Tx IT */ | |||
| #define HAL_DMAMUX2_REQ_GEN_LPUART1_RX_IT 25U /*!< DMAMUX2 Request generator Signal is LPUART1 Rx IT */ | |||
| #define HAL_DMAMUX2_REQ_GEN_ADC3_IT 26U /*!< DMAMUX2 Request generator Signal is ADC3 IT */ | |||
| #define HAL_DMAMUX2_REQ_GEN_ADC3_AWD1_OUT 27U /*!< DMAMUX2 Request generator Signal is ADC3 Analog Watchdog 1 output */ | |||
| #define HAL_DMAMUX2_REQ_GEN_BDMA_CH0_IT 28U /*!< DMAMUX2 Request generator Signal is BDMA Channel 0 IT */ | |||
| #define HAL_DMAMUX2_REQ_GEN_BDMA_CH1_IT 29U /*!< DMAMUX2 Request generator Signal is BDMA Channel 1 IT */ | |||
| /** | |||
| @@ -269,10 +251,10 @@ void HAL_DMAEx_MUX_IRQHandler(DMA_HandleTypeDef *hdma); | |||
| * @{ | |||
| */ | |||
| #define IS_D2_DMAMUX_SYNC_SIGNAL_ID(SIGNAL_ID) ((SIGNAL_ID) <= HAL_DMAMUX1_SYNC_TIM12_TRGO) | |||
| #define IS_D3_DMAMUX_SYNC_SIGNAL_ID(SIGNAL_ID) ((SIGNAL_ID) <= HAL_DMAMUX2_SYNC_EXTI2) | |||
| #define IS_DMA_DMAMUX_SYNC_SIGNAL_ID(SIGNAL_ID) ((SIGNAL_ID) <= HAL_DMAMUX1_SYNC_TIM12_TRGO) | |||
| #define IS_BDMA_DMAMUX_SYNC_SIGNAL_ID(SIGNAL_ID) ((SIGNAL_ID) <= HAL_DMAMUX2_SYNC_EXTI2) | |||
| #define IS_DMAMUX_SYNC_REQUEST_NUMBER(REQUEST_NUMBER) (((REQUEST_NUMBER) > 0) && ((REQUEST_NUMBER) <= 32)) | |||
| #define IS_DMAMUX_SYNC_REQUEST_NUMBER(REQUEST_NUMBER) (((REQUEST_NUMBER) > 0U) && ((REQUEST_NUMBER) <= 32U)) | |||
| #define IS_DMAMUX_SYNC_POLARITY(POLARITY) (((POLARITY) == HAL_DMAMUX_SYNC_NO_EVENT) || \ | |||
| ((POLARITY) == HAL_DMAMUX_SYNC_RISING) || \ | |||
| @@ -284,10 +266,10 @@ void HAL_DMAEx_MUX_IRQHandler(DMA_HandleTypeDef *hdma); | |||
| #define IS_DMAMUX_SYNC_EVENT(EVENT) (((EVENT) == DISABLE) || \ | |||
| ((EVENT) == ENABLE)) | |||
| #define IS_D2_DMAMUX_REQUEST_GEN_SIGNAL_ID(SIGNAL_ID) ((SIGNAL_ID) <= HAL_DMAMUX1_REQ_GEN_TIM12_TRGO) | |||
| #define IS_D3_DMAMUX_REQUEST_GEN_SIGNAL_ID(SIGNAL_ID) ((SIGNAL_ID) <= HAL_DMAMUX2_REQ_GEN_BDMA_CH1_IT) | |||
| #define IS_DMA_DMAMUX_REQUEST_GEN_SIGNAL_ID(SIGNAL_ID) ((SIGNAL_ID) <= HAL_DMAMUX1_REQ_GEN_TIM12_TRGO) | |||
| #define IS_BDMA_DMAMUX_REQUEST_GEN_SIGNAL_ID(SIGNAL_ID) ((SIGNAL_ID) <= HAL_DMAMUX2_REQ_GEN_BDMA_CH1_IT) | |||
| #define IS_DMAMUX_REQUEST_GEN_REQUEST_NUMBER(REQUEST_NUMBER) (((REQUEST_NUMBER) > 0) && ((REQUEST_NUMBER) <= 32)) | |||
| #define IS_DMAMUX_REQUEST_GEN_REQUEST_NUMBER(REQUEST_NUMBER) (((REQUEST_NUMBER) > 0U) && ((REQUEST_NUMBER) <= 32U)) | |||
| #define IS_DMAMUX_REQUEST_GEN_POLARITY(POLARITY) (((POLARITY) == HAL_DMAMUX_REQ_GEN_NO_EVENT) || \ | |||
| ((POLARITY) == HAL_DMAMUX_REQ_GEN_RISING) || \ | |||
| @@ -319,6 +301,6 @@ void HAL_DMAEx_MUX_IRQHandler(DMA_HandleTypeDef *hdma); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_DMA_H */ | |||
| #endif /* STM32H7xx_HAL_DMA_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,35 +2,17 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_eth.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of ETH HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| @@ -56,11 +38,11 @@ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| #ifndef ETH_TX_DESC_CNT | |||
| #define ETH_TX_DESC_CNT 4 | |||
| #define ETH_TX_DESC_CNT 4U | |||
| #endif | |||
| #ifndef ETH_RX_DESC_CNT | |||
| #define ETH_RX_DESC_CNT 4 | |||
| #define ETH_RX_DESC_CNT 4U | |||
| #endif | |||
| /*********************** Descriptors struct def section ************************/ | |||
| @@ -71,18 +53,14 @@ | |||
| /** | |||
| * @brief ETH DMA Descriptor structure definition | |||
| */ | |||
| #if defined ( __GNUC__ ) | |||
| typedef struct __attribute__((packed)) | |||
| #else | |||
| typedef __packed struct | |||
| #endif | |||
| typedef struct | |||
| { | |||
| uint32_t DESC0; | |||
| uint32_t DESC1; | |||
| uint32_t DESC2; | |||
| uint32_t DESC3; | |||
| uint32_t BackupAddr0; /* used to store rx buffer 1 address */ | |||
| uint32_t BackupAddr1; /* used to store rx buffer 2 address */ | |||
| __IO uint32_t DESC0; | |||
| __IO uint32_t DESC1; | |||
| __IO uint32_t DESC2; | |||
| __IO uint32_t DESC3; | |||
| __IO uint32_t BackupAddr0; /* used to store rx buffer 1 address */ | |||
| __IO uint32_t BackupAddr1; /* used to store rx buffer 2 address */ | |||
| }ETH_DMADescTypeDef; | |||
| /** | |||
| * | |||
| @@ -377,8 +355,8 @@ typedef struct | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_ETH_MII_MODE = 0x00, /*!< Media Independent Interface */ | |||
| HAL_ETH_RMII_MODE = 0x01 /*!< Reduced Media Independent Interface */ | |||
| HAL_ETH_MII_MODE = 0x00U, /*!< Media Independent Interface */ | |||
| HAL_ETH_RMII_MODE = 0x01U /*!< Reduced Media Independent Interface */ | |||
| }ETH_MediaInterfaceTypeDef; | |||
| /** | |||
| * | |||
| @@ -408,15 +386,7 @@ typedef struct | |||
| /** | |||
| * @brief HAL State structures definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_ETH_STATE_RESET = 0x00, /*!< Peripheral not yet Initialized or disabled */ | |||
| HAL_ETH_STATE_READY = 0x10, /*!< Peripheral Communication started */ | |||
| HAL_ETH_STATE_BUSY = 0x23, /*!< an internal process is ongoing */ | |||
| HAL_ETH_STATE_BUSY_TX = 0x21, /*!< Transmission process is ongoing */ | |||
| HAL_ETH_STATE_BUSY_RX = 0x22, /*!< Reception process is ongoing */ | |||
| HAL_ETH_STATE_ERROR = 0xE0 /*!< Error State */ | |||
| }HAL_ETH_StateTypeDef; | |||
| typedef uint32_t HAL_ETH_StateTypeDef; | |||
| /** | |||
| * | |||
| */ | |||
| @@ -424,7 +394,11 @@ typedef enum | |||
| /** | |||
| * @brief ETH Handle Structure definition | |||
| */ | |||
| #if (USE_HAL_ETH_REGISTER_CALLBACKS == 1) | |||
| typedef struct __ETH_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif | |||
| { | |||
| ETH_TypeDef *Instance; /*!< Register base address */ | |||
| @@ -460,11 +434,53 @@ typedef struct | |||
| __IO uint32_t MACLPIEvent; /*!< Holds the LPI event when the an LPI status interrupt occurs. | |||
| This parameter can be a value of @ref ETHEx_LPI_Event */ | |||
| #if (USE_HAL_ETH_REGISTER_CALLBACKS == 1) | |||
| void (* TxCpltCallback) ( struct __ETH_HandleTypeDef * heth); /*!< ETH Tx Complete Callback */ | |||
| void (* RxCpltCallback) ( struct __ETH_HandleTypeDef * heth); /*!< ETH Rx Complete Callback */ | |||
| void (* DMAErrorCallback) ( struct __ETH_HandleTypeDef * heth); /*!< ETH DMA Error Callback */ | |||
| void (* MACErrorCallback) ( struct __ETH_HandleTypeDef * heth); /*!< ETH MAC Error Callback */ | |||
| void (* PMTCallback) ( struct __ETH_HandleTypeDef * heth); /*!< ETH Power Management Callback */ | |||
| void (* EEECallback) ( struct __ETH_HandleTypeDef * heth); /*!< ETH EEE Callback */ | |||
| void (* WakeUpCallback) ( struct __ETH_HandleTypeDef * heth); /*!< ETH Wake UP Callback */ | |||
| void (* MspInitCallback) ( struct __ETH_HandleTypeDef * heth); /*!< ETH Msp Init callback */ | |||
| void (* MspDeInitCallback) ( struct __ETH_HandleTypeDef * heth); /*!< ETH Msp DeInit callback */ | |||
| #endif /* USE_HAL_ETH_REGISTER_CALLBACKS */ | |||
| } ETH_HandleTypeDef; | |||
| /** | |||
| * | |||
| */ | |||
| #if (USE_HAL_ETH_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL ETH Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_ETH_MSPINIT_CB_ID = 0x00U, /*!< ETH MspInit callback ID */ | |||
| HAL_ETH_MSPDEINIT_CB_ID = 0x01U, /*!< ETH MspDeInit callback ID */ | |||
| HAL_ETH_TX_COMPLETE_CB_ID = 0x02U, /*!< ETH Tx Complete Callback ID */ | |||
| HAL_ETH_RX_COMPLETE_CB_ID = 0x03U, /*!< ETH Rx Complete Callback ID */ | |||
| HAL_ETH_DMA_ERROR_CB_ID = 0x04U, /*!< ETH DMA Error Callback ID */ | |||
| HAL_ETH_MAC_ERROR_CB_ID = 0x05U, /*!< ETH MAC Error Callback ID */ | |||
| HAL_ETH_PMT_CB_ID = 0x06U, /*!< ETH Power Management Callback ID */ | |||
| HAL_ETH_EEE_CB_ID = 0x07U, /*!< ETH EEE Callback ID */ | |||
| HAL_ETH_WAKEUP_CB_ID = 0x08U /*!< ETH Wake UP Callback ID */ | |||
| }HAL_ETH_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL ETH Callback pointer definition | |||
| */ | |||
| typedef void (*pETH_CallbackTypeDef)(ETH_HandleTypeDef * heth); /*!< pointer to an ETH callback function */ | |||
| #endif /* USE_HAL_ETH_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @brief ETH MAC filter structure definition | |||
| */ | |||
| @@ -542,54 +558,54 @@ typedef struct{ | |||
| /** | |||
| * @brief Bit definition of TDES0 RF register | |||
| */ | |||
| #define ETH_DMATXNDESCRF_B1AP ((uint32_t)0xFFFFFFFF) /*!< Transmit Packet Timestamp Low */ | |||
| #define ETH_DMATXNDESCRF_B1AP ((uint32_t)0xFFFFFFFFU) /*!< Transmit Packet Timestamp Low */ | |||
| /** | |||
| * @brief Bit definition of TDES1 RF register | |||
| */ | |||
| #define ETH_DMATXNDESCRF_B2AP ((uint32_t)0xFFFFFFFF) /*!< Transmit Packet Timestamp High */ | |||
| #define ETH_DMATXNDESCRF_B2AP ((uint32_t)0xFFFFFFFFU) /*!< Transmit Packet Timestamp High */ | |||
| /** | |||
| * @brief Bit definition of TDES2 RF register | |||
| */ | |||
| #define ETH_DMATXNDESCRF_IOC ((uint32_t)0x80000000) /*!< Interrupt on Completion */ | |||
| #define ETH_DMATXNDESCRF_TTSE ((uint32_t)0x40000000) /*!< Transmit Timestamp Enable */ | |||
| #define ETH_DMATXNDESCRF_B2L ((uint32_t)0x3FFF0000) /*!< Buffer 2 Length */ | |||
| #define ETH_DMATXNDESCRF_VTIR ((uint32_t)0x0000C000) /*!< VLAN Tag Insertion or Replacement mask */ | |||
| #define ETH_DMATXNDESCRF_VTIR_DISABLE ((uint32_t)0x00000000) /*!< Do not add a VLAN tag. */ | |||
| #define ETH_DMATXNDESCRF_VTIR_REMOVE ((uint32_t)0x00004000) /*!< Remove the VLAN tag from the packets before transmission. */ | |||
| #define ETH_DMATXNDESCRF_VTIR_INSERT ((uint32_t)0x00008000) /*!< Insert a VLAN tag. */ | |||
| #define ETH_DMATXNDESCRF_VTIR_REPLACE ((uint32_t)0x0000C000) /*!< Replace the VLAN tag. */ | |||
| #define ETH_DMATXNDESCRF_B1L ((uint32_t)0x00003FFF) /*!< Buffer 1 Length */ | |||
| #define ETH_DMATXNDESCRF_HL ((uint32_t)0x000003FF) /*!< Header Length */ | |||
| #define ETH_DMATXNDESCRF_IOC ((uint32_t)0x80000000U) /*!< Interrupt on Completion */ | |||
| #define ETH_DMATXNDESCRF_TTSE ((uint32_t)0x40000000U) /*!< Transmit Timestamp Enable */ | |||
| #define ETH_DMATXNDESCRF_B2L ((uint32_t)0x3FFF0000U) /*!< Buffer 2 Length */ | |||
| #define ETH_DMATXNDESCRF_VTIR ((uint32_t)0x0000C000U) /*!< VLAN Tag Insertion or Replacement mask */ | |||
| #define ETH_DMATXNDESCRF_VTIR_DISABLE ((uint32_t)0x00000000U) /*!< Do not add a VLAN tag. */ | |||
| #define ETH_DMATXNDESCRF_VTIR_REMOVE ((uint32_t)0x00004000U) /*!< Remove the VLAN tag from the packets before transmission. */ | |||
| #define ETH_DMATXNDESCRF_VTIR_INSERT ((uint32_t)0x00008000U) /*!< Insert a VLAN tag. */ | |||
| #define ETH_DMATXNDESCRF_VTIR_REPLACE ((uint32_t)0x0000C000U) /*!< Replace the VLAN tag. */ | |||
| #define ETH_DMATXNDESCRF_B1L ((uint32_t)0x00003FFFU) /*!< Buffer 1 Length */ | |||
| #define ETH_DMATXNDESCRF_HL ((uint32_t)0x000003FFU) /*!< Header Length */ | |||
| /** | |||
| * @brief Bit definition of TDES3 RF register | |||
| */ | |||
| #define ETH_DMATXNDESCRF_OWN ((uint32_t)0x80000000) /*!< OWN bit: descriptor is owned by DMA engine */ | |||
| #define ETH_DMATXNDESCRF_CTXT ((uint32_t)0x40000000) /*!< Context Type */ | |||
| #define ETH_DMATXNDESCRF_FD ((uint32_t)0x20000000) /*!< First Descriptor */ | |||
| #define ETH_DMATXNDESCRF_LD ((uint32_t)0x10000000) /*!< Last Descriptor */ | |||
| #define ETH_DMATXNDESCRF_CPC ((uint32_t)0x0C000000) /*!< CRC Pad Control mask */ | |||
| #define ETH_DMATXNDESCRF_CPC_CRCPAD_INSERT ((uint32_t)0x00000000) /*!< CRC Pad Control: CRC and Pad Insertion */ | |||
| #define ETH_DMATXNDESCRF_CPC_CRC_INSERT ((uint32_t)0x04000000) /*!< CRC Pad Control: CRC Insertion (Disable Pad Insertion) */ | |||
| #define ETH_DMATXNDESCRF_CPC_DISABLE ((uint32_t)0x08000000) /*!< CRC Pad Control: Disable CRC Insertion */ | |||
| #define ETH_DMATXNDESCRF_CPC_CRC_REPLACE ((uint32_t)0x0C000000) /*!< CRC Pad Control: CRC Replacement */ | |||
| #define ETH_DMATXNDESCRF_SAIC ((uint32_t)0x03800000) /*!< SA Insertion Control mask*/ | |||
| #define ETH_DMATXNDESCRF_SAIC_DISABLE ((uint32_t)0x00000000) /*!< SA Insertion Control: Do not include the source address */ | |||
| #define ETH_DMATXNDESCRF_SAIC_INSERT ((uint32_t)0x00800000) /*!< SA Insertion Control: Include or insert the source address */ | |||
| #define ETH_DMATXNDESCRF_SAIC_REPLACE ((uint32_t)0x01000000) /*!< SA Insertion Control: Replace the source address */ | |||
| #define ETH_DMATXNDESCRF_THL ((uint32_t)0x00780000) /*!< TCP Header Length */ | |||
| #define ETH_DMATXNDESCRF_TSE ((uint32_t)0x00040000) /*!< TCP segmentation enable */ | |||
| #define ETH_DMATXNDESCRF_CIC ((uint32_t)0x00030000) /*!< Checksum Insertion Control: 4 cases */ | |||
| #define ETH_DMATXNDESCRF_CIC_DISABLE ((uint32_t)0x00000000) /*!< Do Nothing: Checksum Engine is disabled */ | |||
| #define ETH_DMATXNDESCRF_CIC_IPHDR_INSERT ((uint32_t)0x00010000) /*!< Only IP header checksum calculation and insertion are enabled. */ | |||
| #define ETH_DMATXNDESCRF_CIC_IPHDR_PAYLOAD_INSERT ((uint32_t)0x00020000) /*!< IP header checksum and payload checksum calculation and insertion are | |||
| #define ETH_DMATXNDESCRF_OWN ((uint32_t)0x80000000U) /*!< OWN bit: descriptor is owned by DMA engine */ | |||
| #define ETH_DMATXNDESCRF_CTXT ((uint32_t)0x40000000U) /*!< Context Type */ | |||
| #define ETH_DMATXNDESCRF_FD ((uint32_t)0x20000000U) /*!< First Descriptor */ | |||
| #define ETH_DMATXNDESCRF_LD ((uint32_t)0x10000000U) /*!< Last Descriptor */ | |||
| #define ETH_DMATXNDESCRF_CPC ((uint32_t)0x0C000000U) /*!< CRC Pad Control mask */ | |||
| #define ETH_DMATXNDESCRF_CPC_CRCPAD_INSERT ((uint32_t)0x00000000U) /*!< CRC Pad Control: CRC and Pad Insertion */ | |||
| #define ETH_DMATXNDESCRF_CPC_CRC_INSERT ((uint32_t)0x04000000U) /*!< CRC Pad Control: CRC Insertion (Disable Pad Insertion) */ | |||
| #define ETH_DMATXNDESCRF_CPC_DISABLE ((uint32_t)0x08000000U) /*!< CRC Pad Control: Disable CRC Insertion */ | |||
| #define ETH_DMATXNDESCRF_CPC_CRC_REPLACE ((uint32_t)0x0C000000U) /*!< CRC Pad Control: CRC Replacement */ | |||
| #define ETH_DMATXNDESCRF_SAIC ((uint32_t)0x03800000U) /*!< SA Insertion Control mask*/ | |||
| #define ETH_DMATXNDESCRF_SAIC_DISABLE ((uint32_t)0x00000000U) /*!< SA Insertion Control: Do not include the source address */ | |||
| #define ETH_DMATXNDESCRF_SAIC_INSERT ((uint32_t)0x00800000U) /*!< SA Insertion Control: Include or insert the source address */ | |||
| #define ETH_DMATXNDESCRF_SAIC_REPLACE ((uint32_t)0x01000000U) /*!< SA Insertion Control: Replace the source address */ | |||
| #define ETH_DMATXNDESCRF_THL ((uint32_t)0x00780000U) /*!< TCP Header Length */ | |||
| #define ETH_DMATXNDESCRF_TSE ((uint32_t)0x00040000U) /*!< TCP segmentation enable */ | |||
| #define ETH_DMATXNDESCRF_CIC ((uint32_t)0x00030000U) /*!< Checksum Insertion Control: 4 cases */ | |||
| #define ETH_DMATXNDESCRF_CIC_DISABLE ((uint32_t)0x00000000U) /*!< Do Nothing: Checksum Engine is disabled */ | |||
| #define ETH_DMATXNDESCRF_CIC_IPHDR_INSERT ((uint32_t)0x00010000U) /*!< Only IP header checksum calculation and insertion are enabled. */ | |||
| #define ETH_DMATXNDESCRF_CIC_IPHDR_PAYLOAD_INSERT ((uint32_t)0x00020000U) /*!< IP header checksum and payload checksum calculation and insertion are | |||
| enabled, but pseudo header checksum is not calculated in hardware */ | |||
| #define ETH_DMATXNDESCRF_CIC_IPHDR_PAYLOAD_INSERT_PHDR_CALC ((uint32_t)0x00030000) /*!< IP Header checksum and payload checksum calculation and insertion are | |||
| #define ETH_DMATXNDESCRF_CIC_IPHDR_PAYLOAD_INSERT_PHDR_CALC ((uint32_t)0x00030000U) /*!< IP Header checksum and payload checksum calculation and insertion are | |||
| enabled, and pseudo header checksum is calculated in hardware. */ | |||
| #define ETH_DMATXNDESCRF_TPL ((uint32_t)0x0003FFFF) /*!< TCP Payload Length */ | |||
| #define ETH_DMATXNDESCRF_FL ((uint32_t)0x00007FFF) /*!< Transmit End of Ring */ | |||
| #define ETH_DMATXNDESCRF_TPL ((uint32_t)0x0003FFFFU) /*!< TCP Payload Length */ | |||
| #define ETH_DMATXNDESCRF_FL ((uint32_t)0x00007FFFU) /*!< Transmit End of Ring */ | |||
| /* | |||
| DMA Tx Normal Descriptor Write Back Format | |||
| @@ -607,36 +623,36 @@ typedef struct{ | |||
| /** | |||
| * @brief Bit definition of TDES0 WBF register | |||
| */ | |||
| #define ETH_DMATXNDESCWBF_TTSL ((uint32_t)0xFFFFFFFF) /*!< Buffer1 Address Pointer or TSO Header Address Pointer */ | |||
| #define ETH_DMATXNDESCWBF_TTSL ((uint32_t)0xFFFFFFFFU) /*!< Buffer1 Address Pointer or TSO Header Address Pointer */ | |||
| /** | |||
| * @brief Bit definition of TDES1 WBF register | |||
| */ | |||
| #define ETH_DMATXNDESCWBF_TTSH ((uint32_t)0xFFFFFFFF) /*!< Buffer2 Address Pointer */ | |||
| #define ETH_DMATXNDESCWBF_TTSH ((uint32_t)0xFFFFFFFFU) /*!< Buffer2 Address Pointer */ | |||
| /** | |||
| * @brief Bit definition of TDES3 WBF register | |||
| */ | |||
| #define ETH_DMATXNDESCWBF_OWN ((uint32_t)0x80000000) /*!< OWN bit: descriptor is owned by DMA engine */ | |||
| #define ETH_DMATXNDESCWBF_CTXT ((uint32_t)0x40000000) /*!< Context Type */ | |||
| #define ETH_DMATXNDESCWBF_FD ((uint32_t)0x20000000) /*!< First Descriptor */ | |||
| #define ETH_DMATXNDESCWBF_LD ((uint32_t)0x10000000) /*!< Last Descriptor */ | |||
| #define ETH_DMATXNDESCWBF_TTSS ((uint32_t)0x00020000) /*!< Tx Timestamp Status */ | |||
| #define ETH_DMATXNDESCWBF_DP ((uint32_t)0x04000000) /*!< Disable Padding */ | |||
| #define ETH_DMATXNDESCWBF_TTSE ((uint32_t)0x02000000) /*!< Transmit Timestamp Enable */ | |||
| #define ETH_DMATXNDESCWBF_ES ((uint32_t)0x00008000) /*!< Error summary: OR of the following bits: IHE || UF || ED || EC || LCO || PCE || NC || LCA || FF || JT */ | |||
| #define ETH_DMATXNDESCWBF_JT ((uint32_t)0x00004000) /*!< Jabber Timeout */ | |||
| #define ETH_DMATXNDESCWBF_FF ((uint32_t)0x00002000) /*!< Packet Flushed: DMA/MTL flushed the packet due to SW flush */ | |||
| #define ETH_DMATXNDESCWBF_PCE ((uint32_t)0x00001000) /*!< Payload Checksum Error */ | |||
| #define ETH_DMATXNDESCWBF_LCA ((uint32_t)0x00000800) /*!< Loss of Carrier: carrier lost during transmission */ | |||
| #define ETH_DMATXNDESCWBF_NC ((uint32_t)0x00000400) /*!< No Carrier: no carrier signal from the transceiver */ | |||
| #define ETH_DMATXNDESCWBF_LCO ((uint32_t)0x00000200) /*!< Late Collision: transmission aborted due to collision */ | |||
| #define ETH_DMATXNDESCWBF_EC ((uint32_t)0x00000100) /*!< Excessive Collision: transmission aborted after 16 collisions */ | |||
| #define ETH_DMATXNDESCWBF_CC ((uint32_t)0x000000F0) /*!< Collision Count */ | |||
| #define ETH_DMATXNDESCWBF_ED ((uint32_t)0x00000008) /*!< Excessive Deferral */ | |||
| #define ETH_DMATXNDESCWBF_UF ((uint32_t)0x00000004) /*!< Underflow Error: late data arrival from the memory */ | |||
| #define ETH_DMATXNDESCWBF_DB ((uint32_t)0x00000002) /*!< Deferred Bit */ | |||
| #define ETH_DMATXNDESCWBF_IHE ((uint32_t)0x00000004) /*!< IP Header Error */ | |||
| #define ETH_DMATXNDESCWBF_OWN ((uint32_t)0x80000000U) /*!< OWN bit: descriptor is owned by DMA engine */ | |||
| #define ETH_DMATXNDESCWBF_CTXT ((uint32_t)0x40000000U) /*!< Context Type */ | |||
| #define ETH_DMATXNDESCWBF_FD ((uint32_t)0x20000000U) /*!< First Descriptor */ | |||
| #define ETH_DMATXNDESCWBF_LD ((uint32_t)0x10000000U) /*!< Last Descriptor */ | |||
| #define ETH_DMATXNDESCWBF_TTSS ((uint32_t)0x00020000U) /*!< Tx Timestamp Status */ | |||
| #define ETH_DMATXNDESCWBF_DP ((uint32_t)0x04000000U) /*!< Disable Padding */ | |||
| #define ETH_DMATXNDESCWBF_TTSE ((uint32_t)0x02000000U) /*!< Transmit Timestamp Enable */ | |||
| #define ETH_DMATXNDESCWBF_ES ((uint32_t)0x00008000U) /*!< Error summary: OR of the following bits: IHE || UF || ED || EC || LCO || PCE || NC || LCA || FF || JT */ | |||
| #define ETH_DMATXNDESCWBF_JT ((uint32_t)0x00004000U) /*!< Jabber Timeout */ | |||
| #define ETH_DMATXNDESCWBF_FF ((uint32_t)0x00002000U) /*!< Packet Flushed: DMA/MTL flushed the packet due to SW flush */ | |||
| #define ETH_DMATXNDESCWBF_PCE ((uint32_t)0x00001000U) /*!< Payload Checksum Error */ | |||
| #define ETH_DMATXNDESCWBF_LCA ((uint32_t)0x00000800U) /*!< Loss of Carrier: carrier lost during transmission */ | |||
| #define ETH_DMATXNDESCWBF_NC ((uint32_t)0x00000400U) /*!< No Carrier: no carrier signal from the transceiver */ | |||
| #define ETH_DMATXNDESCWBF_LCO ((uint32_t)0x00000200U) /*!< Late Collision: transmission aborted due to collision */ | |||
| #define ETH_DMATXNDESCWBF_EC ((uint32_t)0x00000100U) /*!< Excessive Collision: transmission aborted after 16 collisions */ | |||
| #define ETH_DMATXNDESCWBF_CC ((uint32_t)0x000000F0U) /*!< Collision Count */ | |||
| #define ETH_DMATXNDESCWBF_ED ((uint32_t)0x00000008U) /*!< Excessive Deferral */ | |||
| #define ETH_DMATXNDESCWBF_UF ((uint32_t)0x00000004U) /*!< Underflow Error: late data arrival from the memory */ | |||
| #define ETH_DMATXNDESCWBF_DB ((uint32_t)0x00000002U) /*!< Deferred Bit */ | |||
| #define ETH_DMATXNDESCWBF_IHE ((uint32_t)0x00000004U) /*!< IP Header Error */ | |||
| /* | |||
| @@ -655,35 +671,35 @@ typedef struct{ | |||
| /** | |||
| * @brief Bit definition of Tx context descriptor register 0 | |||
| */ | |||
| #define ETH_DMATXCDESC_TTSL ((uint32_t)0xFFFFFFFF) /*!< Transmit Packet Timestamp Low */ | |||
| #define ETH_DMATXCDESC_TTSL ((uint32_t)0xFFFFFFFFU) /*!< Transmit Packet Timestamp Low */ | |||
| /** | |||
| * @brief Bit definition of Tx context descriptor register 1 | |||
| */ | |||
| #define ETH_DMATXCDESC_TTSH ((uint32_t)0xFFFFFFFF) /*!< Transmit Packet Timestamp High */ | |||
| #define ETH_DMATXCDESC_TTSH ((uint32_t)0xFFFFFFFFU) /*!< Transmit Packet Timestamp High */ | |||
| /** | |||
| * @brief Bit definition of Tx context descriptor register 2 | |||
| */ | |||
| #define ETH_DMATXCDESC_IVT ((uint32_t)0xFFFF0000) /*!< Inner VLAN Tag */ | |||
| #define ETH_DMATXCDESC_MSS ((uint32_t)0x00003FFF) /*!< Maximum Segment Size */ | |||
| #define ETH_DMATXCDESC_IVT ((uint32_t)0xFFFF0000U) /*!< Inner VLAN Tag */ | |||
| #define ETH_DMATXCDESC_MSS ((uint32_t)0x00003FFFU) /*!< Maximum Segment Size */ | |||
| /** | |||
| * @brief Bit definition of Tx context descriptor register 3 | |||
| */ | |||
| #define ETH_DMATXCDESC_OWN ((uint32_t)0x80000000) /*!< OWN bit: descriptor is owned by DMA engine */ | |||
| #define ETH_DMATXCDESC_CTXT ((uint32_t)0x40000000) /*!< Context Type */ | |||
| #define ETH_DMATXCDESC_OSTC ((uint32_t)0x08000000) /*!< One-Step Timestamp Correction Enable */ | |||
| #define ETH_DMATXCDESC_TCMSSV ((uint32_t)0x04000000) /*!< One-Step Timestamp Correction Input or MSS Valid */ | |||
| #define ETH_DMATXCDESC_CDE ((uint32_t)0x00800000) /*!< Context Descriptor Error */ | |||
| #define ETH_DMATXCDESC_IVTIR ((uint32_t)0x000C0000) /*!< Inner VLAN Tag Insert or Replace Mask */ | |||
| #define ETH_DMATXCDESC_IVTIR_DISABLE ((uint32_t)0x00000000) /*!< Do not add the inner VLAN tag. */ | |||
| #define ETH_DMATXCDESC_IVTIR_REMOVE ((uint32_t)0x00040000) /*!< Remove the inner VLAN tag from the packets before transmission. */ | |||
| #define ETH_DMATXCDESC_IVTIR_INSERT ((uint32_t)0x00080000) /*!< Insert the inner VLAN tag. */ | |||
| #define ETH_DMATXCDESC_IVTIR_REPLACE ((uint32_t)0x000C0000) /*!< Replace the inner VLAN tag. */ | |||
| #define ETH_DMATXCDESC_IVLTV ((uint32_t)0x00020000) /*!< Inner VLAN Tag Valid */ | |||
| #define ETH_DMATXCDESC_VLTV ((uint32_t)0x00010000) /*!< VLAN Tag Valid */ | |||
| #define ETH_DMATXCDESC_VT ((uint32_t)0x0000FFFF) /*!< VLAN Tag */ | |||
| #define ETH_DMATXCDESC_OWN ((uint32_t)0x80000000U) /*!< OWN bit: descriptor is owned by DMA engine */ | |||
| #define ETH_DMATXCDESC_CTXT ((uint32_t)0x40000000U) /*!< Context Type */ | |||
| #define ETH_DMATXCDESC_OSTC ((uint32_t)0x08000000U) /*!< One-Step Timestamp Correction Enable */ | |||
| #define ETH_DMATXCDESC_TCMSSV ((uint32_t)0x04000000U) /*!< One-Step Timestamp Correction Input or MSS Valid */ | |||
| #define ETH_DMATXCDESC_CDE ((uint32_t)0x00800000U) /*!< Context Descriptor Error */ | |||
| #define ETH_DMATXCDESC_IVTIR ((uint32_t)0x000C0000U) /*!< Inner VLAN Tag Insert or Replace Mask */ | |||
| #define ETH_DMATXCDESC_IVTIR_DISABLE ((uint32_t)0x00000000U) /*!< Do not add the inner VLAN tag. */ | |||
| #define ETH_DMATXCDESC_IVTIR_REMOVE ((uint32_t)0x00040000U) /*!< Remove the inner VLAN tag from the packets before transmission. */ | |||
| #define ETH_DMATXCDESC_IVTIR_INSERT ((uint32_t)0x00080000U) /*!< Insert the inner VLAN tag. */ | |||
| #define ETH_DMATXCDESC_IVTIR_REPLACE ((uint32_t)0x000C0000U) /*!< Replace the inner VLAN tag. */ | |||
| #define ETH_DMATXCDESC_IVLTV ((uint32_t)0x00020000U) /*!< Inner VLAN Tag Valid */ | |||
| #define ETH_DMATXCDESC_VLTV ((uint32_t)0x00010000U) /*!< VLAN Tag Valid */ | |||
| #define ETH_DMATXCDESC_VT ((uint32_t)0x0000FFFFU) /*!< VLAN Tag */ | |||
| /** | |||
| * @} | |||
| @@ -710,20 +726,20 @@ typedef struct{ | |||
| /** | |||
| * @brief Bit definition of Rx normal descriptor register 0 read format | |||
| */ | |||
| #define ETH_DMARXNDESCRF_BUF1AP ((uint32_t)0xFFFFFFFF) /*!< Header or Buffer 1 Address Pointer */ | |||
| #define ETH_DMARXNDESCRF_BUF1AP ((uint32_t)0xFFFFFFFFU) /*!< Header or Buffer 1 Address Pointer */ | |||
| /** | |||
| * @brief Bit definition of Rx normal descriptor register 2 read format | |||
| */ | |||
| #define ETH_DMARXNDESCRF_BUF2AP ((uint32_t)0xFFFFFFFF) /*!< Buffer 2 Address Pointer */ | |||
| #define ETH_DMARXNDESCRF_BUF2AP ((uint32_t)0xFFFFFFFFU) /*!< Buffer 2 Address Pointer */ | |||
| /** | |||
| * @brief Bit definition of Rx normal descriptor register 3 read format | |||
| */ | |||
| #define ETH_DMARXNDESCRF_OWN ((uint32_t)0x80000000) /*!< OWN bit: descriptor is owned by DMA engine */ | |||
| #define ETH_DMARXNDESCRF_IOC ((uint32_t)0x40000000) /*!< Interrupt Enabled on Completion */ | |||
| #define ETH_DMARXNDESCRF_BUF2V ((uint32_t)0x02000000) /*!< Buffer 2 Address Valid */ | |||
| #define ETH_DMARXNDESCRF_BUF1V ((uint32_t)0x01000000) /*!< Buffer 1 Address Valid */ | |||
| #define ETH_DMARXNDESCRF_OWN ((uint32_t)0x80000000U) /*!< OWN bit: descriptor is owned by DMA engine */ | |||
| #define ETH_DMARXNDESCRF_IOC ((uint32_t)0x40000000U) /*!< Interrupt Enabled on Completion */ | |||
| #define ETH_DMARXNDESCRF_BUF2V ((uint32_t)0x02000000U) /*!< Buffer 2 Address Valid */ | |||
| #define ETH_DMARXNDESCRF_BUF1V ((uint32_t)0x01000000U) /*!< Buffer 1 Address Valid */ | |||
| /* | |||
| DMA Rx Normal Descriptor write back format | |||
| @@ -741,80 +757,80 @@ typedef struct{ | |||
| /** | |||
| * @brief Bit definition of Rx normal descriptor register 0 write back format | |||
| */ | |||
| #define ETH_DMARXNDESCWBF_IVT ((uint32_t)0xFFFF0000) /*!< Inner VLAN Tag */ | |||
| #define ETH_DMARXNDESCWBF_OVT ((uint32_t)0x0000FFFF) /*!< Outer VLAN Tag */ | |||
| #define ETH_DMARXNDESCWBF_IVT ((uint32_t)0xFFFF0000U) /*!< Inner VLAN Tag */ | |||
| #define ETH_DMARXNDESCWBF_OVT ((uint32_t)0x0000FFFFU) /*!< Outer VLAN Tag */ | |||
| /** | |||
| * @brief Bit definition of Rx normal descriptor register 1 write back format | |||
| */ | |||
| #define ETH_DMARXNDESCWBF_OPC ((uint32_t)0xFFFF0000) /*!< OAM Sub-Type Code, or MAC Control Packet opcode */ | |||
| #define ETH_DMARXNDESCWBF_TD ((uint32_t)0x00008000) /*!< Timestamp Dropped */ | |||
| #define ETH_DMARXNDESCWBF_TSA ((uint32_t)0x00004000) /*!< Timestamp Available */ | |||
| #define ETH_DMARXNDESCWBF_PV ((uint32_t)0x00002000) /*!< PTP Version */ | |||
| #define ETH_DMARXNDESCWBF_PFT ((uint32_t)0x00001000) /*!< PTP Packet Type */ | |||
| #define ETH_DMARXNDESCWBF_PMT_NO ((uint32_t)0x00000000) /*!< PTP Message Type: No PTP message received */ | |||
| #define ETH_DMARXNDESCWBF_PMT_SYNC ((uint32_t)0x00000100) /*!< PTP Message Type: SYNC (all clock types) */ | |||
| #define ETH_DMARXNDESCWBF_PMT_FUP ((uint32_t)0x00000200) /*!< PTP Message Type: Follow_Up (all clock types) */ | |||
| #define ETH_DMARXNDESCWBF_PMT_DREQ ((uint32_t)0x00000300) /*!< PTP Message Type: Delay_Req (all clock types) */ | |||
| #define ETH_DMARXNDESCWBF_PMT_DRESP ((uint32_t)0x00000400) /*!< PTP Message Type: Delay_Resp (all clock types) */ | |||
| #define ETH_DMARXNDESCWBF_PMT_PDREQ ((uint32_t)0x00000500) /*!< PTP Message Type: Pdelay_Req (in peer-to-peer transparent clock) */ | |||
| #define ETH_DMARXNDESCWBF_PMT_PDRESP ((uint32_t)0x00000600) /*!< PTP Message Type: Pdelay_Resp (in peer-to-peer transparent clock) */ | |||
| #define ETH_DMARXNDESCWBF_PMT_PDRESPFUP ((uint32_t)0x00000700) /*!< PTP Message Type: Pdelay_Resp_Follow_Up (in peer-to-peer transparent clock) */ | |||
| #define ETH_DMARXNDESCWBF_PMT_ANNOUNCE ((uint32_t)0x00000800) /*!< PTP Message Type: Announce */ | |||
| #define ETH_DMARXNDESCWBF_PMT_MANAG ((uint32_t)0x00000900) /*!< PTP Message Type: Management */ | |||
| #define ETH_DMARXNDESCWBF_PMT_SIGN ((uint32_t)0x00000A00) /*!< PTP Message Type: Signaling */ | |||
| #define ETH_DMARXNDESCWBF_PMT_RESERVED ((uint32_t)0x00000F00) /*!< PTP Message Type: PTP packet with Reserved message type */ | |||
| #define ETH_DMARXNDESCWBF_IPCE ((uint32_t)0x00000080) /*!< IP Payload Error */ | |||
| #define ETH_DMARXNDESCWBF_IPCB ((uint32_t)0x00000040) /*!< IP Checksum Bypassed */ | |||
| #define ETH_DMARXNDESCWBF_IPV6 ((uint32_t)0x00000020) /*!< IPv6 header Present */ | |||
| #define ETH_DMARXNDESCWBF_IPV4 ((uint32_t)0x00000010) /*!< IPv4 header Present */ | |||
| #define ETH_DMARXNDESCWBF_IPHE ((uint32_t)0x00000008) /*!< IP Header Error */ | |||
| #define ETH_DMARXNDESCWBF_PT ((uint32_t)0x00000003) /*!< Payload Type mask */ | |||
| #define ETH_DMARXNDESCWBF_PT_UNKNOWN ((uint32_t)0x00000000) /*!< Payload Type: Unknown type or IP/AV payload not processed */ | |||
| #define ETH_DMARXNDESCWBF_PT_UDP ((uint32_t)0x00000001) /*!< Payload Type: UDP */ | |||
| #define ETH_DMARXNDESCWBF_PT_TCP ((uint32_t)0x00000002) /*!< Payload Type: TCP */ | |||
| #define ETH_DMARXNDESCWBF_PT_ICMP ((uint32_t)0x00000003) /*!< Payload Type: ICMP */ | |||
| #define ETH_DMARXNDESCWBF_OPC ((uint32_t)0xFFFF0000U) /*!< OAM Sub-Type Code, or MAC Control Packet opcode */ | |||
| #define ETH_DMARXNDESCWBF_TD ((uint32_t)0x00008000U) /*!< Timestamp Dropped */ | |||
| #define ETH_DMARXNDESCWBF_TSA ((uint32_t)0x00004000U) /*!< Timestamp Available */ | |||
| #define ETH_DMARXNDESCWBF_PV ((uint32_t)0x00002000U) /*!< PTP Version */ | |||
| #define ETH_DMARXNDESCWBF_PFT ((uint32_t)0x00001000U) /*!< PTP Packet Type */ | |||
| #define ETH_DMARXNDESCWBF_PMT_NO ((uint32_t)0x00000000U) /*!< PTP Message Type: No PTP message received */ | |||
| #define ETH_DMARXNDESCWBF_PMT_SYNC ((uint32_t)0x00000100U) /*!< PTP Message Type: SYNC (all clock types) */ | |||
| #define ETH_DMARXNDESCWBF_PMT_FUP ((uint32_t)0x00000200U) /*!< PTP Message Type: Follow_Up (all clock types) */ | |||
| #define ETH_DMARXNDESCWBF_PMT_DREQ ((uint32_t)0x00000300U) /*!< PTP Message Type: Delay_Req (all clock types) */ | |||
| #define ETH_DMARXNDESCWBF_PMT_DRESP ((uint32_t)0x00000400U) /*!< PTP Message Type: Delay_Resp (all clock types) */ | |||
| #define ETH_DMARXNDESCWBF_PMT_PDREQ ((uint32_t)0x00000500U) /*!< PTP Message Type: Pdelay_Req (in peer-to-peer transparent clock) */ | |||
| #define ETH_DMARXNDESCWBF_PMT_PDRESP ((uint32_t)0x00000600U) /*!< PTP Message Type: Pdelay_Resp (in peer-to-peer transparent clock) */ | |||
| #define ETH_DMARXNDESCWBF_PMT_PDRESPFUP ((uint32_t)0x00000700U) /*!< PTP Message Type: Pdelay_Resp_Follow_Up (in peer-to-peer transparent clock) */ | |||
| #define ETH_DMARXNDESCWBF_PMT_ANNOUNCE ((uint32_t)0x00000800U) /*!< PTP Message Type: Announce */ | |||
| #define ETH_DMARXNDESCWBF_PMT_MANAG ((uint32_t)0x00000900U) /*!< PTP Message Type: Management */ | |||
| #define ETH_DMARXNDESCWBF_PMT_SIGN ((uint32_t)0x00000A00U) /*!< PTP Message Type: Signaling */ | |||
| #define ETH_DMARXNDESCWBF_PMT_RESERVED ((uint32_t)0x00000F00U) /*!< PTP Message Type: PTP packet with Reserved message type */ | |||
| #define ETH_DMARXNDESCWBF_IPCE ((uint32_t)0x00000080U) /*!< IP Payload Error */ | |||
| #define ETH_DMARXNDESCWBF_IPCB ((uint32_t)0x00000040U) /*!< IP Checksum Bypassed */ | |||
| #define ETH_DMARXNDESCWBF_IPV6 ((uint32_t)0x00000020U) /*!< IPv6 header Present */ | |||
| #define ETH_DMARXNDESCWBF_IPV4 ((uint32_t)0x00000010U) /*!< IPv4 header Present */ | |||
| #define ETH_DMARXNDESCWBF_IPHE ((uint32_t)0x00000008U) /*!< IP Header Error */ | |||
| #define ETH_DMARXNDESCWBF_PT ((uint32_t)0x00000003U) /*!< Payload Type mask */ | |||
| #define ETH_DMARXNDESCWBF_PT_UNKNOWN ((uint32_t)0x00000000U) /*!< Payload Type: Unknown type or IP/AV payload not processed */ | |||
| #define ETH_DMARXNDESCWBF_PT_UDP ((uint32_t)0x00000001U) /*!< Payload Type: UDP */ | |||
| #define ETH_DMARXNDESCWBF_PT_TCP ((uint32_t)0x00000002U) /*!< Payload Type: TCP */ | |||
| #define ETH_DMARXNDESCWBF_PT_ICMP ((uint32_t)0x00000003U) /*!< Payload Type: ICMP */ | |||
| /** | |||
| * @brief Bit definition of Rx normal descriptor register 2 write back format | |||
| */ | |||
| #define ETH_DMARXNDESCWBF_L3L4FM ((uint32_t)0x20000000) /*!< L3 and L4 Filter Number Matched: if reset filter 0 is matched , if set filter 1 is matched */ | |||
| #define ETH_DMARXNDESCWBF_L4FM ((uint32_t)0x10000000) /*!< Layer 4 Filter Match */ | |||
| #define ETH_DMARXNDESCWBF_L3FM ((uint32_t)0x08000000) /*!< Layer 3 Filter Match */ | |||
| #define ETH_DMARXNDESCWBF_MADRM ((uint32_t)0x07F80000) /*!< MAC Address Match or Hash Value */ | |||
| #define ETH_DMARXNDESCWBF_HF ((uint32_t)0x00040000) /*!< Hash Filter Status */ | |||
| #define ETH_DMARXNDESCWBF_DAF ((uint32_t)0x00020000) /*!< Destination Address Filter Fail */ | |||
| #define ETH_DMARXNDESCWBF_SAF ((uint32_t)0x00010000) /*!< SA Address Filter Fail */ | |||
| #define ETH_DMARXNDESCWBF_VF ((uint32_t)0x00008000) /*!< VLAN Filter Status */ | |||
| #define ETH_DMARXNDESCWBF_ARPNR ((uint32_t)0x00000400) /*!< ARP Reply Not Generated */ | |||
| #define ETH_DMARXNDESCWBF_L3L4FM ((uint32_t)0x20000000U) /*!< L3 and L4 Filter Number Matched: if reset filter 0 is matched , if set filter 1 is matched */ | |||
| #define ETH_DMARXNDESCWBF_L4FM ((uint32_t)0x10000000U) /*!< Layer 4 Filter Match */ | |||
| #define ETH_DMARXNDESCWBF_L3FM ((uint32_t)0x08000000U) /*!< Layer 3 Filter Match */ | |||
| #define ETH_DMARXNDESCWBF_MADRM ((uint32_t)0x07F80000U) /*!< MAC Address Match or Hash Value */ | |||
| #define ETH_DMARXNDESCWBF_HF ((uint32_t)0x00040000U) /*!< Hash Filter Status */ | |||
| #define ETH_DMARXNDESCWBF_DAF ((uint32_t)0x00020000U) /*!< Destination Address Filter Fail */ | |||
| #define ETH_DMARXNDESCWBF_SAF ((uint32_t)0x00010000U) /*!< SA Address Filter Fail */ | |||
| #define ETH_DMARXNDESCWBF_VF ((uint32_t)0x00008000U) /*!< VLAN Filter Status */ | |||
| #define ETH_DMARXNDESCWBF_ARPNR ((uint32_t)0x00000400U) /*!< ARP Reply Not Generated */ | |||
| /** | |||
| * @brief Bit definition of Rx normal descriptor register 3 write back format | |||
| */ | |||
| #define ETH_DMARXNDESCWBF_OWN ((uint32_t)0x80000000) /*!< Own Bit */ | |||
| #define ETH_DMARXNDESCWBF_CTXT ((uint32_t)0x40000000) /*!< Receive Context Descriptor */ | |||
| #define ETH_DMARXNDESCWBF_FD ((uint32_t)0x20000000) /*!< First Descriptor */ | |||
| #define ETH_DMARXNDESCWBF_LD ((uint32_t)0x10000000) /*!< Last Descriptor */ | |||
| #define ETH_DMARXNDESCWBF_RS2V ((uint32_t)0x08000000) /*!< Receive Status RDES2 Valid */ | |||
| #define ETH_DMARXNDESCWBF_RS1V ((uint32_t)0x04000000) /*!< Receive Status RDES1 Valid */ | |||
| #define ETH_DMARXNDESCWBF_RS0V ((uint32_t)0x02000000) /*!< Receive Status RDES0 Valid */ | |||
| #define ETH_DMARXNDESCWBF_CE ((uint32_t)0x01000000) /*!< CRC Error */ | |||
| #define ETH_DMARXNDESCWBF_GP ((uint32_t)0x00800000) /*!< Giant Packet */ | |||
| #define ETH_DMARXNDESCWBF_RWT ((uint32_t)0x00400000) /*!< Receive Watchdog Timeout */ | |||
| #define ETH_DMARXNDESCWBF_OE ((uint32_t)0x00200000) /*!< Overflow Error */ | |||
| #define ETH_DMARXNDESCWBF_RE ((uint32_t)0x00100000) /*!< Receive Error */ | |||
| #define ETH_DMARXNDESCWBF_DE ((uint32_t)0x00080000) /*!< Dribble Bit Error */ | |||
| #define ETH_DMARXNDESCWBF_LT ((uint32_t)0x00070000) /*!< Length/Type Field */ | |||
| #define ETH_DMARXNDESCWBF_LT_LP ((uint32_t)0x00000000) /*!< The packet is a length packet */ | |||
| #define ETH_DMARXNDESCWBF_LT_TP ((uint32_t)0x00010000) /*!< The packet is a type packet */ | |||
| #define ETH_DMARXNDESCWBF_LT_ARP ((uint32_t)0x00030000) /*!< The packet is a ARP Request packet type */ | |||
| #define ETH_DMARXNDESCWBF_LT_VLAN ((uint32_t)0x00040000) /*!< The packet is a type packet with VLAN Tag */ | |||
| #define ETH_DMARXNDESCWBF_LT_DVLAN ((uint32_t)0x00050000) /*!< The packet is a type packet with Double VLAN Tag */ | |||
| #define ETH_DMARXNDESCWBF_LT_MAC ((uint32_t)0x00060000) /*!< The packet is a MAC Control packet type */ | |||
| #define ETH_DMARXNDESCWBF_LT_OAM ((uint32_t)0x00070000) /*!< The packet is a OAM packet type */ | |||
| #define ETH_DMARXNDESCWBF_ES ((uint32_t)0x00008000) /*!< Error Summary */ | |||
| #define ETH_DMARXNDESCWBF_PL ((uint32_t)0x00007FFF) /*!< Packet Length */ | |||
| #define ETH_DMARXNDESCWBF_OWN ((uint32_t)0x80000000U) /*!< Own Bit */ | |||
| #define ETH_DMARXNDESCWBF_CTXT ((uint32_t)0x40000000U) /*!< Receive Context Descriptor */ | |||
| #define ETH_DMARXNDESCWBF_FD ((uint32_t)0x20000000U) /*!< First Descriptor */ | |||
| #define ETH_DMARXNDESCWBF_LD ((uint32_t)0x10000000U) /*!< Last Descriptor */ | |||
| #define ETH_DMARXNDESCWBF_RS2V ((uint32_t)0x08000000U) /*!< Receive Status RDES2 Valid */ | |||
| #define ETH_DMARXNDESCWBF_RS1V ((uint32_t)0x04000000U) /*!< Receive Status RDES1 Valid */ | |||
| #define ETH_DMARXNDESCWBF_RS0V ((uint32_t)0x02000000U) /*!< Receive Status RDES0 Valid */ | |||
| #define ETH_DMARXNDESCWBF_CE ((uint32_t)0x01000000U) /*!< CRC Error */ | |||
| #define ETH_DMARXNDESCWBF_GP ((uint32_t)0x00800000U) /*!< Giant Packet */ | |||
| #define ETH_DMARXNDESCWBF_RWT ((uint32_t)0x00400000U) /*!< Receive Watchdog Timeout */ | |||
| #define ETH_DMARXNDESCWBF_OE ((uint32_t)0x00200000U) /*!< Overflow Error */ | |||
| #define ETH_DMARXNDESCWBF_RE ((uint32_t)0x00100000U) /*!< Receive Error */ | |||
| #define ETH_DMARXNDESCWBF_DE ((uint32_t)0x00080000U) /*!< Dribble Bit Error */ | |||
| #define ETH_DMARXNDESCWBF_LT ((uint32_t)0x00070000U) /*!< Length/Type Field */ | |||
| #define ETH_DMARXNDESCWBF_LT_LP ((uint32_t)0x00000000U) /*!< The packet is a length packet */ | |||
| #define ETH_DMARXNDESCWBF_LT_TP ((uint32_t)0x00010000U) /*!< The packet is a type packet */ | |||
| #define ETH_DMARXNDESCWBF_LT_ARP ((uint32_t)0x00030000U) /*!< The packet is a ARP Request packet type */ | |||
| #define ETH_DMARXNDESCWBF_LT_VLAN ((uint32_t)0x00040000U) /*!< The packet is a type packet with VLAN Tag */ | |||
| #define ETH_DMARXNDESCWBF_LT_DVLAN ((uint32_t)0x00050000U) /*!< The packet is a type packet with Double VLAN Tag */ | |||
| #define ETH_DMARXNDESCWBF_LT_MAC ((uint32_t)0x00060000U) /*!< The packet is a MAC Control packet type */ | |||
| #define ETH_DMARXNDESCWBF_LT_OAM ((uint32_t)0x00070000U) /*!< The packet is a OAM packet type */ | |||
| #define ETH_DMARXNDESCWBF_ES ((uint32_t)0x00008000U) /*!< Error Summary */ | |||
| #define ETH_DMARXNDESCWBF_PL ((uint32_t)0x00007FFFU) /*!< Packet Length */ | |||
| /* | |||
| DMA Rx context Descriptor | |||
| @@ -832,18 +848,18 @@ typedef struct{ | |||
| /** | |||
| * @brief Bit definition of Rx context descriptor register 0 | |||
| */ | |||
| #define ETH_DMARXCDESC_RTSL ((uint32_t)0xFFFFFFFF) /*!< Receive Packet Timestamp Low */ | |||
| #define ETH_DMARXCDESC_RTSL ((uint32_t)0xFFFFFFFFU) /*!< Receive Packet Timestamp Low */ | |||
| /** | |||
| * @brief Bit definition of Rx context descriptor register 1 | |||
| */ | |||
| #define ETH_DMARXCDESC_RTSH ((uint32_t)0xFFFFFFFF) /*!< Receive Packet Timestamp High */ | |||
| #define ETH_DMARXCDESC_RTSH ((uint32_t)0xFFFFFFFFU) /*!< Receive Packet Timestamp High */ | |||
| /** | |||
| * @brief Bit definition of Rx context descriptor register 3 | |||
| */ | |||
| #define ETH_DMARXCDESC_OWN ((uint32_t)0x80000000) /*!< Own Bit */ | |||
| #define ETH_DMARXCDESC_CTXT ((uint32_t)0x40000000) /*!< Receive Context Descriptor */ | |||
| #define ETH_DMARXCDESC_OWN ((uint32_t)0x80000000U) /*!< Own Bit */ | |||
| #define ETH_DMARXCDESC_CTXT ((uint32_t)0x40000000U) /*!< Receive Context Descriptor */ | |||
| /** | |||
| * @} | |||
| @@ -852,13 +868,13 @@ typedef struct{ | |||
| /** @defgroup ETH_Frame_settings ETH frame settings | |||
| * @{ | |||
| */ | |||
| #define ETH_MAX_PACKET_SIZE ((uint32_t)1528) /*!< ETH_HEADER + 2*VLAN_TAG + MAX_ETH_PAYLOAD + ETH_CRC */ | |||
| #define ETH_HEADER ((uint32_t)14) /*!< 6 byte Dest addr, 6 byte Src addr, 2 byte length/type */ | |||
| #define ETH_CRC ((uint32_t)4) /*!< Ethernet CRC */ | |||
| #define ETH_VLAN_TAG ((uint32_t)4) /*!< optional 802.1q VLAN Tag */ | |||
| #define ETH_MIN_PAYLOAD ((uint32_t)46) /*!< Minimum Ethernet payload size */ | |||
| #define ETH_MAX_PAYLOAD ((uint32_t)1500) /*!< Maximum Ethernet payload size */ | |||
| #define ETH_JUMBO_FRAME_PAYLOAD ((uint32_t)9000) /*!< Jumbo frame payload size */ | |||
| #define ETH_MAX_PACKET_SIZE ((uint32_t)1528U) /*!< ETH_HEADER + 2*VLAN_TAG + MAX_ETH_PAYLOAD + ETH_CRC */ | |||
| #define ETH_HEADER ((uint32_t)14U) /*!< 6 byte Dest addr, 6 byte Src addr, 2 byte length/type */ | |||
| #define ETH_CRC ((uint32_t)4U) /*!< Ethernet CRC */ | |||
| #define ETH_VLAN_TAG ((uint32_t)4U) /*!< optional 802.1q VLAN Tag */ | |||
| #define ETH_MIN_PAYLOAD ((uint32_t)46U) /*!< Minimum Ethernet payload size */ | |||
| #define ETH_MAX_PAYLOAD ((uint32_t)1500U) /*!< Maximum Ethernet payload size */ | |||
| #define ETH_JUMBO_FRAME_PAYLOAD ((uint32_t)9000U) /*!< Jumbo frame payload size */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -872,6 +888,9 @@ typedef struct{ | |||
| #define HAL_ETH_ERROR_TIMEOUT ((uint32_t)0x00000004U) /*!< Timeout error */ | |||
| #define HAL_ETH_ERROR_DMA ((uint32_t)0x00000008U) /*!< DMA transfer error */ | |||
| #define HAL_ETH_ERROR_MAC ((uint32_t)0x00000010U) /*!< MAC transfer error */ | |||
| #if (USE_HAL_ETH_REGISTER_CALLBACKS == 1) | |||
| #define HAL_ETH_ERROR_INVALID_CALLBACK ((uint32_t)0x00000020U) /*!< Invalid Callback error */ | |||
| #endif /* USE_HAL_ETH_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -879,12 +898,12 @@ typedef struct{ | |||
| /** @defgroup ETH_Tx_Packet_Attributes ETH Tx Packet Attributes | |||
| * @{ | |||
| */ | |||
| #define ETH_TX_PACKETS_FEATURES_CSUM ((uint32_t)0x00000001) | |||
| #define ETH_TX_PACKETS_FEATURES_SAIC ((uint32_t)0x00000002) | |||
| #define ETH_TX_PACKETS_FEATURES_VLANTAG ((uint32_t)0x00000004) | |||
| #define ETH_TX_PACKETS_FEATURES_INNERVLANTAG ((uint32_t)0x00000008) | |||
| #define ETH_TX_PACKETS_FEATURES_TSO ((uint32_t)0x00000010) | |||
| #define ETH_TX_PACKETS_FEATURES_CRCPAD ((uint32_t)0x00000020) | |||
| #define ETH_TX_PACKETS_FEATURES_CSUM ((uint32_t)0x00000001U) | |||
| #define ETH_TX_PACKETS_FEATURES_SAIC ((uint32_t)0x00000002U) | |||
| #define ETH_TX_PACKETS_FEATURES_VLANTAG ((uint32_t)0x00000004U) | |||
| #define ETH_TX_PACKETS_FEATURES_INNERVLANTAG ((uint32_t)0x00000008U) | |||
| #define ETH_TX_PACKETS_FEATURES_TSO ((uint32_t)0x00000010U) | |||
| #define ETH_TX_PACKETS_FEATURES_CRCPAD ((uint32_t)0x00000020U) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -1019,7 +1038,7 @@ typedef struct{ | |||
| * @{ | |||
| */ | |||
| #define ETH_DMAARBITRATION_RX ETH_DMAMR_DA | |||
| #define ETH_DMAARBITRATION_RX1_TX1 ((uint32_t)0x00000000) | |||
| #define ETH_DMAARBITRATION_RX1_TX1 ((uint32_t)0x00000000U) | |||
| #define ETH_DMAARBITRATION_RX2_TX1 ETH_DMAMR_PR_2_1 | |||
| #define ETH_DMAARBITRATION_RX3_TX1 ETH_DMAMR_PR_3_1 | |||
| #define ETH_DMAARBITRATION_RX4_TX1 ETH_DMAMR_PR_4_1 | |||
| @@ -1028,7 +1047,7 @@ typedef struct{ | |||
| #define ETH_DMAARBITRATION_RX7_TX1 ETH_DMAMR_PR_7_1 | |||
| #define ETH_DMAARBITRATION_RX8_TX1 ETH_DMAMR_PR_8_1 | |||
| #define ETH_DMAARBITRATION_TX (ETH_DMAMR_TXPR | ETH_DMAMR_DA) | |||
| #define ETH_DMAARBITRATION_TX1_RX1 ((uint32_t)0x00000000) | |||
| #define ETH_DMAARBITRATION_TX1_RX1 ((uint32_t)0x00000000U) | |||
| #define ETH_DMAARBITRATION_TX2_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_2_1) | |||
| #define ETH_DMAARBITRATION_TX3_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_3_1) | |||
| #define ETH_DMAARBITRATION_TX4_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_4_1) | |||
| @@ -1045,7 +1064,7 @@ typedef struct{ | |||
| */ | |||
| #define ETH_BURSTLENGTH_FIXED ETH_DMASBMR_FB | |||
| #define ETH_BURSTLENGTH_MIXED ETH_DMASBMR_MB | |||
| #define ETH_BURSTLENGTH_UNSPECIFIED ((uint32_t)0x00000000) | |||
| #define ETH_BURSTLENGTH_UNSPECIFIED ((uint32_t)0x00000000U) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -1201,7 +1220,7 @@ typedef struct{ | |||
| /** @defgroup ETH_Speed ETH Speed | |||
| * @{ | |||
| */ | |||
| #define ETH_SPEED_10M ((uint32_t)0x00000000) | |||
| #define ETH_SPEED_10M ((uint32_t)0x00000000U) | |||
| #define ETH_SPEED_100M ETH_MACCR_FES | |||
| /** | |||
| * @} | |||
| @@ -1211,7 +1230,7 @@ typedef struct{ | |||
| * @{ | |||
| */ | |||
| #define ETH_FULLDUPLEX_MODE ETH_MACCR_DM | |||
| #define ETH_HALFDUPLEX_MODE ((uint32_t)0x00000000) | |||
| #define ETH_HALFDUPLEX_MODE ((uint32_t)0x00000000U) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -1240,7 +1259,7 @@ typedef struct{ | |||
| /** @defgroup ETH_Source_Addr_Control ETH Source Addr Control | |||
| * @{ | |||
| */ | |||
| #define ETH_SOURCEADDRESS_DISABLE ((uint32_t)0x00000000) | |||
| #define ETH_SOURCEADDRESS_DISABLE ((uint32_t)0x00000000U) | |||
| #define ETH_SOURCEADDRESS_INSERT_ADDR0 ETH_MACCR_SARC_INSADDR0 | |||
| #define ETH_SOURCEADDRESS_INSERT_ADDR1 ETH_MACCR_SARC_INSADDR1 | |||
| #define ETH_SOURCEADDRESS_REPLACE_ADDR0 ETH_MACCR_SARC_REPADDR0 | |||
| @@ -1316,6 +1335,18 @@ typedef struct{ | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_ETH_StateTypeDef ETH States | |||
| * @{ | |||
| */ | |||
| #define HAL_ETH_STATE_RESET ((uint32_t)0x00000000U) /*!< Peripheral not yet Initialized or disabled */ | |||
| #define HAL_ETH_STATE_READY ((uint32_t)0x00000010U) /*!< Peripheral Communication started */ | |||
| #define HAL_ETH_STATE_BUSY ((uint32_t)0x00000023U) /*!< an internal process is ongoing */ | |||
| #define HAL_ETH_STATE_BUSY_TX ((uint32_t)0x00000021U) /*!< Transmission process is ongoing */ | |||
| #define HAL_ETH_STATE_BUSY_RX ((uint32_t)0x00000022U) /*!< Reception process is ongoing */ | |||
| #define HAL_ETH_STATE_ERROR ((uint32_t)0x000000E0U) /*!< Error State */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -1329,7 +1360,19 @@ typedef struct{ | |||
| * @param __HANDLE__: specifies the ETH handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_ETH_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_ETH_STATE_RESET) | |||
| #if (USE_HAL_ETH_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_ETH_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->gState = HAL_ETH_STATE_RESET; \ | |||
| (__HANDLE__)->RxState = HAL_ETH_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_ETH_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->gState = HAL_ETH_STATE_RESET; \ | |||
| (__HANDLE__)->RxState = HAL_ETH_STATE_RESET; \ | |||
| } while(0) | |||
| #endif /*USE_HAL_ETH_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @brief Enables the specified ETHERNET DMA interrupts. | |||
| @@ -1416,7 +1459,7 @@ typedef struct{ | |||
| #define __HAL_ETH_MAC_GET_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->MACISR &( __INTERRUPT__)) == ( __INTERRUPT__)) | |||
| /*!< External interrupt line 86 Connected to the ETH wakeup EXTI Line */ | |||
| #define ETH_WAKEUP_EXTI_LINE ((uint32_t)0x00400000) /* !< 86 - 64 = 22 */ | |||
| #define ETH_WAKEUP_EXTI_LINE ((uint32_t)0x00400000U) /* !< 86 - 64 = 22 */ | |||
| /** | |||
| * @brief Enable the ETH WAKEUP Exti Line. | |||
| @@ -1442,6 +1485,31 @@ typedef struct{ | |||
| */ | |||
| #define __HAL_ETH_WAKEUP_EXTI_CLEAR_FLAG(__EXTI_LINE__) (EXTI_D1->PR3 = (__EXTI_LINE__)) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Enable the ETH WAKEUP Exti Line by Core2. | |||
| * @param __EXTI_LINE__: specifies the ETH WAKEUP Exti sources to be enabled. | |||
| * @arg ETH_WAKEUP_EXTI_LINE | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_ETH_WAKEUP_EXTID2_ENABLE_IT(__EXTI_LINE__) (EXTI_D2->IMR3 |= (__EXTI_LINE__)) | |||
| /** | |||
| * @brief checks whether the specified ETH WAKEUP Exti interrupt flag is set or not. | |||
| * @param __EXTI_LINE__: specifies the ETH WAKEUP Exti sources to be cleared. | |||
| * @arg ETH_WAKEUP_EXTI_LINE | |||
| * @retval EXTI ETH WAKEUP Line Status. | |||
| */ | |||
| #define __HAL_ETH_WAKEUP_EXTID2_GET_FLAG(__EXTI_LINE__) (EXTI_D2->PR3 & (__EXTI_LINE__)) | |||
| /** | |||
| * @brief Clear the ETH WAKEUP Exti flag. | |||
| * @param __EXTI_LINE__: specifies the ETH WAKEUP Exti sources to be cleared. | |||
| * @arg ETH_WAKEUP_EXTI_LINE | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_ETH_WAKEUP_EXTID2_CLEAR_FLAG(__EXTI_LINE__) (EXTI_D2->PR3 = (__EXTI_LINE__)) | |||
| #endif | |||
| /** | |||
| * @brief enable rising edge interrupt on selected EXTI line. | |||
| @@ -1500,6 +1568,13 @@ HAL_StatusTypeDef HAL_ETH_DeInit(ETH_HandleTypeDef *heth); | |||
| void HAL_ETH_MspInit(ETH_HandleTypeDef *heth); | |||
| void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth); | |||
| HAL_StatusTypeDef HAL_ETH_DescAssignMemory(ETH_HandleTypeDef *heth, uint32_t Index, uint8_t *pBuffer1,uint8_t *pBuffer2); | |||
| /* Callbacks Register/UnRegister functions ***********************************/ | |||
| #if (USE_HAL_ETH_REGISTER_CALLBACKS == 1) | |||
| HAL_StatusTypeDef HAL_ETH_RegisterCallback(ETH_HandleTypeDef *heth, HAL_ETH_CallbackIDTypeDef CallbackID, pETH_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_ETH_UnRegisterCallback(ETH_HandleTypeDef *heth, HAL_ETH_CallbackIDTypeDef CallbackID); | |||
| #endif /* USE_HAL_ETH_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -1514,7 +1589,7 @@ HAL_StatusTypeDef HAL_ETH_Stop(ETH_HandleTypeDef *heth); | |||
| HAL_StatusTypeDef HAL_ETH_Stop_IT(ETH_HandleTypeDef *heth); | |||
| uint8_t HAL_ETH_IsRxDataAvailable(ETH_HandleTypeDef *heth); | |||
| HAL_StatusTypeDef HAL_ETH_GetRxDataBuffer(ETH_HandleTypeDef *heth, ETH_BufferTypeDef *pBuffer); | |||
| HAL_StatusTypeDef HAL_ETH_GetRxDataBuffer(ETH_HandleTypeDef *heth, ETH_BufferTypeDef *RxBuffer); | |||
| HAL_StatusTypeDef HAL_ETH_GetRxDataLength(ETH_HandleTypeDef *heth, uint32_t *Length); | |||
| HAL_StatusTypeDef HAL_ETH_GetRxDataInfo(ETH_HandleTypeDef *heth, ETH_RxPacketInfo *RxPacketInfo); | |||
| HAL_StatusTypeDef HAL_ETH_BuildRxDescriptors(ETH_HandleTypeDef *heth); | |||
| @@ -2,35 +2,17 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_eth_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of ETH HAL Extended module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| @@ -0,0 +1,457 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_exti.h | |||
| * @author MCD Application Team | |||
| * @brief Header file of EXTI HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</center></h2> | |||
| * | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef STM32H7xx_HAL_EXTI_H | |||
| #define STM32H7xx_HAL_EXTI_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_hal_def.h" | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @defgroup EXTI EXTI | |||
| * @brief EXTI HAL module driver | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup EXTI_Exported_Types EXTI Exported Types | |||
| * @{ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_EXTI_COMMON_CB_ID = 0x00U, | |||
| } EXTI_CallbackIDTypeDef; | |||
| /** | |||
| * @brief EXTI Handle structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t Line; /*!< Exti line number */ | |||
| void (* PendingCallback)(void); /*!< Exti pending callback */ | |||
| } EXTI_HandleTypeDef; | |||
| /** | |||
| * @brief EXTI Configuration structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t Line; /*!< The Exti line to be configured. This parameter | |||
| can be a value of @ref EXTI_Line */ | |||
| uint32_t Mode; /*!< The Exit Mode to be configured for a core. | |||
| This parameter can be a combination of @ref EXTI_Mode */ | |||
| uint32_t Trigger; /*!< The Exti Trigger to be configured. This parameter | |||
| can be a value of @ref EXTI_Trigger */ | |||
| uint32_t GPIOSel; /*!< The Exti GPIO multiplexer selection to be configured. | |||
| This parameter is only possible for line 0 to 15. It | |||
| can be a value of @ref EXTI_GPIOSel */ | |||
| uint32_t PendClearSource; /*!< Specifies the event pending clear source for D3/SRD | |||
| domain. This parameter can be a value of @ref | |||
| EXTI_PendClear_Source */ | |||
| } EXTI_ConfigTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup EXTI_Exported_Constants EXTI Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup EXTI_Line EXTI Line | |||
| * @{ | |||
| */ | |||
| #define EXTI_LINE_0 (EXTI_GPIO | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x00U) | |||
| #define EXTI_LINE_1 (EXTI_GPIO | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x01U) | |||
| #define EXTI_LINE_2 (EXTI_GPIO | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x02U) | |||
| #define EXTI_LINE_3 (EXTI_GPIO | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x03U) | |||
| #define EXTI_LINE_4 (EXTI_GPIO | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x04U) | |||
| #define EXTI_LINE_5 (EXTI_GPIO | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x05U) | |||
| #define EXTI_LINE_6 (EXTI_GPIO | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x06U) | |||
| #define EXTI_LINE_7 (EXTI_GPIO | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x07U) | |||
| #define EXTI_LINE_8 (EXTI_GPIO | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x08U) | |||
| #define EXTI_LINE_9 (EXTI_GPIO | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x09U) | |||
| #define EXTI_LINE_10 (EXTI_GPIO | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x0AU) | |||
| #define EXTI_LINE_11 (EXTI_GPIO | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x0BU) | |||
| #define EXTI_LINE_12 (EXTI_GPIO | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x0CU) | |||
| #define EXTI_LINE_13 (EXTI_GPIO | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x0DU) | |||
| #define EXTI_LINE_14 (EXTI_GPIO | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x0EU) | |||
| #define EXTI_LINE_15 (EXTI_GPIO | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x0FU) | |||
| #define EXTI_LINE_16 (EXTI_CONFIG | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL_CPU | 0x10U) | |||
| #define EXTI_LINE_17 (EXTI_CONFIG | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL_CPU | 0x11U) | |||
| #define EXTI_LINE_18 (EXTI_CONFIG | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL_CPU | 0x12U) | |||
| #define EXTI_LINE_19 (EXTI_CONFIG | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x13U) | |||
| #define EXTI_LINE_20 (EXTI_CONFIG | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x14U) | |||
| #define EXTI_LINE_21 (EXTI_CONFIG | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x15U) | |||
| #define EXTI_LINE_22 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL_CPU | 0x16U) | |||
| #define EXTI_LINE_23 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL_CPU | 0x17U) | |||
| #define EXTI_LINE_24 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL_CPU | 0x18U) | |||
| #define EXTI_LINE_25 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL | 0x19U) | |||
| #define EXTI_LINE_26 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL_CPU | 0x1AU) | |||
| #define EXTI_LINE_27 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL_CPU | 0x1BU) | |||
| #define EXTI_LINE_28 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL_CPU | 0x1CU) | |||
| #define EXTI_LINE_29 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL_CPU | 0x1DU) | |||
| #define EXTI_LINE_30 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL_CPU | 0x1EU) | |||
| #define EXTI_LINE_31 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG1 | EXTI_TARGET_MSK_ALL_CPU | 0x1FU) | |||
| #define EXTI_LINE_32 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x00U) | |||
| #define EXTI_LINE_33 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x01U) | |||
| #define EXTI_LINE_34 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL | 0x02U) | |||
| #define EXTI_LINE_35 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL | 0x03U) | |||
| #define EXTI_LINE_36 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x04U) | |||
| #define EXTI_LINE_37 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x05U) | |||
| #define EXTI_LINE_38 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x06U) | |||
| #define EXTI_LINE_39 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x07U) | |||
| #define EXTI_LINE_40 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x08U) | |||
| #define EXTI_LINE_41 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL | 0x09U) | |||
| #define EXTI_LINE_42 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x0AU) | |||
| #define EXTI_LINE_43 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x0BU) | |||
| #define EXTI_LINE_44 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x0CU) | |||
| #define EXTI_LINE_45 (EXTI_RESERVED | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_NONE | 0x0DU) | |||
| #define EXTI_LINE_46 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x0EU) | |||
| #define EXTI_LINE_47 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x0FU) | |||
| #define EXTI_LINE_48 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL | 0x10U) | |||
| #define EXTI_LINE_49 (EXTI_CONFIG | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL | 0x11U) | |||
| #define EXTI_LINE_50 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL | 0x12U) | |||
| #define EXTI_LINE_51 (EXTI_CONFIG | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL | 0x13U) | |||
| #define EXTI_LINE_52 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL | 0x14U) | |||
| #define EXTI_LINE_53 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL | 0x15U) | |||
| #define EXTI_LINE_54 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x16U) | |||
| #define EXTI_LINE_55 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x17U) | |||
| #define EXTI_LINE_56 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x18U) | |||
| #define EXTI_LINE_57 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x19U) | |||
| #define EXTI_LINE_58 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x1AU) | |||
| #define EXTI_LINE_59 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x1BU) | |||
| #define EXTI_LINE_60 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x1CU) | |||
| #define EXTI_LINE_61 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x1DU) | |||
| #define EXTI_LINE_62 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x1EU) | |||
| #define EXTI_LINE_63 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG2 | EXTI_TARGET_MSK_ALL_CPU | 0x1FU) | |||
| #define EXTI_LINE_64 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_ALL_CPU | 0x00U) | |||
| #define EXTI_LINE_65 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_ALL_CPU | 0x01U) | |||
| #define EXTI_LINE_66 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_ALL_CPU | 0x02U) | |||
| #define EXTI_LINE_67 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_ALL_CPU | 0x03U) | |||
| #define EXTI_LINE_68 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_ALL_CPU | 0x04U) | |||
| #define EXTI_LINE_69 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_ALL_CPU | 0x05U) | |||
| #define EXTI_LINE_70 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_ALL_CPU | 0x06U) | |||
| #define EXTI_LINE_71 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_ALL_CPU | 0x07U) | |||
| #define EXTI_LINE_72 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_ALL_CPU | 0x08U) | |||
| #define EXTI_LINE_73 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_ALL_CPU | 0x09U) | |||
| #define EXTI_LINE_74 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_ALL_CPU | 0x0AU) | |||
| #define EXTI_LINE_75 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_ALL_CPU | 0x0BU) | |||
| #define EXTI_LINE_76 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_ALL_CPU | 0x0CU) | |||
| #define EXTI_LINE_77 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_CPU1| 0x0DU) | |||
| #if defined (DUAL_CORE) | |||
| #define EXTI_LINE_78 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_CPU2| 0x0EU) | |||
| #else | |||
| #define EXTI_LINE_78 (EXTI_RESERVED | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_NONE| 0x0EU) | |||
| #endif /* DUAL_CORE */ | |||
| #define EXTI_LINE_79 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_CPU1| 0x0FU) | |||
| #if defined (DUAL_CORE) | |||
| #define EXTI_LINE_80 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_CPU2| 0x10U) | |||
| #else | |||
| #define EXTI_LINE_80 (EXTI_RESERVED | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_NONE| 0x10U) | |||
| #endif /* DUAL_CORE */ | |||
| #define EXTI_LINE_81 (EXTI_RESERVED | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_NONE| 0x11U) | |||
| #if defined (DUAL_CORE) | |||
| #define EXTI_LINE_82 (EXTI_CONFIG | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_CPU2| 0x12U) | |||
| #else | |||
| #define EXTI_LINE_82 (EXTI_RESERVED | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_NONE| 0x12U) | |||
| #endif /* DUAL_CORE */ | |||
| #define EXTI_LINE_83 (EXTI_RESERVED | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_NONE| 0x13U) | |||
| #define EXTI_LINE_84 (EXTI_CONFIG | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_CPU1| 0x14U) | |||
| #define EXTI_LINE_85 (EXTI_CONFIG | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_ALL_CPU | 0x15U) | |||
| #define EXTI_LINE_86 (EXTI_CONFIG | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_ALL_CPU | 0x16U) | |||
| #define EXTI_LINE_87 (EXTI_DIRECT | EXTI_EVENT | EXTI_REG3 | EXTI_TARGET_MSK_ALL_CPU | 0x17U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup EXTI_Mode EXTI Mode | |||
| * @{ | |||
| */ | |||
| #define EXTI_MODE_NONE 0x00000000U | |||
| #define EXTI_MODE_INTERRUPT 0x00000001U | |||
| #define EXTI_MODE_EVENT 0x00000002U | |||
| #if defined(DUAL_CORE) | |||
| #define EXTI_MODE_CORE1_INTERRUPT EXTI_MODE_INTERRUPT | |||
| #define EXTI_MODE_CORE1_EVENT EXTI_MODE_EVENT | |||
| #define EXTI_MODE_CORE2_INTERRUPT 0x00000010U | |||
| #define EXTI_MODE_CORE2_EVENT 0x00000020U | |||
| #endif /* DUAL_CORE */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup EXTI_Trigger EXTI Trigger | |||
| * @{ | |||
| */ | |||
| #define EXTI_TRIGGER_NONE 0x00000000U | |||
| #define EXTI_TRIGGER_RISING 0x00000001U | |||
| #define EXTI_TRIGGER_FALLING 0x00000002U | |||
| #define EXTI_TRIGGER_RISING_FALLING (EXTI_TRIGGER_RISING | EXTI_TRIGGER_FALLING) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup EXTI_GPIOSel EXTI GPIOSel | |||
| * @brief | |||
| * @{ | |||
| */ | |||
| #define EXTI_GPIOA 0x00000000U | |||
| #define EXTI_GPIOB 0x00000001U | |||
| #define EXTI_GPIOC 0x00000002U | |||
| #define EXTI_GPIOD 0x00000003U | |||
| #define EXTI_GPIOE 0x00000004U | |||
| #define EXTI_GPIOF 0x00000005U | |||
| #define EXTI_GPIOG 0x00000006U | |||
| #define EXTI_GPIOH 0x00000007U | |||
| #define EXTI_GPIOI 0x00000008U | |||
| #define EXTI_GPIOJ 0x00000009U | |||
| #define EXTI_GPIOK 0x0000000AU | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup EXTI_PendClear_Source EXTI PendClear Source | |||
| * @brief | |||
| * @{ | |||
| */ | |||
| #define EXTI_D3_PENDCLR_SRC_NONE 0x00000000U /*!< No D3 domain pendclear source , PMRx register to be set to zero */ | |||
| #define EXTI_D3_PENDCLR_SRC_DMACH6 0x00000001U /*!< DMA ch6 event selected as D3 domain pendclear source, PMRx register to be set to 1 */ | |||
| #define EXTI_D3_PENDCLR_SRC_DMACH7 0x00000002U /*!< DMA ch7 event selected as D3 domain pendclear source, PMRx register to be set to 1*/ | |||
| #define EXTI_D3_PENDCLR_SRC_LPTIM4 0x00000003U /*!< LPTIM4 out selected as D3 domain pendclear source, PMRx register to be set to 1 */ | |||
| #define EXTI_D3_PENDCLR_SRC_LPTIM5 0x00000004U /*!< LPTIM4 out selected as D3 domain pendclear source, PMRx register to be set to 1 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup EXTI_Exported_Macros EXTI Exported Macros | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private constants --------------------------------------------------------*/ | |||
| /** @defgroup EXTI_Private_Constants EXTI Private Constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief EXTI Line property definition | |||
| */ | |||
| #define EXTI_PROPERTY_SHIFT 24U | |||
| #define EXTI_DIRECT (0x01UL << EXTI_PROPERTY_SHIFT) | |||
| #define EXTI_CONFIG (0x02UL << EXTI_PROPERTY_SHIFT) | |||
| #define EXTI_GPIO ((0x04UL << EXTI_PROPERTY_SHIFT) | EXTI_CONFIG) | |||
| #define EXTI_RESERVED (0x08UL << EXTI_PROPERTY_SHIFT) | |||
| #define EXTI_PROPERTY_MASK (EXTI_DIRECT | EXTI_CONFIG | EXTI_GPIO) | |||
| /** | |||
| * @brief EXTI Event presence definition | |||
| */ | |||
| #define EXTI_EVENT_PRESENCE_SHIFT 28U | |||
| #define EXTI_EVENT (0x01UL << EXTI_EVENT_PRESENCE_SHIFT) | |||
| #define EXTI_EVENT_PRESENCE_MASK (EXTI_EVENT) | |||
| /** | |||
| * @brief EXTI Register and bit usage | |||
| */ | |||
| #define EXTI_REG_SHIFT 16U | |||
| #define EXTI_REG1 (0x00UL << EXTI_REG_SHIFT) | |||
| #define EXTI_REG2 (0x01UL << EXTI_REG_SHIFT) | |||
| #define EXTI_REG3 (0x02UL << EXTI_REG_SHIFT) | |||
| #define EXTI_REG_MASK (EXTI_REG1 | EXTI_REG2 | EXTI_REG3) | |||
| #define EXTI_PIN_MASK 0x0000001FUL | |||
| /** | |||
| * @brief EXTI Target and bit usage | |||
| */ | |||
| #define EXTI_TARGET_SHIFT 20U | |||
| #define EXTI_TARGET_MSK_NONE (0x00UL << EXTI_TARGET_SHIFT) | |||
| #define EXTI_TARGET_MSK_D3SRD (0x01UL << EXTI_TARGET_SHIFT) | |||
| #define EXTI_TARGET_MSK_CPU1 (0x02UL << EXTI_TARGET_SHIFT) | |||
| #if defined (DUAL_CORE) | |||
| #define EXTI_TARGET_MSK_CPU2 (0x04UL << EXTI_TARGET_SHIFT) | |||
| #define EXTI_TARGET_MASK (EXTI_TARGET_MSK_D3SRD | EXTI_TARGET_MSK_CPU1 | EXTI_TARGET_MSK_CPU2) | |||
| #define EXTI_TARGET_MSK_ALL_CPU (EXTI_TARGET_MSK_CPU1 | EXTI_TARGET_MSK_CPU2) | |||
| #else | |||
| #define EXTI_TARGET_MASK (EXTI_TARGET_MSK_D3SRD | EXTI_TARGET_MSK_CPU1) | |||
| #define EXTI_TARGET_MSK_ALL_CPU EXTI_TARGET_MSK_CPU1 | |||
| #endif /* DUAL_CORE */ | |||
| #define EXTI_TARGET_MSK_ALL EXTI_TARGET_MASK | |||
| /** | |||
| * @brief EXTI Mask for interrupt & event mode | |||
| */ | |||
| #if defined (DUAL_CORE) | |||
| #define EXTI_MODE_MASK (EXTI_MODE_CORE1_EVENT | EXTI_MODE_CORE1_INTERRUPT | EXTI_MODE_CORE2_INTERRUPT | EXTI_MODE_CORE2_EVENT) | |||
| #else | |||
| #define EXTI_MODE_MASK (EXTI_MODE_EVENT | EXTI_MODE_INTERRUPT) | |||
| #endif /* DUAL_CORE */ | |||
| /** | |||
| * @brief EXTI Mask for trigger possibilities | |||
| */ | |||
| #define EXTI_TRIGGER_MASK (EXTI_TRIGGER_RISING | EXTI_TRIGGER_FALLING) | |||
| /** | |||
| * @brief EXTI Line number | |||
| */ | |||
| #define EXTI_LINE_NB 88UL | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup EXTI_Private_Macros EXTI Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_EXTI_PROPERTY(__LINE__) ((((__LINE__) & EXTI_PROPERTY_MASK) == EXTI_DIRECT) || \ | |||
| (((__LINE__) & EXTI_PROPERTY_MASK) == EXTI_CONFIG) || \ | |||
| (((__LINE__) & EXTI_PROPERTY_MASK) == EXTI_GPIO)) | |||
| #if defined (DUAL_CORE) | |||
| #define IS_EXTI_TARGET(__LINE__) ((((__LINE__) & EXTI_TARGET_MASK) == EXTI_TARGET_MSK_CPU1) || \ | |||
| (((__LINE__) & EXTI_TARGET_MASK) == EXTI_TARGET_MSK_CPU2) || \ | |||
| (((__LINE__) & EXTI_TARGET_MASK) == EXTI_TARGET_MSK_ALL_CPU) || \ | |||
| (((__LINE__) & EXTI_TARGET_MASK) == EXTI_TARGET_MSK_ALL)) | |||
| #else | |||
| #define IS_EXTI_TARGET(__LINE__) ((((__LINE__) & EXTI_TARGET_MASK) == EXTI_TARGET_MSK_CPU1) || \ | |||
| (((__LINE__) & EXTI_TARGET_MASK) == EXTI_TARGET_MSK_ALL)) | |||
| #endif | |||
| #define IS_EXTI_LINE(__LINE__) ((((__LINE__) & ~(EXTI_PROPERTY_MASK | EXTI_EVENT_PRESENCE_MASK | EXTI_REG_MASK | EXTI_PIN_MASK | EXTI_TARGET_MASK)) == 0x00UL) && \ | |||
| IS_EXTI_PROPERTY(__LINE__) && IS_EXTI_TARGET(__LINE__) && \ | |||
| (((__LINE__) & (EXTI_REG_MASK | EXTI_PIN_MASK)) < \ | |||
| (((EXTI_LINE_NB / 32UL) << EXTI_REG_SHIFT) | (EXTI_LINE_NB % 32UL)))) | |||
| #define IS_EXTI_MODE(__MODE__) (((__MODE__) & ~EXTI_MODE_MASK) == 0x00UL) | |||
| #define IS_EXTI_TRIGGER(__LINE__) (((__LINE__) & ~EXTI_TRIGGER_MASK) == 0x00UL) | |||
| #define IS_EXTI_PENDING_EDGE(__LINE__) (((__LINE__) == EXTI_TRIGGER_RISING) || \ | |||
| ((__LINE__) == EXTI_TRIGGER_FALLING)|| \ | |||
| ((__LINE__) == EXTI_TRIGGER_RISING_FALLING)) | |||
| #define IS_EXTI_CONFIG_LINE(__LINE__) (((__LINE__) & EXTI_CONFIG) != 0x00UL) | |||
| #define IS_EXTI_GPIO_PORT(__PORT__) (((__PORT__) == EXTI_GPIOA) || \ | |||
| ((__PORT__) == EXTI_GPIOB) || \ | |||
| ((__PORT__) == EXTI_GPIOC) || \ | |||
| ((__PORT__) == EXTI_GPIOD) || \ | |||
| ((__PORT__) == EXTI_GPIOE) || \ | |||
| ((__PORT__) == EXTI_GPIOF) || \ | |||
| ((__PORT__) == EXTI_GPIOG) || \ | |||
| ((__PORT__) == EXTI_GPIOH) || \ | |||
| ((__PORT__) == EXTI_GPIOI) || \ | |||
| ((__PORT__) == EXTI_GPIOJ) || \ | |||
| ((__PORT__) == EXTI_GPIOK)) | |||
| #define IS_EXTI_GPIO_PIN(__PIN__) ((__PIN__) < 16UL) | |||
| #define IS_EXTI_D3_PENDCLR_SRC(__SRC__) (((__SRC__) == EXTI_D3_PENDCLR_SRC_NONE) || \ | |||
| ((__SRC__) == EXTI_D3_PENDCLR_SRC_DMACH6) || \ | |||
| ((__SRC__) == EXTI_D3_PENDCLR_SRC_DMACH7) || \ | |||
| ((__SRC__) == EXTI_D3_PENDCLR_SRC_LPTIM4) || \ | |||
| ((__SRC__) == EXTI_D3_PENDCLR_SRC_LPTIM5)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @defgroup EXTI_Exported_Functions EXTI Exported Functions | |||
| * @brief EXTI Exported Functions | |||
| * @{ | |||
| */ | |||
| /** @defgroup EXTI_Exported_Functions_Group1 Configuration functions | |||
| * @brief Configuration functions | |||
| * @{ | |||
| */ | |||
| /* Configuration functions ****************************************************/ | |||
| HAL_StatusTypeDef HAL_EXTI_SetConfigLine(EXTI_HandleTypeDef *hexti, EXTI_ConfigTypeDef *pExtiConfig); | |||
| HAL_StatusTypeDef HAL_EXTI_GetConfigLine(EXTI_HandleTypeDef *hexti, EXTI_ConfigTypeDef *pExtiConfig); | |||
| HAL_StatusTypeDef HAL_EXTI_ClearConfigLine(EXTI_HandleTypeDef *hexti); | |||
| HAL_StatusTypeDef HAL_EXTI_RegisterCallback(EXTI_HandleTypeDef *hexti, EXTI_CallbackIDTypeDef CallbackID, void (*pPendingCbfn)(void)); | |||
| HAL_StatusTypeDef HAL_EXTI_GetHandle(EXTI_HandleTypeDef *hexti, uint32_t ExtiLine); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup EXTI_Exported_Functions_Group2 IO operation functions | |||
| * @brief IO operation functions | |||
| * @{ | |||
| */ | |||
| /* IO operation functions *****************************************************/ | |||
| void HAL_EXTI_IRQHandler(EXTI_HandleTypeDef *hexti); | |||
| uint32_t HAL_EXTI_GetPending(EXTI_HandleTypeDef *hexti, uint32_t Edge); | |||
| void HAL_EXTI_ClearPending(EXTI_HandleTypeDef *hexti, uint32_t Edge); | |||
| void HAL_EXTI_GenerateSWI(EXTI_HandleTypeDef *hexti); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* STM32H7xx_HAL_EXTI_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_fdcan.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of FDCAN HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_FDCAN_H | |||
| #define __STM32H7xx_HAL_FDCAN_H | |||
| #ifndef STM32H7xx_HAL_FDCAN_H | |||
| #define STM32H7xx_HAL_FDCAN_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -68,7 +50,7 @@ typedef enum | |||
| HAL_FDCAN_STATE_READY = 0x01U, /*!< FDCAN initialized and ready for use */ | |||
| HAL_FDCAN_STATE_BUSY = 0x02U, /*!< FDCAN process is ongoing */ | |||
| HAL_FDCAN_STATE_ERROR = 0x03U /*!< FDCAN error state */ | |||
| }HAL_FDCAN_StateTypeDef; | |||
| } HAL_FDCAN_StateTypeDef; | |||
| /** | |||
| * @brief FDCAN Init structure definition | |||
| @@ -162,7 +144,7 @@ typedef struct | |||
| uint32_t TxElmtSize; /*!< Specifies the Data Field Size in a Tx Element. | |||
| This parameter can be a value of @ref FDCAN_data_field_size */ | |||
| }FDCAN_InitTypeDef; | |||
| } FDCAN_InitTypeDef; | |||
| /** | |||
| * @brief FDCAN clock calibration unit structure definition | |||
| @@ -170,7 +152,7 @@ typedef struct | |||
| typedef struct | |||
| { | |||
| uint32_t ClockCalibration; /*!< Enable or disable the clock calibration. | |||
| This parameter can be set to ENABLE or DISABLE */ | |||
| This parameter can be a value of @ref FDCAN_clock_calibration. */ | |||
| uint32_t ClockDivider; /*!< Specifies the FDCAN kernel clock divider when the clock calibration | |||
| is bypassed. | |||
| @@ -190,7 +172,7 @@ typedef struct | |||
| If set to zero the counter is disabled. | |||
| This parameter must be a number between 0x0000 and 0xFFFF */ | |||
| }FDCAN_ClkCalUnitTypeDef; | |||
| } FDCAN_ClkCalUnitTypeDef; | |||
| /** | |||
| * @brief FDCAN filter structure definition | |||
| @@ -241,7 +223,7 @@ typedef struct | |||
| - 0 : ordinary message | |||
| - 1 : calibration message */ | |||
| }FDCAN_FilterTypeDef; | |||
| } FDCAN_FilterTypeDef; | |||
| /** | |||
| * @brief FDCAN Tx header structure definition | |||
| @@ -281,7 +263,7 @@ typedef struct | |||
| element for identification of Tx message status. | |||
| This parameter must be a number between 0 and 0xFF */ | |||
| }FDCAN_TxHeaderTypeDef; | |||
| } FDCAN_TxHeaderTypeDef; | |||
| /** | |||
| * @brief FDCAN Rx header structure definition | |||
| @@ -327,7 +309,7 @@ typedef struct | |||
| HAL_FDCAN_ConfigGlobalFilter(). | |||
| This parameter can be 0 or 1 */ | |||
| }FDCAN_RxHeaderTypeDef; | |||
| } FDCAN_RxHeaderTypeDef; | |||
| /** | |||
| * @brief FDCAN Tx event FIFO structure definition | |||
| @@ -370,7 +352,7 @@ typedef struct | |||
| uint32_t EventType; /*!< Specifies the event type. | |||
| This parameter can be a value of @ref FDCAN_event_type */ | |||
| }FDCAN_TxEventFifoTypeDef; | |||
| } FDCAN_TxEventFifoTypeDef; | |||
| /** | |||
| * @brief FDCAN High Priority Message Status structure definition | |||
| @@ -397,7 +379,7 @@ typedef struct | |||
| or | |||
| FDCAN_HP_STORAGE_RXFIFO1 */ | |||
| }FDCAN_HpMsgStatusTypeDef; | |||
| } FDCAN_HpMsgStatusTypeDef; | |||
| /** | |||
| * @brief FDCAN Protocol Status structure definition | |||
| @@ -439,10 +421,10 @@ typedef struct | |||
| - 0 : Last received CAN FD message did not have its BRS flag set | |||
| - 1 : Last received CAN FD message had its BRS flag set */ | |||
| uint32_t RxFDFflag; /*!< Specifies FDF flag of last received CAN FD message. | |||
| uint32_t RxFDFflag; /*!< Specifies if CAN FD message (FDF flag set) has been received since last protocol status. | |||
| This parameter can be: | |||
| - 0 : Last received CAN FD message did not have its FDF flag set | |||
| - 1 : Last received CAN FD message had its FDF flag set */ | |||
| - 0 : no CAN FD message received | |||
| - 1 : CAN FD message received */ | |||
| uint32_t ProtocolException; /*!< Specifies the FDCAN module Protocol Exception status. | |||
| This parameter can be: | |||
| @@ -452,7 +434,7 @@ typedef struct | |||
| uint32_t TDCvalue; /*!< Specifies the Transmitter Delay Compensation Value. | |||
| This parameter can be a number between 0 and 127 */ | |||
| }FDCAN_ProtocolStatusTypeDef; | |||
| } FDCAN_ProtocolStatusTypeDef; | |||
| /** | |||
| * @brief FDCAN Error Counters structure definition | |||
| @@ -471,12 +453,12 @@ typedef struct | |||
| - 1 : The Receive Error Counter (RxErrorCnt) has reached the error passive level of 128 */ | |||
| uint32_t ErrorLogging; /*!< Specifies the Transmit/Receive error logging counter value. | |||
| This parameter can be a number between 0 and 127. | |||
| This parameter can be a number between 0 and 255. | |||
| This counter is incremented each time when a FDCAN protocol error causes the TxErrorCnt | |||
| or the RxErrorCnt to be incremented. The counter stops at 127; the next increment of | |||
| or the RxErrorCnt to be incremented. The counter stops at 255; the next increment of | |||
| TxErrorCnt or RxErrorCnt sets interrupt flag FDCAN_FLAG_ERROR_LOGGING_OVERFLOW */ | |||
| }FDCAN_ErrorCountersTypeDef; | |||
| } FDCAN_ErrorCountersTypeDef; | |||
| /** | |||
| * @brief FDCAN TT Init structure definition | |||
| @@ -495,7 +477,7 @@ typedef struct | |||
| This parameter can be a value of @ref FDCAN_TT_time_master */ | |||
| uint32_t SyncDevLimit; /*!< Specifies the Synchronization Deviation Limit SDL of the TUR | |||
| numerator : TUR = (Numerator ?? SDL) / Denominator. | |||
| numerator : TUR = (Numerator ? SDL) / Denominator. | |||
| With : SDL = 2^(SyncDevLimit+5). | |||
| This parameter must be a number between 0 and 7 */ | |||
| @@ -560,7 +542,7 @@ typedef struct | |||
| uint32_t EventTrigSel; /*!< Specifies the input to be used as event trigger. | |||
| This parameter can be a value of @ref FDCAN_TT_event_trig_selection */ | |||
| }FDCAN_TT_ConfigTypeDef; | |||
| } FDCAN_TT_ConfigTypeDef; | |||
| /** | |||
| * @brief FDCAN Trigger structure definition | |||
| @@ -608,7 +590,7 @@ typedef struct | |||
| - 0 and 127, if FilterType is FDCAN_STANDARD_ID | |||
| - 0 and 63, if FilterType is FDCAN_EXTENDED_ID */ | |||
| }FDCAN_TriggerTypeDef; | |||
| } FDCAN_TriggerTypeDef; | |||
| /** | |||
| * @brief FDCAN TT Operation Status structure definition | |||
| @@ -634,7 +616,7 @@ typedef struct | |||
| This parameter is only relevant in Level 0 and Level 2, otherwise fixed to 1. | |||
| This parameter can be: | |||
| - 0 : Local clock speed not synchronized to Time Master clock speed | |||
| - 1 : Synchronization Deviation '?? SDL */ | |||
| - 1 : Synchronization Deviation = SDL */ | |||
| uint32_t RefTrigOffset; /*!< Specifies the Actual Reference Trigger Offset Value. | |||
| This parameter can be a number between 0 and 0xFF */ | |||
| @@ -677,7 +659,7 @@ typedef struct | |||
| - 0 : Phase outside range | |||
| - 1 : Phase inside range */ | |||
| }FDCAN_TTOperationStatusTypeDef; | |||
| } FDCAN_TTOperationStatusTypeDef; | |||
| /** | |||
| * @brief FDCAN Message RAM blocks | |||
| @@ -714,29 +696,93 @@ typedef struct | |||
| uint32_t EndAddress; /*!< Specifies the End Address of the allocated RAM. | |||
| This parameter must be a 32-bit word address */ | |||
| }FDCAN_MsgRamAddressTypeDef; | |||
| } FDCAN_MsgRamAddressTypeDef; | |||
| /** | |||
| * @brief FDCAN handle structure definition | |||
| */ | |||
| #if USE_HAL_FDCAN_REGISTER_CALLBACKS == 1 | |||
| typedef struct __FDCAN_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_FDCAN_REGISTER_CALLBACKS */ | |||
| { | |||
| FDCAN_GlobalTypeDef *Instance; /*!< Register base address */ | |||
| FDCAN_GlobalTypeDef *Instance; /*!< Register base address */ | |||
| TTCAN_TypeDef *ttcan; /*!< TT register base address */ | |||
| FDCAN_InitTypeDef Init; /*!< FDCAN required parameters */ | |||
| TTCAN_TypeDef *ttcan; /*!< TT register base address */ | |||
| FDCAN_MsgRamAddressTypeDef msgRam; /*!< FDCAN Message RAM blocks */ | |||
| FDCAN_InitTypeDef Init; /*!< FDCAN required parameters */ | |||
| uint32_t LatestTxFifoQRequest; /*!< FDCAN Tx buffer index | |||
| of latest Tx FIFO/Queue request */ | |||
| FDCAN_MsgRamAddressTypeDef msgRam; /*!< FDCAN Message RAM blocks */ | |||
| __IO HAL_FDCAN_StateTypeDef State; /*!< FDCAN communication state */ | |||
| __IO HAL_FDCAN_StateTypeDef State; /*!< FDCAN communication state */ | |||
| HAL_LockTypeDef Lock; /*!< FDCAN locking object */ | |||
| HAL_LockTypeDef Lock; /*!< FDCAN locking object */ | |||
| __IO uint32_t ErrorCode; /*!< FDCAN Error code */ | |||
| __IO uint32_t ErrorCode; /*!< FDCAN Error code */ | |||
| #if USE_HAL_FDCAN_REGISTER_CALLBACKS == 1 | |||
| void (* ClockCalibrationCallback)(struct __FDCAN_HandleTypeDef *hfdcan, uint32_t ClkCalibrationITs); /*!< FDCAN Clock Calibration callback */ | |||
| void (* TxEventFifoCallback)(struct __FDCAN_HandleTypeDef *hfdcan, uint32_t TxEventFifoITs); /*!< FDCAN Tx Event Fifo callback */ | |||
| void (* RxFifo0Callback)(struct __FDCAN_HandleTypeDef *hfdcan, uint32_t RxFifo0ITs); /*!< FDCAN Rx Fifo 0 callback */ | |||
| void (* RxFifo1Callback)(struct __FDCAN_HandleTypeDef *hfdcan, uint32_t RxFifo1ITs); /*!< FDCAN Rx Fifo 1 callback */ | |||
| void (* TxFifoEmptyCallback)(struct __FDCAN_HandleTypeDef *hfdcan); /*!< FDCAN Tx Fifo Empty callback */ | |||
| void (* TxBufferCompleteCallback)(struct __FDCAN_HandleTypeDef *hfdcan, uint32_t BufferIndexes); /*!< FDCAN Tx Buffer complete callback */ | |||
| void (* TxBufferAbortCallback)(struct __FDCAN_HandleTypeDef *hfdcan, uint32_t BufferIndexes); /*!< FDCAN Tx Buffer abort callback */ | |||
| void (* RxBufferNewMessageCallback)(struct __FDCAN_HandleTypeDef *hfdcan); /*!< FDCAN Rx Buffer New Message callback */ | |||
| void (* HighPriorityMessageCallback)(struct __FDCAN_HandleTypeDef *hfdcan); /*!< FDCAN High priority message callback */ | |||
| void (* TimestampWraparoundCallback)(struct __FDCAN_HandleTypeDef *hfdcan); /*!< FDCAN Timestamp wraparound callback */ | |||
| void (* TimeoutOccurredCallback)(struct __FDCAN_HandleTypeDef *hfdcan); /*!< FDCAN Timeout occurred callback */ | |||
| void (* ErrorCallback)(struct __FDCAN_HandleTypeDef *hfdcan); /*!< FDCAN Error callback */ | |||
| void (* ErrorStatusCallback)(struct __FDCAN_HandleTypeDef *hfdcan, uint32_t ErrorStatusITs); /*!< FDCAN Error status callback */ | |||
| void (* TT_ScheduleSyncCallback)(struct __FDCAN_HandleTypeDef *hfdcan, uint32_t TTSchedSyncITs); /*!< FDCAN T Schedule Synchronization callback */ | |||
| void (* TT_TimeMarkCallback)(struct __FDCAN_HandleTypeDef *hfdcan, uint32_t TTTimeMarkITs); /*!< FDCAN TT Time Mark callback */ | |||
| void (* TT_StopWatchCallback)(struct __FDCAN_HandleTypeDef *hfdcan, uint32_t SWTime, uint32_t SWCycleCount); /*!< FDCAN TT Stop Watch callback */ | |||
| void (* TT_GlobalTimeCallback)(struct __FDCAN_HandleTypeDef *hfdcan, uint32_t TTGlobTimeITs); /*!< FDCAN TT Global Time callback */ | |||
| }FDCAN_HandleTypeDef; | |||
| void (* MspInitCallback)(struct __FDCAN_HandleTypeDef *hfdcan); /*!< FDCAN Msp Init callback */ | |||
| void (* MspDeInitCallback)(struct __FDCAN_HandleTypeDef *hfdcan); /*!< FDCAN Msp DeInit callback */ | |||
| #endif /* USE_HAL_FDCAN_REGISTER_CALLBACKS */ | |||
| } FDCAN_HandleTypeDef; | |||
| #if USE_HAL_FDCAN_REGISTER_CALLBACKS == 1 | |||
| /** | |||
| * @brief HAL FDCAN common Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_FDCAN_TX_FIFO_EMPTY_CB_ID = 0x00U, /*!< FDCAN Tx Fifo Empty callback ID */ | |||
| HAL_FDCAN_RX_BUFFER_NEW_MSG_CB_ID = 0x01U, /*!< FDCAN Rx buffer new message callback ID */ | |||
| HAL_FDCAN_HIGH_PRIO_MESSAGE_CB_ID = 0x02U, /*!< FDCAN High priority message callback ID */ | |||
| HAL_FDCAN_TIMESTAMP_WRAPAROUND_CB_ID = 0x03U, /*!< FDCAN Timestamp wraparound callback ID */ | |||
| HAL_FDCAN_TIMEOUT_OCCURRED_CB_ID = 0x04U, /*!< FDCAN Timeout occurred callback ID */ | |||
| HAL_FDCAN_ERROR_CALLBACK_CB_ID = 0x05U, /*!< FDCAN Error callback ID */ | |||
| HAL_FDCAN_MSPINIT_CB_ID = 0x06U, /*!< FDCAN MspInit callback ID */ | |||
| HAL_FDCAN_MSPDEINIT_CB_ID = 0x07U, /*!< FDCAN MspDeInit callback ID */ | |||
| } HAL_FDCAN_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL FDCAN Callback pointer definition | |||
| */ | |||
| typedef void (*pFDCAN_CallbackTypeDef)(FDCAN_HandleTypeDef *hfdcan); /*!< pointer to a common FDCAN callback function */ | |||
| typedef void (*pFDCAN_ClockCalibrationCallbackTypeDef)(FDCAN_HandleTypeDef *hfdcan, uint32_t ClkCalibrationITs); /*!< pointer to Clock Calibration FDCAN callback function */ | |||
| typedef void (*pFDCAN_TxEventFifoCallbackTypeDef)(FDCAN_HandleTypeDef *hfdcan, uint32_t TxEventFifoITs); /*!< pointer to Tx event Fifo FDCAN callback function */ | |||
| typedef void (*pFDCAN_RxFifo0CallbackTypeDef)(FDCAN_HandleTypeDef *hfdcan, uint32_t RxFifo0ITs); /*!< pointer to Rx Fifo 0 FDCAN callback function */ | |||
| typedef void (*pFDCAN_RxFifo1CallbackTypeDef)(FDCAN_HandleTypeDef *hfdcan, uint32_t RxFifo1ITs); /*!< pointer to Rx Fifo 1 FDCAN callback function */ | |||
| typedef void (*pFDCAN_TxBufferCompleteCallbackTypeDef)(FDCAN_HandleTypeDef *hfdcan, uint32_t BufferIndexes); /*!< pointer to Tx Buffer complete FDCAN callback function */ | |||
| typedef void (*pFDCAN_TxBufferAbortCallbackTypeDef)(FDCAN_HandleTypeDef *hfdcan, uint32_t BufferIndexes); /*!< pointer to Tx Buffer abort FDCAN callback function */ | |||
| typedef void (*pFDCAN_ErrorStatusCallbackTypeDef)(FDCAN_HandleTypeDef *hfdcan, uint32_t ErrorStatusITs); /*!< pointer to Error Status callback function */ | |||
| typedef void (*pFDCAN_TT_ScheduleSyncCallbackTypeDef)(FDCAN_HandleTypeDef *hfdcan, uint32_t TTSchedSyncITs); /*!< pointer to TT Schedule Synchronization FDCAN callback function */ | |||
| typedef void (*pFDCAN_TT_TimeMarkCallbackTypeDef)(FDCAN_HandleTypeDef *hfdcan, uint32_t TTTimeMarkITs); /*!< pointer to TT Time Mark FDCAN callback function */ | |||
| typedef void (*pFDCAN_TT_StopWatchCallbackTypeDef)(FDCAN_HandleTypeDef *hfdcan, uint32_t SWTime, uint32_t SWCycleCount); /*!< pointer to TT Stop Watch FDCAN callback function */ | |||
| typedef void (*pFDCAN_TT_GlobalTimeCallbackTypeDef)(FDCAN_HandleTypeDef *hfdcan, uint32_t TTGlobTimeITs); /*!< pointer to TT Global Time FDCAN callback function */ | |||
| #endif /* USE_HAL_FDCAN_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| @@ -759,11 +805,13 @@ typedef struct | |||
| #define HAL_FDCAN_ERROR_PARAM ((uint32_t)0x00000020U) /*!< Parameter error */ | |||
| #define HAL_FDCAN_ERROR_PENDING ((uint32_t)0x00000040U) /*!< Pending operation */ | |||
| #define HAL_FDCAN_ERROR_RAM_ACCESS ((uint32_t)0x00000080U) /*!< Message RAM Access Failure */ | |||
| #define HAL_FDCAN_ERROR_FIFO_EMPTY ((uint32_t)0x00000100U) /*!< Put element in full FIFO */ | |||
| #define HAL_FDCAN_ERROR_FIFO_FULL ((uint32_t)0x00000200U) /*!< Get element from empty FIFO */ | |||
| #define HAL_FDCAN_ERROR_LOG_OVERFLOW FDCAN_IR_ELO /*!< Overflow of CAN Error Logging Counter */ | |||
| #define HAL_FDCAN_ERROR_RAM_WDG FDCAN_IR_WDI /*!< Message RAM Watchdog event occurred */ | |||
| #define HAL_FDCAN_ERROR_PROTOCOL_ARBT FDCAN_IR_PEA /*!< Protocol Error in Arbitration Phase (Nominal Bit Time is used) */ | |||
| #define HAL_FDCAN_ERROR_PROTOCOL_DATA FDCAN_IR_PED /*!< Protocol Error in Data Phase (Data Bit Time is used) */ | |||
| #define HAL_FDCAN_ERROR_RESEVED_AREA FDCAN_IR_ARA /*!< Access to Reserved Address */ | |||
| #define HAL_FDCAN_ERROR_RESERVED_AREA FDCAN_IR_ARA /*!< Access to Reserved Address */ | |||
| #define HAL_FDCAN_ERROR_TT_GLOBAL_TIME FDCAN_TTIR_GTE /*!< Global Time Error : Synchronization deviation exceeded limit */ | |||
| #define HAL_FDCAN_ERROR_TT_TX_UNDERFLOW FDCAN_TTIR_TXU /*!< Tx Count Underflow : Less Tx trigger than expected in one matrix cycle */ | |||
| #define HAL_FDCAN_ERROR_TT_TX_OVERFLOW FDCAN_TTIR_TXO /*!< Tx Count Overflow : More Tx trigger than expected in one matrix cycle */ | |||
| @@ -773,6 +821,10 @@ typedef struct | |||
| #define HAL_FDCAN_ERROR_TT_NO_REF FDCAN_TTIR_WT /*!< Missing reference message */ | |||
| #define HAL_FDCAN_ERROR_TT_APPL_WDG FDCAN_TTIR_AW /*!< Application watchdog not served in time */ | |||
| #define HAL_FDCAN_ERROR_TT_CONFIG FDCAN_TTIR_CER /*!< Error found in trigger list */ | |||
| #if USE_HAL_FDCAN_REGISTER_CALLBACKS == 1 | |||
| #define HAL_FDCAN_ERROR_INVALID_CALLBACK ((uint32_t)0x00000100U) /*!< Invalid Callback error */ | |||
| #endif /* USE_HAL_FDCAN_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -781,8 +833,8 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| #define FDCAN_FRAME_CLASSIC ((uint32_t)0x00000000U) /*!< Classic mode */ | |||
| #define FDCAN_FRAME_FD_NO_BRS ((uint32_t)FDCAN_CCCR_FDOE) /*!< FD mode without BitRate Switshing */ | |||
| #define FDCAN_FRAME_FD_BRS ((uint32_t)(FDCAN_CCCR_FDOE | FDCAN_CCCR_BRSE)) /*!< FD mode with BitRate Switshing */ | |||
| #define FDCAN_FRAME_FD_NO_BRS ((uint32_t)FDCAN_CCCR_FDOE) /*!< FD mode without BitRate Switching */ | |||
| #define FDCAN_FRAME_FD_BRS ((uint32_t)(FDCAN_CCCR_FDOE | FDCAN_CCCR_BRSE)) /*!< FD mode with BitRate Switching */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -799,6 +851,15 @@ typedef struct | |||
| * @} | |||
| */ | |||
| /** @defgroup FDCAN_clock_calibration FDCAN Clock Calibration | |||
| * @{ | |||
| */ | |||
| #define FDCAN_CLOCK_CALIBRATION_DISABLE ((uint32_t)0x00000000U) /*!< Disable Clock Calibration */ | |||
| #define FDCAN_CLOCK_CALIBRATION_ENABLE ((uint32_t)0x00000001U) /*!< Enable Clock Calibration */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FDCAN_clock_divider FDCAN Clock Divider | |||
| * @{ | |||
| */ | |||
| @@ -1130,8 +1191,8 @@ typedef struct | |||
| */ | |||
| #define FDCAN_COM_STATE_SYNC ((uint32_t)0x00000000U) /*!< Node is synchronizing on CAN communication */ | |||
| #define FDCAN_COM_STATE_IDLE ((uint32_t)0x00000008U) /*!< Node is neither receiver nor transmitter */ | |||
| #define FDCAN_COM_STATE_RX ((uint32_t)0x00000016U) /*!< Node is operating as receiver */ | |||
| #define FDCAN_COM_STATE_TX ((uint32_t)0x00000024U) /*!< Node is operating as transmitter */ | |||
| #define FDCAN_COM_STATE_RX ((uint32_t)0x00000010U) /*!< Node is operating as receiver */ | |||
| #define FDCAN_COM_STATE_TX ((uint32_t)0x00000018U) /*!< Node is operating as transmitter */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -1165,6 +1226,15 @@ typedef struct | |||
| * @} | |||
| */ | |||
| /** @defgroup FDCAN_Reject_Remote_Frames FDCAN reject remote frames | |||
| * @{ | |||
| */ | |||
| #define FDCAN_FILTER_REMOTE ((uint32_t)0x00000000U) /*!< Filter remote frames */ | |||
| #define FDCAN_REJECT_REMOTE ((uint32_t)0x00000001U) /*!< Reject all remote frames */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FDCAN_Interrupt_Line FDCAN interrupt line | |||
| * @{ | |||
| */ | |||
| @@ -1575,9 +1645,6 @@ typedef struct | |||
| */ | |||
| #define FDCAN_IT_RAM_ACCESS_FAILURE FDCAN_IE_MRAFE /*!< Message RAM access failure occurred */ | |||
| #define FDCAN_IT_ERROR_LOGGING_OVERFLOW FDCAN_IE_ELOE /*!< Overflow of FDCAN Error Logging Counter occurred */ | |||
| #define FDCAN_IT_ERROR_PASSIVE FDCAN_IE_EPE /*!< Error_Passive status changed */ | |||
| #define FDCAN_IT_ERROR_WARNING FDCAN_IE_EWE /*!< Error_Warning status changed */ | |||
| #define FDCAN_IT_BUS_OFF FDCAN_IE_BOE /*!< Bus_Off status changed */ | |||
| #define FDCAN_IT_RAM_WATCHDOG FDCAN_IE_WDIE /*!< Message RAM Watchdog event due to missing READY */ | |||
| #define FDCAN_IT_ARB_PROTOCOL_ERROR FDCAN_IE_PEAE /*!< Protocol error in arbitration phase detected */ | |||
| #define FDCAN_IT_DATA_PROTOCOL_ERROR FDCAN_IE_PEDE /*!< Protocol error in data phase detected */ | |||
| @@ -1586,6 +1653,16 @@ typedef struct | |||
| * @} | |||
| */ | |||
| /** @defgroup FDCAN_Error_Status_Interrupts FDCAN Error Status Interrupts | |||
| * @{ | |||
| */ | |||
| #define FDCAN_IT_ERROR_PASSIVE FDCAN_IE_EPE /*!< Error_Passive status changed */ | |||
| #define FDCAN_IT_ERROR_WARNING FDCAN_IE_EWE /*!< Error_Warning status changed */ | |||
| #define FDCAN_IT_BUS_OFF FDCAN_IE_BOE /*!< Bus_Off status changed */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -1694,17 +1771,25 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| /** @brief Reset FDCAN handle state. | |||
| * @param __HANDLE__: FDCAN handle. | |||
| /** @brief Reset FDCAN handle state. | |||
| * @param __HANDLE__ FDCAN handle. | |||
| * @retval None | |||
| */ | |||
| #if USE_HAL_FDCAN_REGISTER_CALLBACKS == 1 | |||
| #define __HAL_FDCAN_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->State = HAL_FDCAN_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_FDCAN_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_FDCAN_STATE_RESET) | |||
| #endif /* USE_HAL_FDCAN_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @brief Enable the specified FDCAN interrupts. | |||
| * @param __HANDLE__: FDCAN handle. | |||
| * @param __INTERRUPT__: FDCAN interrupt. | |||
| * This parameter can be any combination of @arg FDCAN_Interrupts | |||
| * @param __HANDLE__ FDCAN handle. | |||
| * @param __INTERRUPT__ FDCAN interrupt. | |||
| * This parameter can be any combination of @arg FDCAN_Interrupts | |||
| * @retval None | |||
| */ | |||
| #define __HAL_FDCAN_ENABLE_IT(__HANDLE__, __INTERRUPT__) \ | |||
| @@ -1716,9 +1801,9 @@ typedef struct | |||
| /** | |||
| * @brief Disable the specified FDCAN interrupts. | |||
| * @param __HANDLE__: FDCAN handle. | |||
| * @param __INTERRUPT__: FDCAN interrupt. | |||
| * This parameter can be any combination of @arg FDCAN_Interrupts | |||
| * @param __HANDLE__ FDCAN handle. | |||
| * @param __INTERRUPT__ FDCAN interrupt. | |||
| * This parameter can be any combination of @arg FDCAN_Interrupts | |||
| * @retval None | |||
| */ | |||
| #define __HAL_FDCAN_DISABLE_IT(__HANDLE__, __INTERRUPT__) \ | |||
| @@ -1729,40 +1814,40 @@ typedef struct | |||
| /** | |||
| * @brief Check whether the specified FDCAN interrupt is set or not. | |||
| * @param __HANDLE__: FDCAN handle. | |||
| * @param __INTERRUPT__: FDCAN interrupt. | |||
| * This parameter can be one of @arg FDCAN_Interrupts | |||
| * @retval None | |||
| * @param __HANDLE__ FDCAN handle. | |||
| * @param __INTERRUPT__ FDCAN interrupt. | |||
| * This parameter can be one of @arg FDCAN_Interrupts | |||
| * @retval ITStatus | |||
| */ | |||
| #define __HAL_FDCAN_GET_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) < FDCAN_IT_CALIB_WATCHDOG_EVENT) ? ((__HANDLE__)->Instance->IR & (__INTERRUPT__)) : ((FDCAN_CCU->IR << 30) & (__INTERRUPT__))) | |||
| /** | |||
| * @brief Clear the specified FDCAN interrupts. | |||
| * @param __HANDLE__: FDCAN handle. | |||
| * @param __INTERRUPT__: specifies the interrupts to clear. | |||
| * This parameter can be any combination of @arg FDCAN_Interrupts | |||
| * @param __HANDLE__ FDCAN handle. | |||
| * @param __INTERRUPT__ specifies the interrupts to clear. | |||
| * This parameter can be any combination of @arg FDCAN_Interrupts | |||
| * @retval None | |||
| */ | |||
| #define __HAL_FDCAN_CLEAR_IT(__HANDLE__, __INTERRUPT__) \ | |||
| do{ \ | |||
| #define __HAL_FDCAN_CLEAR_IT(__HANDLE__, __INTERRUPT__) \ | |||
| do{ \ | |||
| ((__HANDLE__)->Instance->IR) = ((__INTERRUPT__) & FDCAN_IR_MASK); \ | |||
| FDCAN_CCU->IR = (((__INTERRUPT__) & CCU_IR_MASK) >> 30); \ | |||
| }while(0) | |||
| /** | |||
| * @brief Check whether the specified FDCAN flag is set or not. | |||
| * @param __HANDLE__: FDCAN handle. | |||
| * @param __FLAG__: FDCAN flag. | |||
| * This parameter can be one of @arg FDCAN_flags | |||
| * @retval None | |||
| * @param __HANDLE__ FDCAN handle. | |||
| * @param __FLAG__ FDCAN flag. | |||
| * This parameter can be one of @arg FDCAN_flags | |||
| * @retval FlagStatus | |||
| */ | |||
| #define __HAL_FDCAN_GET_FLAG(__HANDLE__, __FLAG__) (((__FLAG__) < FDCAN_FLAG_CALIB_WATCHDOG_EVENT) ? ((__HANDLE__)->Instance->IR & (__FLAG__)) : ((FDCAN_CCU->IR << 30) & (__FLAG__))) | |||
| /** | |||
| * @brief Clear the specified FDCAN flags. | |||
| * @param __HANDLE__: FDCAN handle. | |||
| * @param __FLAG__: specifies the flags to clear. | |||
| * This parameter can be any combination of @arg FDCAN_flags | |||
| * @param __HANDLE__ FDCAN handle. | |||
| * @param __FLAG__ specifies the flags to clear. | |||
| * This parameter can be any combination of @arg FDCAN_flags | |||
| * @retval None | |||
| */ | |||
| #define __HAL_FDCAN_CLEAR_FLAG(__HANDLE__, __FLAG__) \ | |||
| @@ -1772,72 +1857,72 @@ do{ \ | |||
| }while(0) | |||
| /** @brief Check if the specified FDCAN interrupt source is enabled or disabled. | |||
| * @param __HANDLE__: FDCAN handle. | |||
| * @param __INTERRUPT__: specifies the FDCAN interrupt source to check. | |||
| * This parameter can be a value of @arg FDCAN_Interrupts | |||
| * @retval None | |||
| * @param __HANDLE__ FDCAN handle. | |||
| * @param __INTERRUPT__ specifies the FDCAN interrupt source to check. | |||
| * This parameter can be a value of @arg FDCAN_Interrupts | |||
| * @retval ITStatus | |||
| */ | |||
| #define __HAL_FDCAN_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) < FDCAN_IT_CALIB_WATCHDOG_EVENT) ? ((__HANDLE__)->Instance->IE & (__INTERRUPT__)) : ((FDCAN_CCU->IE << 30) & (__INTERRUPT__))) | |||
| /** | |||
| * @brief Enable the specified FDCAN TT interrupts. | |||
| * @param __HANDLE__: FDCAN handle. | |||
| * @param __INTERRUPT__: FDCAN TT interrupt. | |||
| * This parameter can be any combination of @arg FDCAN_TTInterrupts | |||
| * @param __HANDLE__ FDCAN handle. | |||
| * @param __INTERRUPT__ FDCAN TT interrupt. | |||
| * This parameter can be any combination of @arg FDCAN_TTInterrupts | |||
| * @retval None | |||
| */ | |||
| #define __HAL_FDCAN_TT_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->ttcan->TTIE) |= (__INTERRUPT__)) | |||
| /** | |||
| * @brief Disable the specified FDCAN TT interrupts. | |||
| * @param __HANDLE__: FDCAN handle. | |||
| * @param __INTERRUPT__: FDCAN TT interrupt. | |||
| * This parameter can be any combination of @arg FDCAN_TTInterrupts | |||
| * @param __HANDLE__ FDCAN handle. | |||
| * @param __INTERRUPT__ FDCAN TT interrupt. | |||
| * This parameter can be any combination of @arg FDCAN_TTInterrupts | |||
| * @retval None | |||
| */ | |||
| #define __HAL_FDCAN_TT_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->ttcan->TTIE) &= ~(__INTERRUPT__)) | |||
| /** | |||
| * @brief Check whether the specified FDCAN TT interrupt is set or not. | |||
| * @param __HANDLE__: FDCAN handle. | |||
| * @param __INTERRUPT__: FDCAN TT interrupt. | |||
| * This parameter can be one of @arg FDCAN_TTInterrupts | |||
| * @retval None | |||
| * @param __HANDLE__ FDCAN handle. | |||
| * @param __INTERRUPT__ FDCAN TT interrupt. | |||
| * This parameter can be one of @arg FDCAN_TTInterrupts | |||
| * @retval ITStatus | |||
| */ | |||
| #define __HAL_FDCAN_TT_GET_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->ttcan->TTIR) & (__INTERRUPT__)) | |||
| /** | |||
| * @brief Clear the specified FDCAN TT interrupts. | |||
| * @param __HANDLE__: FDCAN handle. | |||
| * @param __INTERRUPT__: specifies the TT interrupts to clear. | |||
| * This parameter can be any combination of @arg FDCAN_TTInterrupts | |||
| * @param __HANDLE__ FDCAN handle. | |||
| * @param __INTERRUPT__ specifies the TT interrupts to clear. | |||
| * This parameter can be any combination of @arg FDCAN_TTInterrupts | |||
| * @retval None | |||
| */ | |||
| #define __HAL_FDCAN_TT_CLEAR_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->ttcan->TTIR) = (__INTERRUPT__)) | |||
| /** | |||
| * @brief Check whether the specified FDCAN TT flag is set or not. | |||
| * @param __HANDLE__: FDCAN handle. | |||
| * @param __FLAG__: FDCAN TT flag. | |||
| * This parameter can be one of @arg FDCAN_TTflags | |||
| * @retval None | |||
| * @param __HANDLE__ FDCAN handle. | |||
| * @param __FLAG__ FDCAN TT flag. | |||
| * This parameter can be one of @arg FDCAN_TTflags | |||
| * @retval FlagStatus | |||
| */ | |||
| #define __HAL_FDCAN_TT_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->ttcan->TTIR) & (__FLAG__)) | |||
| /** | |||
| * @brief Clear the specified FDCAN TT flags. | |||
| * @param __HANDLE__: FDCAN handle. | |||
| * @param __FLAG__: specifies the TT flags to clear. | |||
| * This parameter can be any combination of @arg FDCAN_TTflags | |||
| * @param __HANDLE__ FDCAN handle. | |||
| * @param __FLAG__ specifies the TT flags to clear. | |||
| * This parameter can be any combination of @arg FDCAN_TTflags | |||
| * @retval None | |||
| */ | |||
| #define __HAL_FDCAN_TT_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->ttcan->TTIR) = (__FLAG__)) | |||
| /** @brief Check if the specified FDCAN TT interrupt source is enabled or disabled. | |||
| * @param __HANDLE__: FDCAN handle. | |||
| * @param __INTERRUPT__: specifies the FDCAN TT interrupt source to check. | |||
| * This parameter can be a value of @arg FDCAN_TTInterrupts | |||
| * @retval None | |||
| * @param __HANDLE__ FDCAN handle. | |||
| * @param __INTERRUPT__ specifies the FDCAN TT interrupt source to check. | |||
| * This parameter can be a value of @arg FDCAN_TTInterrupts | |||
| * @retval ITStatus | |||
| */ | |||
| #define __HAL_FDCAN_TT_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->ttcan->TTIE) & (__INTERRUPT__)) | |||
| @@ -1854,12 +1939,40 @@ do{ \ | |||
| * @{ | |||
| */ | |||
| /* Initialization and de-initialization functions *****************************/ | |||
| HAL_StatusTypeDef HAL_FDCAN_Init(FDCAN_HandleTypeDef* hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_DeInit(FDCAN_HandleTypeDef* hfdcan); | |||
| void HAL_FDCAN_MspInit(FDCAN_HandleTypeDef* hfdcan); | |||
| void HAL_FDCAN_MspDeInit(FDCAN_HandleTypeDef* hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_Init(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_DeInit(FDCAN_HandleTypeDef *hfdcan); | |||
| void HAL_FDCAN_MspInit(FDCAN_HandleTypeDef *hfdcan); | |||
| void HAL_FDCAN_MspDeInit(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_EnterPowerDownMode(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_ExitPowerDownMode(FDCAN_HandleTypeDef *hfdcan); | |||
| #if USE_HAL_FDCAN_REGISTER_CALLBACKS == 1 | |||
| /* Callbacks Register/UnRegister functions ***********************************/ | |||
| HAL_StatusTypeDef HAL_FDCAN_RegisterCallback(FDCAN_HandleTypeDef *hfdcan, HAL_FDCAN_CallbackIDTypeDef CallbackID, pFDCAN_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_FDCAN_UnRegisterCallback(FDCAN_HandleTypeDef *hfdcan, HAL_FDCAN_CallbackIDTypeDef CallbackID); | |||
| HAL_StatusTypeDef HAL_FDCAN_RegisterClockCalibrationCallback(FDCAN_HandleTypeDef *hfdcan, pFDCAN_ClockCalibrationCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_FDCAN_UnRegisterClockCalibrationCallback(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_RegisterTxEventFifoCallback(FDCAN_HandleTypeDef *hfdcan, pFDCAN_TxEventFifoCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_FDCAN_UnRegisterTxEventFifoCallback(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_RegisterRxFifo0Callback(FDCAN_HandleTypeDef *hfdcan, pFDCAN_RxFifo0CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_FDCAN_UnRegisterRxFifo0Callback(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_RegisterRxFifo1Callback(FDCAN_HandleTypeDef *hfdcan, pFDCAN_RxFifo1CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_FDCAN_UnRegisterRxFifo1Callback(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_RegisterTxBufferCompleteCallback(FDCAN_HandleTypeDef *hfdcan, pFDCAN_TxBufferCompleteCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_FDCAN_UnRegisterTxBufferCompleteCallback(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_RegisterTxBufferAbortCallback(FDCAN_HandleTypeDef *hfdcan, pFDCAN_TxBufferAbortCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_FDCAN_UnRegisterTxBufferAbortCallback(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_RegisterErrorStatusCallback(FDCAN_HandleTypeDef *hfdcan, pFDCAN_ErrorStatusCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_FDCAN_UnRegisterErrorStatusCallback(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_RegisterTTScheduleSyncCallback(FDCAN_HandleTypeDef *hfdcan, pFDCAN_TT_ScheduleSyncCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_FDCAN_UnRegisterTTScheduleSyncCallback(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_RegisterTTTimeMarkCallback(FDCAN_HandleTypeDef *hfdcan, pFDCAN_TT_TimeMarkCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_FDCAN_UnRegisterTTTimeMarkCallback(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_RegisterTTStopWatchCallback(FDCAN_HandleTypeDef *hfdcan, pFDCAN_TT_StopWatchCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_FDCAN_UnRegisterTTStopWatchCallback(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_RegisterTTGlobalTimeCallback(FDCAN_HandleTypeDef *hfdcan, pFDCAN_TT_GlobalTimeCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_FDCAN_UnRegisterTTGlobalTimeCallback(FDCAN_HandleTypeDef *hfdcan); | |||
| #endif /* USE_HAL_FDCAN_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -1868,11 +1981,11 @@ HAL_StatusTypeDef HAL_FDCAN_ExitPowerDownMode(FDCAN_HandleTypeDef *hfdcan); | |||
| * @{ | |||
| */ | |||
| /* Configuration functions ****************************************************/ | |||
| HAL_StatusTypeDef HAL_FDCAN_ConfigClockCalibration(FDCAN_HandleTypeDef* hfdcan, FDCAN_ClkCalUnitTypeDef* sCcuConfig); | |||
| uint32_t HAL_FDCAN_GetClockCalibrationState(FDCAN_HandleTypeDef* hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_ResetClockCalibrationState(FDCAN_HandleTypeDef* hfdcan); | |||
| uint32_t HAL_FDCAN_GetClockCalibrationCounter(FDCAN_HandleTypeDef* hfdcan, uint32_t Counter); | |||
| HAL_StatusTypeDef HAL_FDCAN_ConfigFilter(FDCAN_HandleTypeDef* hfdcan, FDCAN_FilterTypeDef* sFilterConfig); | |||
| HAL_StatusTypeDef HAL_FDCAN_ConfigClockCalibration(FDCAN_HandleTypeDef *hfdcan, FDCAN_ClkCalUnitTypeDef *sCcuConfig); | |||
| uint32_t HAL_FDCAN_GetClockCalibrationState(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_ResetClockCalibrationState(FDCAN_HandleTypeDef *hfdcan); | |||
| uint32_t HAL_FDCAN_GetClockCalibrationCounter(FDCAN_HandleTypeDef *hfdcan, uint32_t Counter); | |||
| HAL_StatusTypeDef HAL_FDCAN_ConfigFilter(FDCAN_HandleTypeDef *hfdcan, FDCAN_FilterTypeDef *sFilterConfig); | |||
| HAL_StatusTypeDef HAL_FDCAN_ConfigGlobalFilter(FDCAN_HandleTypeDef *hfdcan, uint32_t NonMatchingStd, uint32_t NonMatchingExt, uint32_t RejectRemoteStd, uint32_t RejectRemoteExt); | |||
| HAL_StatusTypeDef HAL_FDCAN_ConfigExtendedIdMask(FDCAN_HandleTypeDef *hfdcan, uint32_t Mask); | |||
| HAL_StatusTypeDef HAL_FDCAN_ConfigRxFifoOverwrite(FDCAN_HandleTypeDef *hfdcan, uint32_t RxFifo, uint32_t OperationMode); | |||
| @@ -1891,6 +2004,10 @@ HAL_StatusTypeDef HAL_FDCAN_ResetTimeoutCounter(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_ConfigTxDelayCompensation(FDCAN_HandleTypeDef *hfdcan, uint32_t TdcOffset, uint32_t TdcFilter); | |||
| HAL_StatusTypeDef HAL_FDCAN_EnableTxDelayCompensation(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_DisableTxDelayCompensation(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_EnableISOMode(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_DisableISOMode(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_EnableEdgeFiltering(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_DisableEdgeFiltering(FDCAN_HandleTypeDef *hfdcan); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -1904,6 +2021,7 @@ HAL_StatusTypeDef HAL_FDCAN_Stop(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_AddMessageToTxFifoQ(FDCAN_HandleTypeDef *hfdcan, FDCAN_TxHeaderTypeDef *pTxHeader, uint8_t *pTxData); | |||
| HAL_StatusTypeDef HAL_FDCAN_AddMessageToTxBuffer(FDCAN_HandleTypeDef *hfdcan, FDCAN_TxHeaderTypeDef *pTxHeader, uint8_t *pTxData, uint32_t BufferIndex); | |||
| HAL_StatusTypeDef HAL_FDCAN_EnableTxBufferRequest(FDCAN_HandleTypeDef *hfdcan, uint32_t BufferIndex); | |||
| uint32_t HAL_FDCAN_GetLatestTxFifoQRequestBuffer(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_AbortTxRequest(FDCAN_HandleTypeDef *hfdcan, uint32_t BufferIndex); | |||
| HAL_StatusTypeDef HAL_FDCAN_GetRxMessage(FDCAN_HandleTypeDef *hfdcan, uint32_t RxLocation, FDCAN_RxHeaderTypeDef *pRxHeader, uint8_t *pRxData); | |||
| HAL_StatusTypeDef HAL_FDCAN_GetTxEvent(FDCAN_HandleTypeDef *hfdcan, FDCAN_TxEventFifoTypeDef *pTxEvent); | |||
| @@ -1926,11 +2044,11 @@ HAL_StatusTypeDef HAL_FDCAN_ExitRestrictedOperationMode(FDCAN_HandleTypeDef *hfd | |||
| /* TT Configuration and control functions**************************************/ | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_ConfigOperation(FDCAN_HandleTypeDef *hfdcan, FDCAN_TT_ConfigTypeDef *pTTParams); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_ConfigReferenceMessage(FDCAN_HandleTypeDef *hfdcan, uint32_t IdType, uint32_t Identifier, uint32_t Payload); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_ConfigTrigger(FDCAN_HandleTypeDef* hfdcan, FDCAN_TriggerTypeDef* sTriggerConfig); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_SetGlobalTime(FDCAN_HandleTypeDef* hfdcan, uint32_t TimePreset); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_SetClockSynchronization(FDCAN_HandleTypeDef* hfdcan, uint32_t NewTURNumerator); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_ConfigStopWatch(FDCAN_HandleTypeDef* hfdcan, uint32_t Source, uint32_t Polarity); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_ConfigRegisterTimeMark(FDCAN_HandleTypeDef* hfdcan, uint32_t TimeMarkSource, uint32_t TimeMarkValue, uint32_t RepeatFactor, uint32_t StartCycle); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_ConfigTrigger(FDCAN_HandleTypeDef *hfdcan, FDCAN_TriggerTypeDef *sTriggerConfig); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_SetGlobalTime(FDCAN_HandleTypeDef *hfdcan, uint32_t TimePreset); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_SetClockSynchronization(FDCAN_HandleTypeDef *hfdcan, uint32_t NewTURNumerator); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_ConfigStopWatch(FDCAN_HandleTypeDef *hfdcan, uint32_t Source, uint32_t Polarity); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_ConfigRegisterTimeMark(FDCAN_HandleTypeDef *hfdcan, uint32_t TimeMarkSource, uint32_t TimeMarkValue, uint32_t RepeatFactor, uint32_t StartCycle); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_EnableRegisterTimeMarkPulse(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_DisableRegisterTimeMarkPulse(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_EnableTriggerTimeMarkPulse(FDCAN_HandleTypeDef *hfdcan); | |||
| @@ -1954,12 +2072,12 @@ HAL_StatusTypeDef HAL_FDCAN_TT_GetOperationStatus(FDCAN_HandleTypeDef *hfdcan, F | |||
| */ | |||
| /* Interrupts management ******************************************************/ | |||
| HAL_StatusTypeDef HAL_FDCAN_ConfigInterruptLines(FDCAN_HandleTypeDef *hfdcan, uint32_t ITList, uint32_t InterruptLine); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_ConfigInterruptLines(FDCAN_HandleTypeDef *hfdcan, uint32_t ITList, uint32_t InterruptLine); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_ConfigInterruptLines(FDCAN_HandleTypeDef *hfdcan, uint32_t TTITList, uint32_t InterruptLine); | |||
| HAL_StatusTypeDef HAL_FDCAN_ActivateNotification(FDCAN_HandleTypeDef *hfdcan, uint32_t ActiveITs, uint32_t BufferIndexes); | |||
| HAL_StatusTypeDef HAL_FDCAN_DeactivateNotification(FDCAN_HandleTypeDef *hfdcan, uint32_t InactiveITs); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_ActivateNotification(FDCAN_HandleTypeDef *hfdcan, uint32_t ActiveITs); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_ActivateNotification(FDCAN_HandleTypeDef *hfdcan, uint32_t ActiveTTITs); | |||
| HAL_StatusTypeDef HAL_FDCAN_TT_DeactivateNotification(FDCAN_HandleTypeDef *hfdcan, uint32_t InactiveTTITs); | |||
| void HAL_FDCAN_IRQHandler(FDCAN_HandleTypeDef* hfdcan); | |||
| void HAL_FDCAN_IRQHandler(FDCAN_HandleTypeDef *hfdcan); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -1980,6 +2098,7 @@ void HAL_FDCAN_HighPriorityMessageCallback(FDCAN_HandleTypeDef *hfdcan); | |||
| void HAL_FDCAN_TimestampWraparoundCallback(FDCAN_HandleTypeDef *hfdcan); | |||
| void HAL_FDCAN_TimeoutOccurredCallback(FDCAN_HandleTypeDef *hfdcan); | |||
| void HAL_FDCAN_ErrorCallback(FDCAN_HandleTypeDef *hfdcan); | |||
| void HAL_FDCAN_ErrorStatusCallback(FDCAN_HandleTypeDef *hfdcan, uint32_t ErrorStatusITs); | |||
| void HAL_FDCAN_TT_ScheduleSyncCallback(FDCAN_HandleTypeDef *hfdcan, uint32_t TTSchedSyncITs); | |||
| void HAL_FDCAN_TT_TimeMarkCallback(FDCAN_HandleTypeDef *hfdcan, uint32_t TTTimeMarkITs); | |||
| void HAL_FDCAN_TT_StopWatchCallback(FDCAN_HandleTypeDef *hfdcan, uint32_t SWTime, uint32_t SWCycleCount); | |||
| @@ -1993,7 +2112,7 @@ void HAL_FDCAN_TT_GlobalTimeCallback(FDCAN_HandleTypeDef *hfdcan, uint32_t TTGlo | |||
| */ | |||
| /* Peripheral State functions *************************************************/ | |||
| uint32_t HAL_FDCAN_GetError(FDCAN_HandleTypeDef *hfdcan); | |||
| HAL_FDCAN_StateTypeDef HAL_FDCAN_GetState(FDCAN_HandleTypeDef* hfdcan); | |||
| HAL_FDCAN_StateTypeDef HAL_FDCAN_GetState(FDCAN_HandleTypeDef *hfdcan); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -2041,6 +2160,10 @@ HAL_FDCAN_StateTypeDef HAL_FDCAN_GetState(FDCAN_HandleTypeDef* hfdcan); | |||
| ((MODE) == FDCAN_MODE_BUS_MONITORING ) || \ | |||
| ((MODE) == FDCAN_MODE_INTERNAL_LOOPBACK ) || \ | |||
| ((MODE) == FDCAN_MODE_EXTERNAL_LOOPBACK )) | |||
| #define IS_FDCAN_CLOCK_CALIBRATION(CALIBRATION) (((CALIBRATION) == FDCAN_CLOCK_CALIBRATION_DISABLE) || \ | |||
| ((CALIBRATION) == FDCAN_CLOCK_CALIBRATION_ENABLE )) | |||
| #define IS_FDCAN_CKDIV(CKDIV) (((CKDIV) == FDCAN_CLOCK_DIV1 ) || \ | |||
| ((CKDIV) == FDCAN_CLOCK_DIV2 ) || \ | |||
| ((CKDIV) == FDCAN_CLOCK_DIV4 ) || \ | |||
| @@ -2057,14 +2180,14 @@ HAL_FDCAN_StateTypeDef HAL_FDCAN_GetState(FDCAN_HandleTypeDef* hfdcan); | |||
| ((CKDIV) == FDCAN_CLOCK_DIV26) || \ | |||
| ((CKDIV) == FDCAN_CLOCK_DIV28) || \ | |||
| ((CKDIV) == FDCAN_CLOCK_DIV30)) | |||
| #define IS_FDCAN_NOMINAL_PRESCALER(PRESCALER) (((PRESCALER) >= 1) && ((PRESCALER) <= 512)) | |||
| #define IS_FDCAN_NOMINAL_SJW(SJW) (((SJW) >= 1) && ((SJW) <= 128)) | |||
| #define IS_FDCAN_NOMINAL_TSEG1(TSEG1) (((TSEG1) >= 2) && ((TSEG1) <= 256)) | |||
| #define IS_FDCAN_NOMINAL_TSEG2(TSEG2) (((TSEG2) >= 2) && ((TSEG2) <= 128)) | |||
| #define IS_FDCAN_DATA_PRESCALER(PRESCALER) (((PRESCALER) >= 1) && ((PRESCALER) <= 32)) | |||
| #define IS_FDCAN_DATA_SJW(SJW) (((SJW) >= 1) && ((SJW) <= 16)) | |||
| #define IS_FDCAN_DATA_TSEG1(TSEG1) (((TSEG1) >= 1) && ((TSEG1) <= 32)) | |||
| #define IS_FDCAN_DATA_TSEG2(TSEG2) (((TSEG2) >= 1) && ((TSEG2) <= 16)) | |||
| #define IS_FDCAN_NOMINAL_PRESCALER(PRESCALER) (((PRESCALER) >= 1U) && ((PRESCALER) <= 512U)) | |||
| #define IS_FDCAN_NOMINAL_SJW(SJW) (((SJW) >= 1U) && ((SJW) <= 128U)) | |||
| #define IS_FDCAN_NOMINAL_TSEG1(TSEG1) (((TSEG1) >= 1U) && ((TSEG1) <= 256U)) | |||
| #define IS_FDCAN_NOMINAL_TSEG2(TSEG2) (((TSEG2) >= 1U) && ((TSEG2) <= 128U)) | |||
| #define IS_FDCAN_DATA_PRESCALER(PRESCALER) (((PRESCALER) >= 1U) && ((PRESCALER) <= 32U)) | |||
| #define IS_FDCAN_DATA_SJW(SJW) (((SJW) >= 1U) && ((SJW) <= 16U)) | |||
| #define IS_FDCAN_DATA_TSEG1(TSEG1) (((TSEG1) >= 1U) && ((TSEG1) <= 32U)) | |||
| #define IS_FDCAN_DATA_TSEG2(TSEG2) (((TSEG2) >= 1U) && ((TSEG2) <= 16U)) | |||
| #define IS_FDCAN_MAX_VALUE(VALUE, MAX) ((VALUE) <= (MAX)) | |||
| #define IS_FDCAN_MIN_VALUE(VALUE, MIN) ((VALUE) >= (MIN)) | |||
| #define IS_FDCAN_DATA_SIZE(SIZE) (((SIZE) == FDCAN_DATA_BYTES_8 ) || \ | |||
| @@ -2140,14 +2263,16 @@ HAL_FDCAN_StateTypeDef HAL_FDCAN_GetState(FDCAN_HandleTypeDef* hfdcan); | |||
| ((FDF) == FDCAN_FD_CAN )) | |||
| #define IS_FDCAN_EFC(EFC) (((EFC) == FDCAN_NO_TX_EVENTS ) || \ | |||
| ((EFC) == FDCAN_STORE_TX_EVENTS)) | |||
| #define IS_FDCAN_IT(IT) (((IT) & 0xC0300000U) == RESET) | |||
| #define IS_FDCAN_TT_IT(IT) (((IT) & 0xFFF80000U) == RESET) | |||
| #define IS_FDCAN_IT(IT) (((IT) & ~(FDCAN_IR_MASK | CCU_IR_MASK)) == 0U) | |||
| #define IS_FDCAN_TT_IT(IT) (((IT) & 0xFFF80000U) == 0U) | |||
| #define IS_FDCAN_FIFO_WATERMARK(FIFO) (((FIFO) == FDCAN_CFG_TX_EVENT_FIFO) || \ | |||
| ((FIFO) == FDCAN_CFG_RX_FIFO0 ) || \ | |||
| ((FIFO) == FDCAN_CFG_RX_FIFO1 )) | |||
| #define IS_FDCAN_NON_MATCHING(DESTINATION) (((DESTINATION) == FDCAN_ACCEPT_IN_RX_FIFO0) || \ | |||
| ((DESTINATION) == FDCAN_ACCEPT_IN_RX_FIFO1) || \ | |||
| ((DESTINATION) == FDCAN_REJECT )) | |||
| #define IS_FDCAN_REJECT_REMOTE(DESTINATION) (((DESTINATION) == FDCAN_FILTER_REMOTE) || \ | |||
| ((DESTINATION) == FDCAN_REJECT_REMOTE)) | |||
| #define IS_FDCAN_IT_LINE(IT_LINE) (((IT_LINE) == FDCAN_INTERRUPT_LINE0) || \ | |||
| ((IT_LINE) == FDCAN_INTERRUPT_LINE1)) | |||
| #define IS_FDCAN_TIMESTAMP(OPERATION) (((OPERATION) == FDCAN_TIMESTAMP_INTERNAL) || \ | |||
| @@ -2174,6 +2299,9 @@ HAL_FDCAN_StateTypeDef HAL_FDCAN_GetState(FDCAN_HandleTypeDef* hfdcan); | |||
| ((OPERATION) == FDCAN_TIMEOUT_RX_FIFO1 )) | |||
| #define IS_FDCAN_CALIBRATION_FIELD_LENGTH(LENGTH) (((LENGTH) == FDCAN_CALIB_FIELD_LENGTH_32) || \ | |||
| ((LENGTH) == FDCAN_CALIB_FIELD_LENGTH_64)) | |||
| #define IS_FDCAN_CALIBRATION_COUNTER(COUNTER) (((COUNTER) == FDCAN_CALIB_TIME_QUANTA_COUNTER ) || \ | |||
| ((COUNTER) == FDCAN_CALIB_CLOCK_PERIOD_COUNTER) || \ | |||
| ((COUNTER) == FDCAN_CALIB_WATCHDOG_COUNTER )) | |||
| #define IS_FDCAN_TT_REFERENCE_MESSAGE_PAYLOAD(PAYLOAD) (((PAYLOAD) == FDCAN_TT_REF_MESSAGE_NO_PAYLOAD ) || \ | |||
| ((PAYLOAD) == FDCAN_TT_REF_MESSAGE_ADD_PAYLOAD)) | |||
| #define IS_FDCAN_TT_REPEAT_FACTOR(FACTOR) (((FACTOR) == FDCAN_TT_REPEAT_EVERY_CYCLE ) || \ | |||
| @@ -2223,11 +2351,11 @@ HAL_FDCAN_StateTypeDef HAL_FDCAN_GetState(FDCAN_HandleTypeDef* hfdcan); | |||
| #define IS_FDCAN_TT_CYCLE_START_SYNC(SYNC) (((SYNC) == FDCAN_TT_NO_SYNC_PULSE ) || \ | |||
| ((SYNC) == FDCAN_TT_SYNC_BASIC_CYCLE_START) || \ | |||
| ((SYNC) == FDCAN_TT_SYNC_MATRIX_START )) | |||
| #define IS_FDCAN_TT_TX_ENABLE_WINDOW(NTU) (((NTU) >= 1) && ((NTU) <= 16)) | |||
| #define IS_FDCAN_TT_TUR_NUMERATOR(NUMERATOR) (((NUMERATOR) >= 0x10000) && ((NUMERATOR) <= 0x1FFFF)) | |||
| #define IS_FDCAN_TT_TUR_DENOMINATOR(DENOMINATOR) (((DENOMINATOR) >= 0x0001) && ((DENOMINATOR) <= 0x3FFF)) | |||
| #define IS_FDCAN_TT_TUR_LEVEL_1(NC,DC) ((NC) >= (4 * (DC))) | |||
| #define IS_FDCAN_TT_TUR_LEVEL_0_2(NC,DC) ((NC) >= (8 * (DC))) | |||
| #define IS_FDCAN_TT_TX_ENABLE_WINDOW(NTU) (((NTU) >= 1U) && ((NTU) <= 16U)) | |||
| #define IS_FDCAN_TT_TUR_NUMERATOR(NUMERATOR) (((NUMERATOR) >= 0x10000U) && ((NUMERATOR) <= 0x1FFFFU)) | |||
| #define IS_FDCAN_TT_TUR_DENOMINATOR(DENOMINATOR) (((DENOMINATOR) >= 0x0001U) && ((DENOMINATOR) <= 0x3FFFU)) | |||
| #define IS_FDCAN_TT_TUR_LEVEL_1(NC,DC) ((NC) >= (4U * (DC))) | |||
| #define IS_FDCAN_TT_TUR_LEVEL_0_2(NC,DC) ((NC) >= (8U * (DC))) | |||
| #define IS_FDCAN_TT_STOP_WATCH_TRIGGER(TRIGGER) (((TRIGGER) == FDCAN_TT_STOP_WATCH_TRIGGER_0) || \ | |||
| ((TRIGGER) == FDCAN_TT_STOP_WATCH_TRIGGER_1) || \ | |||
| ((TRIGGER) == FDCAN_TT_STOP_WATCH_TRIGGER_2) || \ | |||
| @@ -2236,13 +2364,13 @@ HAL_FDCAN_StateTypeDef HAL_FDCAN_GetState(FDCAN_HandleTypeDef* hfdcan); | |||
| ((TRIGGER) == FDCAN_TT_EVENT_TRIGGER_1) || \ | |||
| ((TRIGGER) == FDCAN_TT_EVENT_TRIGGER_2) || \ | |||
| ((TRIGGER) == FDCAN_TT_EVENT_TRIGGER_3)) | |||
| #define IS_FDCAN_TT_TIME_PRESET(TIME) (((TIME) <= 0xFFFF) && ((TIME) != 0x8000)) | |||
| #define IS_FDCAN_TT_TIME_PRESET(TIME) (((TIME) <= 0xFFFFU) && ((TIME) != 0x8000U)) | |||
| #define IS_FDCAN_TT_STOP_WATCH_SOURCE(SOURCE) (((SOURCE) == FDCAN_TT_STOP_WATCH_DISABLED ) || \ | |||
| ((SOURCE) == FDCAN_TT_STOP_WATCH_CYCLE_TIME ) || \ | |||
| ((SOURCE) == FDCAN_TT_STOP_WATCH_LOCAL_TIME ) || \ | |||
| ((SOURCE) == FDCAN_TT_STOP_WATCH_GLOBAL_TIME)) | |||
| #define IS_FDCAN_TT_STOP_WATCH_POLARITY(POLARITY) (((POLARITY) == FDCAN_TT_STOP_WATCH_DISABLED ) || \ | |||
| ((POLARITY) == FDCAN_TT_STOP_WATCH_GLOBAL_TIME)) | |||
| #define IS_FDCAN_TT_STOP_WATCH_POLARITY(POLARITY) (((POLARITY) == FDCAN_TT_STOP_WATCH_RISING ) || \ | |||
| ((POLARITY) == FDCAN_TT_STOP_WATCH_FALLING)) | |||
| #define IS_FDCAN_TT_REGISTER_TIME_MARK_SOURCE(SOURCE) (((SOURCE) == FDCAN_TT_REG_TIMEMARK_DIABLED ) || \ | |||
| ((SOURCE) == FDCAN_TT_REG_TIMEMARK_CYC_TIME) || \ | |||
| ((SOURCE) == FDCAN_TT_REG_TIMEMARK_LOC_TIME) || \ | |||
| @@ -2280,7 +2408,7 @@ HAL_FDCAN_StateTypeDef HAL_FDCAN_GetState(FDCAN_HandleTypeDef* hfdcan); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_FDCAN_H */ | |||
| #endif /* STM32H7xx_HAL_FDCAN_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_flash.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of FLASH HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_FLASH_H | |||
| #define __STM32H7xx_HAL_FLASH_H | |||
| #ifndef STM32H7xx_HAL_FLASH_H | |||
| #define STM32H7xx_HAL_FLASH_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -84,7 +66,7 @@ typedef struct | |||
| __IO uint32_t NbSectorsToErase; /*!< Internal variable to save the remaining sectors to erase in IT context */ | |||
| __IO uint8_t VoltageForErase; /*!< Internal variable to provide voltage range selected by user in IT context */ | |||
| __IO uint32_t VoltageForErase; /*!< Internal variable to provide voltage range selected by user in IT context */ | |||
| __IO uint32_t Sector; /*!< Internal variable to define the current sector which is erasing */ | |||
| @@ -109,41 +91,42 @@ typedef struct | |||
| * @brief FLASH Error Code | |||
| * @{ | |||
| */ | |||
| #define HAL_FLASH_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */ | |||
| #define HAL_FLASH_ERROR_WRP ((uint32_t)0x00000001U) /*!< Write Protection Error */ | |||
| #define HAL_FLASH_ERROR_PGS ((uint32_t)0x00000002U) /*!< Program Sequence Error */ | |||
| #define HAL_FLASH_ERROR_STRB ((uint32_t)0x00000004U) /*!< Strobe Error */ | |||
| #define HAL_FLASH_ERROR_INC ((uint32_t)0x00000008U) /*!< Inconsistency Error */ | |||
| #define HAL_FLASH_ERROR_OPE ((uint32_t)0x00000010U) /*!< Operation Error */ | |||
| #define HAL_FLASH_ERROR_RDP ((uint32_t)0x00000020U) /*!< Read Protection Error */ | |||
| #define HAL_FLASH_ERROR_RDS ((uint32_t)0x00000040U) /*!< Read Secured Error */ | |||
| #define HAL_FLASH_ERROR_SNECC ((uint32_t)0x00000080U) /*!< Single Detection ECC */ | |||
| #define HAL_FLASH_ERROR_DBECC ((uint32_t)0x00000100U) /*!< Double Detection ECC */ | |||
| #define HAL_FLASH_ERROR_WRP_BANK1 ((uint32_t)0x00000001U) /*!< Write Protection Error on Bank 1 */ | |||
| #define HAL_FLASH_ERROR_PGS_BANK1 ((uint32_t)0x00000002U) /*!< Program Sequence Error on Bank 1 */ | |||
| #define HAL_FLASH_ERROR_STRB_BANK1 ((uint32_t)0x00000004U) /*!< Strobe Error on Bank 1 */ | |||
| #define HAL_FLASH_ERROR_INC_BANK1 ((uint32_t)0x00000008U) /*!< Inconsistency Error on Bank 1 */ | |||
| #define HAL_FLASH_ERROR_OPE_BANK1 ((uint32_t)0x00000010U) /*!< Operation Error on Bank 1 */ | |||
| #define HAL_FLASH_ERROR_RDP_BANK1 ((uint32_t)0x00000020U) /*!< Read Protection Error on Bank 1 */ | |||
| #define HAL_FLASH_ERROR_RDS_BANK1 ((uint32_t)0x00000040U) /*!< Read Secured Error on Bank 1 */ | |||
| #define HAL_FLASH_ERROR_SNECC_BANK1 ((uint32_t)0x00000080U) /*!< Single Detection ECC on Bank 1 */ | |||
| #define HAL_FLASH_ERROR_DBECC_BANK1 ((uint32_t)0x00000100U) /*!< Double Detection ECC on Bank 1 */ | |||
| #define HAL_FLASH_ERROR_WRP_BANK2 ((uint32_t)0x00001000U) /*!< Write Protection Error on Bank 2 */ | |||
| #define HAL_FLASH_ERROR_PGS_BANK2 ((uint32_t)0x00002000U) /*!< Program Sequence Error on Bank 2 */ | |||
| #define HAL_FLASH_ERROR_STRB_BANK2 ((uint32_t)0x00004000U) /*!< Strobe Error on Bank 2 */ | |||
| #define HAL_FLASH_ERROR_INC_BANK2 ((uint32_t)0x00008000U) /*!< Inconsistency Error on Bank 2 */ | |||
| #define HAL_FLASH_ERROR_OPE_BANK2 ((uint32_t)0x00010000U) /*!< Operation Error on Bank 2 */ | |||
| #define HAL_FLASH_ERROR_RDP_BANK2 ((uint32_t)0x00020000U) /*!< Read Protection Error on Bank 2 */ | |||
| #define HAL_FLASH_ERROR_RDS_BANK2 ((uint32_t)0x00040000U) /*!< Read Secured Error on Bank 2 */ | |||
| #define HAL_FLASH_ERROR_SNECC_BANK2 ((uint32_t)0x00080000U) /*!< Single Detection ECC on Bank 2 */ | |||
| #define HAL_FLASH_ERROR_DBECC_BANK2 ((uint32_t)0x00100000U) /*!< Double Detection ECC on Bank 2 */ | |||
| #define HAL_FLASH_ERROR_OB_CHANGE ((uint32_t)0x01000000U) /*!< Option Byte Change Error */ | |||
| #define HAL_FLASH_ERROR_NONE 0x00000000U /*!< No error */ | |||
| #define HAL_FLASH_ERROR_WRP FLASH_FLAG_WRPERR /*!< Write Protection Error */ | |||
| #define HAL_FLASH_ERROR_PGS FLASH_FLAG_PGSERR /*!< Program Sequence Error */ | |||
| #define HAL_FLASH_ERROR_STRB FLASH_FLAG_STRBERR /*!< Strobe Error */ | |||
| #define HAL_FLASH_ERROR_INC FLASH_FLAG_INCERR /*!< Inconsistency Error */ | |||
| #define HAL_FLASH_ERROR_OPE FLASH_FLAG_OPERR /*!< Operation Error */ | |||
| #define HAL_FLASH_ERROR_RDP FLASH_FLAG_RDPERR /*!< Read Protection Error */ | |||
| #define HAL_FLASH_ERROR_RDS FLASH_FLAG_RDSERR /*!< Read Secured Error */ | |||
| #define HAL_FLASH_ERROR_SNECC FLASH_FLAG_SNECCERR /*!< ECC Single Correction Error */ | |||
| #define HAL_FLASH_ERROR_DBECC FLASH_FLAG_DBECCERR /*!< ECC Double Detection Error */ | |||
| #define HAL_FLASH_ERROR_CRCRD FLASH_FLAG_CRCRDERR /*!< CRC Read Error */ | |||
| #define HAL_FLASH_ERROR_WRP_BANK1 FLASH_FLAG_WRPERR_BANK1 /*!< Write Protection Error on Bank 1 */ | |||
| #define HAL_FLASH_ERROR_PGS_BANK1 FLASH_FLAG_PGSERR_BANK1 /*!< Program Sequence Error on Bank 1 */ | |||
| #define HAL_FLASH_ERROR_STRB_BANK1 FLASH_FLAG_STRBERR_BANK1 /*!< Strobe Error on Bank 1 */ | |||
| #define HAL_FLASH_ERROR_INC_BANK1 FLASH_FLAG_INCERR_BANK1 /*!< Inconsistency Error on Bank 1 */ | |||
| #define HAL_FLASH_ERROR_OPE_BANK1 FLASH_FLAG_OPERR_BANK1 /*!< Operation Error on Bank 1 */ | |||
| #define HAL_FLASH_ERROR_RDP_BANK1 FLASH_FLAG_RDPERR_BANK1 /*!< Read Protection Error on Bank 1 */ | |||
| #define HAL_FLASH_ERROR_RDS_BANK1 FLASH_FLAG_RDSERR_BANK1 /*!< Read Secured Error on Bank 1 */ | |||
| #define HAL_FLASH_ERROR_SNECC_BANK1 FLASH_FLAG_SNECCERR_BANK1 /*!< ECC Single Correction Error on Bank 1 */ | |||
| #define HAL_FLASH_ERROR_DBECC_BANK1 FLASH_FLAG_DBECCERR_BANK1 /*!< ECC Double Detection Error on Bank 1 */ | |||
| #define HAL_FLASH_ERROR_CRCRD_BANK1 FLASH_FLAG_CRCRDERR_BANK1 /*!< CRC Read Error on Bank1 */ | |||
| #define HAL_FLASH_ERROR_WRP_BANK2 FLASH_FLAG_WRPERR_BANK2 /*!< Write Protection Error on Bank 2 */ | |||
| #define HAL_FLASH_ERROR_PGS_BANK2 FLASH_FLAG_PGSERR_BANK2 /*!< Program Sequence Error on Bank 2 */ | |||
| #define HAL_FLASH_ERROR_STRB_BANK2 FLASH_FLAG_STRBERR_BANK2 /*!< Strobe Error on Bank 2 */ | |||
| #define HAL_FLASH_ERROR_INC_BANK2 FLASH_FLAG_INCERR_BANK2 /*!< Inconsistency Error on Bank 2 */ | |||
| #define HAL_FLASH_ERROR_OPE_BANK2 FLASH_FLAG_OPERR_BANK2 /*!< Operation Error on Bank 2 */ | |||
| #define HAL_FLASH_ERROR_RDP_BANK2 FLASH_FLAG_RDPERR_BANK2 /*!< Read Protection Error on Bank 2 */ | |||
| #define HAL_FLASH_ERROR_RDS_BANK2 FLASH_FLAG_RDSERR_BANK2 /*!< Read Secured Error on Bank 2 */ | |||
| #define HAL_FLASH_ERROR_SNECC_BANK2 FLASH_FLAG_SNECCERR_BANK2 /*!< ECC Single Correction Error on Bank 2 */ | |||
| #define HAL_FLASH_ERROR_DBECC_BANK2 FLASH_FLAG_DBECCERR_BANK2 /*!< ECC Double Detection Error on Bank 2 */ | |||
| #define HAL_FLASH_ERROR_CRCRD_BANK2 FLASH_FLAG_CRCRDERR_BANK2 /*!< CRC Read Error on Bank2 */ | |||
| #define HAL_FLASH_ERROR_OB_CHANGE FLASH_OPTSR_OPTCHANGEERR /*!< Option Byte Change Error */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -151,7 +134,7 @@ typedef struct | |||
| /** @defgroup FLASH_Type_Program FLASH Type Program | |||
| * @{ | |||
| */ | |||
| #define FLASH_TYPEPROGRAM_FLASHWORD ((uint32_t)0x03U) /*!< Program a flash word (256-bit) at a specified address */ | |||
| #define FLASH_TYPEPROGRAM_FLASHWORD 0x03U /*!< Program a flash word (256-bit) at a specified address */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -160,24 +143,22 @@ typedef struct | |||
| * @brief Flag definition | |||
| * @{ | |||
| */ | |||
| #define FLASH_FLAG_BSY FLASH_SR_BSY /*!< FLASH Busy flag */ | |||
| #define FLASH_FLAG_WDW FLASH_SR_WDW /*!< Waiting for Data to Write on flag */ | |||
| #define FLASH_FLAG_QW FLASH_SR_QW /*!< Write Waiting in Operation Queue on flag */ | |||
| #define FLASH_FLAG_CRC_BUSY FLASH_SR_CRC_BUSY /*!< CRC module is working on flag */ | |||
| #define FLASH_FLAG_EOP FLASH_SR_EOP /*!< End Of Program on flag */ | |||
| #define FLASH_FLAG_WRPERR FLASH_SR_WRPERR /*!< Write Protection Error on flag */ | |||
| #define FLASH_FLAG_PGSERR FLASH_SR_PGSERR /*!< Program Sequence Error on flag */ | |||
| #define FLASH_FLAG_STRBERR FLASH_SR_STRBERR /*!< strobe Error on flag */ | |||
| #define FLASH_FLAG_INCERR FLASH_SR_INCERR /*!< Inconsistency Error on flag */ | |||
| #define FLASH_FLAG_OPERR FLASH_SR_OPERR /*!< Operation Error on flag */ | |||
| #define FLASH_FLAG_RDPERR FLASH_SR_RDPERR /*!< Read Protection Error on flag */ | |||
| #define FLASH_FLAG_RDSERR FLASH_SR_RDSERR /*!< Read Secured Error on flag */ | |||
| #define FLASH_FLAG_SNECCERR FLASH_SR_SNECCERR /*!< Single ECC Error Correction on flag */ | |||
| #define FLASH_FLAG_DBECCERR FLASH_SR_DBECCERR /*!< Double Detection ECC Error on flag */ | |||
| #define FLASH_FLAG_CRCEND FLASH_SR_CRCEND /*!< CRC module completes on bank flag */ | |||
| #define FLASH_FLAG_BSY FLASH_SR_BSY /*!< FLASH Busy flag */ | |||
| #define FLASH_FLAG_WDW FLASH_SR_WDW /*!< Waiting for Data to Write on flag */ | |||
| #define FLASH_FLAG_QW FLASH_SR_QW /*!< Write Waiting in Operation Queue on flag */ | |||
| #define FLASH_FLAG_CRC_BUSY FLASH_SR_CRC_BUSY /*!< CRC module is working on flag */ | |||
| #define FLASH_FLAG_EOP FLASH_SR_EOP /*!< End Of Program on flag */ | |||
| #define FLASH_FLAG_WRPERR FLASH_SR_WRPERR /*!< Write Protection Error on flag */ | |||
| #define FLASH_FLAG_PGSERR FLASH_SR_PGSERR /*!< Program Sequence Error on flag */ | |||
| #define FLASH_FLAG_STRBERR FLASH_SR_STRBERR /*!< strobe Error on flag */ | |||
| #define FLASH_FLAG_INCERR FLASH_SR_INCERR /*!< Inconsistency Error on flag */ | |||
| #define FLASH_FLAG_OPERR FLASH_SR_OPERR /*!< Operation Error on flag */ | |||
| #define FLASH_FLAG_RDPERR FLASH_SR_RDPERR /*!< Read Protection Error on flag */ | |||
| #define FLASH_FLAG_RDSERR FLASH_SR_RDSERR /*!< Read Secured Error on flag */ | |||
| #define FLASH_FLAG_SNECCERR FLASH_SR_SNECCERR /*!< Single ECC Error Correction on flag */ | |||
| #define FLASH_FLAG_DBECCERR FLASH_SR_DBECCERR /*!< Double Detection ECC Error on flag */ | |||
| #define FLASH_FLAG_CRCEND FLASH_SR_CRCEND /*!< CRC module completes on bank flag */ | |||
| #define FLASH_FLAG_CRCRDERR FLASH_SR_CRCRDERR /*!< CRC Read Error on bank flag */ | |||
| #define FLASH_FLAG_BSY_BANK1 FLASH_SR_BSY /*!< FLASH Bank 1 Busy flag */ | |||
| #define FLASH_FLAG_WBNE_BANK1 FLASH_SR_WBNE /*!< Waiting for Data to Write on Bank 1 flag */ | |||
| @@ -186,23 +167,23 @@ typedef struct | |||
| #define FLASH_FLAG_EOP_BANK1 FLASH_SR_EOP /*!< End Of Program on Bank 1 flag */ | |||
| #define FLASH_FLAG_WRPERR_BANK1 FLASH_SR_WRPERR /*!< Write Protection Error on Bank 1 flag */ | |||
| #define FLASH_FLAG_PGSERR_BANK1 FLASH_SR_PGSERR /*!< Program Sequence Error on Bank 1 flag */ | |||
| #define FLASH_FLAG_STRBER_BANK1R FLASH_SR_STRBERR /*!< strobe Error on Bank 1 flag */ | |||
| #define FLASH_FLAG_STRBERR_BANK1 FLASH_SR_STRBERR /*!< strobe Error on Bank 1 flag */ | |||
| #define FLASH_FLAG_INCERR_BANK1 FLASH_SR_INCERR /*!< Inconsistency Error on Bank 1 flag */ | |||
| #define FLASH_FLAG_OPERR_BANK1 FLASH_SR_OPERR /*!< Operation Error on Bank 1 flag */ | |||
| #define FLASH_FLAG_RDPERR_BANK1 FLASH_SR_RDPERR /*!< Read Protection Error on Bank 1 flag */ | |||
| #define FLASH_FLAG_RDSERR_BANK1 FLASH_SR_RDSERR /*!< Read Secured Error on Bank 1 flag */ | |||
| #define FLASH_FLAG_SNECCE_BANK1RR FLASH_SR_SNECCERR /*!< Single ECC Error Correction on Bank 1 flag */ | |||
| #define FLASH_FLAG_DBECCE_BANK1RR FLASH_SR_DBECCERR /*!< Double Detection ECC Error on Bank 1 flag */ | |||
| #define FLASH_FLAG_SNECCERR_BANK1 FLASH_SR_SNECCERR /*!< Single ECC Error Correction on Bank 1 flag */ | |||
| #define FLASH_FLAG_DBECCERR_BANK1 FLASH_SR_DBECCERR /*!< Double Detection ECC Error on Bank 1 flag */ | |||
| #define FLASH_FLAG_CRCEND_BANK1 FLASH_SR_CRCEND /*!< CRC module completes on bank Bank 1 flag */ | |||
| #define FLASH_FLAG_CRCRDERR_BANK1 FLASH_SR_CRCRDERR /*!< CRC Read error on Bank 1 flag */ | |||
| #define FLASH_FLAG_ALL_ERRORS_BANK1 (FLASH_FLAG_WRPERR_BANK1 | FLASH_FLAG_PGSERR_BANK1 | \ | |||
| FLASH_FLAG_STRBERR_BANK1 | FLASH_FLAG_INCERR_BANK1 | \ | |||
| FLASH_FLAG_OPERR_BANK1 | FLASH_FLAG_RDPERR_BANK1 | \ | |||
| FLASH_FLAG_RDSERR_BANK1 | FLASH_FLAG_SNECCERR_BANK1 | \ | |||
| FLASH_FLAG_DBECCERR_BANK1 | FLASH_FLAG_CRCRDERR_BANK1) | |||
| #define FLASH_FLAG_ALL_ERRORS_BANK1 (FLASH_FLAG_WRPERR_BANK1 | FLASH_FLAG_PGSERR_BANK1 | \ | |||
| FLASH_FLAG_STRBER_BANK1R | FLASH_FLAG_INCERR_BANK1 | \ | |||
| FLASH_FLAG_OPERR_BANK1 | FLASH_FLAG_RDPERR_BANK1 | \ | |||
| FLASH_FLAG_RDSERR_BANK1 | FLASH_FLAG_SNECCE_BANK1RR | \ | |||
| FLASH_FLAG_DBECCE_BANK1RR) | |||
| #define FLASH_FLAG_ALL_BANK1 (FLASH_FLAG_BSY_BANK1 | FLASH_FLAG_WBNE_BANK1 | \ | |||
| #define FLASH_FLAG_ALL_BANK1 (FLASH_FLAG_BSY_BANK1 | FLASH_FLAG_WBNE_BANK1 | \ | |||
| FLASH_FLAG_QW_BANK1 | FLASH_FLAG_CRC_BUSY_BANK1 | \ | |||
| FLASH_FLAG_EOP_BANK1 | FLASH_FLAG_CRCEND_BANK1 | \ | |||
| FLASH_FLAG_ALL_ERRORS_BANK1) | |||
| @@ -214,29 +195,26 @@ typedef struct | |||
| #define FLASH_FLAG_EOP_BANK2 (FLASH_SR_EOP | 0x80000000U) /*!< End Of Program on Bank 2 flag */ | |||
| #define FLASH_FLAG_WRPERR_BANK2 (FLASH_SR_WRPERR | 0x80000000U) /*!< Write Protection Error on Bank 2 flag */ | |||
| #define FLASH_FLAG_PGSERR_BANK2 (FLASH_SR_PGSERR | 0x80000000U) /*!< Program Sequence Error on Bank 2 flag */ | |||
| #define FLASH_FLAG_STRBER_BANK2R (FLASH_SR_STRBERR | 0x80000000U) /*!< Strobe Error on Bank 2 flag */ | |||
| #define FLASH_FLAG_STRBERR_BANK2 (FLASH_SR_STRBERR | 0x80000000U) /*!< Strobe Error on Bank 2 flag */ | |||
| #define FLASH_FLAG_INCERR_BANK2 (FLASH_SR_INCERR | 0x80000000U) /*!< Inconsistency Error on Bank 2 flag */ | |||
| #define FLASH_FLAG_OPERR_BANK2 (FLASH_SR_OPERR | 0x80000000U) /*!< Operation Error on Bank 2 flag */ | |||
| #define FLASH_FLAG_RDPERR_BANK2 (FLASH_SR_RDPERR | 0x80000000U) /*!< Read Protection Error on Bank 2 flag */ | |||
| #define FLASH_FLAG_RDSERR_BANK2 (FLASH_SR_RDSERR | 0x80000000U) /*!< Read Secured Error on Bank 2 flag */ | |||
| #define FLASH_FLAG_SNECCE_BANK2RR (FLASH_SR_SNECCERR | 0x80000000U) /*!< Single ECC Error Correction on Bank 2 flag */ | |||
| #define FLASH_FLAG_DBECCE_BANK2RR (FLASH_SR_DBECCERR | 0x80000000U) /*!< Double Detection ECC Error on Bank 2 flag */ | |||
| #define FLASH_FLAG_SNECCERR_BANK2 (FLASH_SR_SNECCERR | 0x80000000U) /*!< Single ECC Error Correction on Bank 2 flag */ | |||
| #define FLASH_FLAG_DBECCERR_BANK2 (FLASH_SR_DBECCERR | 0x80000000U) /*!< Double Detection ECC Error on Bank 2 flag */ | |||
| #define FLASH_FLAG_CRCEND_BANK2 (FLASH_SR_CRCEND | 0x80000000U) /*!< CRC module completes on bank Bank 2 flag */ | |||
| #define FLASH_FLAG_CRCRDERR_BANK2 (FLASH_SR_CRCRDERR | 0x80000000U) /*!< CRC Read error on Bank 2 flag */ | |||
| #define FLASH_FLAG_ALL_ERRORS_BANK2 (FLASH_FLAG_WRPERR_BANK2 | FLASH_FLAG_PGSERR_BANK2 | \ | |||
| FLASH_FLAG_STRBERR_BANK2 | FLASH_FLAG_INCERR_BANK2 | \ | |||
| FLASH_FLAG_OPERR_BANK2 | FLASH_FLAG_RDPERR_BANK2 | \ | |||
| FLASH_FLAG_RDSERR_BANK2 | FLASH_FLAG_SNECCERR_BANK2 | \ | |||
| FLASH_FLAG_DBECCERR_BANK2 | FLASH_FLAG_CRCRDERR_BANK2) | |||
| #define FLASH_FLAG_ALL_ERRORS_BANK2 (FLASH_FLAG_WRPERR_BANK2 | FLASH_FLAG_PGSERR_BANK2 | \ | |||
| FLASH_FLAG_STRBER_BANK2R | FLASH_FLAG_INCERR_BANK2 | \ | |||
| FLASH_FLAG_OPERR_BANK2 | FLASH_FLAG_RDPERR_BANK2 | \ | |||
| FLASH_FLAG_RDSERR_BANK2 | FLASH_FLAG_SNECCE_BANK2RR | \ | |||
| FLASH_FLAG_DBECCE_BANK2RR) | |||
| #define FLASH_FLAG_ALL_BANK2 (FLASH_FLAG_BSY_BANK2 | FLASH_FLAG_WBNE_BANK2 | \ | |||
| #define FLASH_FLAG_ALL_BANK2 (FLASH_FLAG_BSY_BANK2 | FLASH_FLAG_WBNE_BANK2 | \ | |||
| FLASH_FLAG_QW_BANK2 | FLASH_FLAG_CRC_BUSY_BANK2 | \ | |||
| FLASH_FLAG_EOP_BANK2 | FLASH_FLAG_CRCEND_BANK2 | \ | |||
| FLASH_FLAG_ALL_ERRORS_BANK2) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -245,7 +223,6 @@ typedef struct | |||
| * @brief FLASH Interrupt definition | |||
| * @{ | |||
| */ | |||
| #define FLASH_IT_EOP_BANK1 FLASH_CR_EOPIE /*!< End of FLASH Bank 1 Operation Interrupt source */ | |||
| #define FLASH_IT_WRPERR_BANK1 FLASH_CR_WRPERRIE /*!< Write Protection Error on Bank 1 Interrupt source */ | |||
| #define FLASH_IT_PGSERR_BANK1 FLASH_CR_PGSERRIE /*!< Program Sequence Error on Bank 1 Interrupt source */ | |||
| @@ -257,13 +234,14 @@ typedef struct | |||
| #define FLASH_IT_SNECCERR_BANK1 FLASH_CR_SNECCERRIE /*!< Single ECC Error Correction on Bank 1 Interrupt source */ | |||
| #define FLASH_IT_DBECCERR_BANK1 FLASH_CR_DBECCERRIE /*!< Double Detection ECC Error on Bank 1 Interrupt source */ | |||
| #define FLASH_IT_CRCEND_BANK1 FLASH_CR_CRCENDIE /*!< CRC End on Bank 1 Interrupt source */ | |||
| #define FLASH_IT_CRCRDERR_BANK1 FLASH_CR_CRCRDERRIE /*!< CRC Read error on Bank 1 Interrupt source */ | |||
| #define FLASH_IT_ALL_BANK1 (FLASH_IT_EOP_BANK1 | FLASH_IT_WRPERR_BANK1 | \ | |||
| FLASH_IT_PGSERR_BANK1 | FLASH_IT_STRBERR_BANK1 | \ | |||
| FLASH_IT_INCERR_BANK1 | FLASH_IT_OPERR_BANK1 | \ | |||
| FLASH_IT_RDPERR_BANK1 | FLASH_IT_RDSERR_BANK1 | \ | |||
| FLASH_CR_SNECCERRIE | FLASH_CR_DBECCERRIE | \ | |||
| FLASH_CR_CRCENDIE ) | |||
| FLASH_IT_SNECCERR_BANK1 | FLASH_IT_DBECCERR_BANK1 | \ | |||
| FLASH_IT_CRCEND_BANK1 | FLASH_IT_CRCRDERR_BANK1) | |||
| #define FLASH_IT_EOP_BANK2 (FLASH_CR_EOPIE | 0x80000000U) /*!< End of FLASH Bank 2 Operation Interrupt source */ | |||
| #define FLASH_IT_WRPERR_BANK2 (FLASH_CR_WRPERRIE | 0x80000000U) /*!< Write Protection Error on Bank 2 Interrupt source */ | |||
| @@ -276,14 +254,14 @@ typedef struct | |||
| #define FLASH_IT_SNECCERR_BANK2 (FLASH_CR_SNECCERRIE | 0x80000000U) /*!< Single ECC Error Correction on Bank 2 Interrupt source */ | |||
| #define FLASH_IT_DBECCERR_BANK2 (FLASH_CR_DBECCERRIE | 0x80000000U) /*!< Double Detection ECC Error on Bank 2 Interrupt source */ | |||
| #define FLASH_IT_CRCEND_BANK2 (FLASH_CR_CRCENDIE | 0x80000000U) /*!< CRC End on Bank 2 Interrupt source */ | |||
| #define FLASH_IT_CRCRDERR_BANK2 (FLASH_CR_CRCRDERRIE | 0x80000000U) /*!< CRC Read Error on Bank 2 Interrupt source */ | |||
| #define FLASH_IT_ALL_BANK2 (FLASH_IT_EOP_BANK2 | FLASH_IT_WRPERR_BANK1 | \ | |||
| FLASH_IT_PGSERR_BANK2 | FLASH_IT_STRBERR_BANK1 | \ | |||
| FLASH_IT_INCERR_BANK2 | FLASH_IT_OPERR_BANK1 | \ | |||
| FLASH_IT_RDPERR_BANK2 | FLASH_IT_RDSERR_BANK1 | \ | |||
| FLASH_CR_SNECCERRIE | FLASH_CR_DBECCERRIE | \ | |||
| FLASH_CR_CRCENDIE ) | |||
| #define FLASH_IT_ALL_BANK2 (FLASH_IT_EOP_BANK2 | FLASH_IT_WRPERR_BANK2 | \ | |||
| FLASH_IT_PGSERR_BANK2 | FLASH_IT_STRBERR_BANK2 | \ | |||
| FLASH_IT_INCERR_BANK2 | FLASH_IT_OPERR_BANK2 | \ | |||
| FLASH_IT_RDPERR_BANK2 | FLASH_IT_RDSERR_BANK2 | \ | |||
| FLASH_IT_SNECCERR_BANK2 | FLASH_IT_DBECCERR_BANK2 | \ | |||
| FLASH_IT_CRCEND_BANK2 | FLASH_IT_CRCRDERR_BANK2) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -291,11 +269,10 @@ typedef struct | |||
| /** @defgroup FLASH_Program_Parallelism FLASH Program Parallelism | |||
| * @{ | |||
| */ | |||
| #define FLASH_PSIZE_BYTE ((uint32_t)0x00000000U) | |||
| #define FLASH_PSIZE_HALF_WORD ((uint32_t)FLASH_CR_PSIZE_0) | |||
| #define FLASH_PSIZE_WORD ((uint32_t)FLASH_CR_PSIZE_1) | |||
| #define FLASH_PSIZE_DOUBLE_WORD ((uint32_t)FLASH_CR_PSIZE) | |||
| #define CR_PSIZE_MASK ((uint32_t)0xFFFFFFCFU) | |||
| #define FLASH_PSIZE_BYTE 0x00000000U /*!< Flash program/erase by 8 bits */ | |||
| #define FLASH_PSIZE_HALF_WORD FLASH_CR_PSIZE_0 /*!< Flash program/erase by 16 bits */ | |||
| #define FLASH_PSIZE_WORD FLASH_CR_PSIZE_1 /*!< Flash program/erase by 32 bits */ | |||
| #define FLASH_PSIZE_DOUBLE_WORD FLASH_CR_PSIZE /*!< Flash program/erase by 64 bits */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -304,10 +281,10 @@ typedef struct | |||
| /** @defgroup FLASH_Keys FLASH Keys | |||
| * @{ | |||
| */ | |||
| #define FLASH_KEY1 ((uint32_t)0x45670123U) | |||
| #define FLASH_KEY2 ((uint32_t)0xCDEF89ABU) | |||
| #define FLASH_OPT_KEY1 ((uint32_t)0x08192A3BU) | |||
| #define FLASH_OPT_KEY2 ((uint32_t)0x4C5D6E7FU) | |||
| #define FLASH_KEY1 0x45670123U | |||
| #define FLASH_KEY2 0xCDEF89ABU | |||
| #define FLASH_OPT_KEY1 0x08192A3BU | |||
| #define FLASH_OPT_KEY2 0x4C5D6E7FU | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -315,14 +292,14 @@ typedef struct | |||
| /** @defgroup FLASH_Sectors FLASH Sectors | |||
| * @{ | |||
| */ | |||
| #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_0 0U /*!< Sector Number 0 */ | |||
| #define FLASH_SECTOR_1 1U /*!< Sector Number 1 */ | |||
| #define FLASH_SECTOR_2 2U /*!< Sector Number 2 */ | |||
| #define FLASH_SECTOR_3 3U /*!< Sector Number 3 */ | |||
| #define FLASH_SECTOR_4 4U /*!< Sector Number 4 */ | |||
| #define FLASH_SECTOR_5 5U /*!< Sector Number 5 */ | |||
| #define FLASH_SECTOR_6 6U /*!< Sector Number 6 */ | |||
| #define FLASH_SECTOR_7 7U /*!< Sector Number 7 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -366,8 +343,9 @@ typedef struct | |||
| * @arg FLASH_IT_SNECCERR_BANK1 : Single ECC Error Correction on Bank 1 Interrupt source | |||
| * @arg FLASH_IT_DBECCERR_BANK1 : Double Detection ECC Error on Bank 1 Interrupt source | |||
| * @arg FLASH_IT_CRCEND_BANK1 : CRC End on Bank 1 Interrupt source | |||
| * @arg FLASH_IT_CRCRDERR_BANK1 : CRC Read error on Bank 1 Interrupt source | |||
| * In case of Bank 2 This parameter can be any combination of the following values: * | |||
| * In case of Bank 2, this parameter can be any combination of the following values: * | |||
| * @arg FLASH_IT_EOP_BANK2 : End of FLASH Bank 2 Operation Interrupt source | |||
| * @arg FLASH_IT_WRPERR_BANK2 : Write Protection Error on Bank 2 Interrupt source | |||
| * @arg FLASH_IT_PGSERR_BANK2 : Program Sequence Error on Bank 2 Interrupt source | |||
| @@ -379,12 +357,13 @@ typedef struct | |||
| * @arg FLASH_IT_SNECCERR_BANK2 : Single ECC Error Correction on Bank 2 Interrupt source | |||
| * @arg FLASH_IT_DBECCERR_BANK2 : Double Detection ECC Error on Bank 2 Interrupt source | |||
| * @arg FLASH_IT_CRCEND_BANK2 : CRC End on Bank 2 Interrupt source | |||
| * @arg FLASH_IT_CRCRDERR_BANK2 : CRC Read error on Bank 2 Interrupt source | |||
| * @retval none | |||
| */ | |||
| #define __HAL_FLASH_ENABLE_IT_BANK1(__INTERRUPT__) (FLASH->CR1 |= (__INTERRUPT__)) | |||
| #define __HAL_FLASH_ENABLE_IT_BANK2(__INTERRUPT__) (FLASH->CR2 |= ((__INTERRUPT__) & 0x7FFFFFFF)) | |||
| #define __HAL_FLASH_ENABLE_IT_BANK2(__INTERRUPT__) (FLASH->CR2 |= ((__INTERRUPT__) & 0x7FFFFFFFU)) | |||
| #define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) (IS_FLASH_IT_BANK1(__INTERRUPT__) ? \ | |||
| __HAL_FLASH_ENABLE_IT_BANK1(__INTERRUPT__) : \ | |||
| @@ -406,8 +385,9 @@ typedef struct | |||
| * @arg FLASH_IT_SNECCERR_BANK1 : Single ECC Error Correction on Bank 1 Interrupt source | |||
| * @arg FLASH_IT_DBECCERR_BANK1 : Double Detection ECC Error on Bank 1 Interrupt source | |||
| * @arg FLASH_IT_CRCEND_BANK1 : CRC End on Bank 1 Interrupt source | |||
| * @arg FLASH_IT_CRCRDERR_BANK1 : CRC Read error on Bank 1 Interrupt source | |||
| * In case of Bank 2 This parameter can be any combination of the following values: * | |||
| * In case of Bank 2, this parameter can be any combination of the following values: * | |||
| * @arg FLASH_IT_EOP_BANK2 : End of FLASH Bank 2 Operation Interrupt source | |||
| * @arg FLASH_IT_WRPERR_BANK2 : Write Protection Error on Bank 2 Interrupt source | |||
| * @arg FLASH_IT_PGSERR_BANK2 : Program Sequence Error on Bank 2 Interrupt source | |||
| @@ -419,13 +399,13 @@ typedef struct | |||
| * @arg FLASH_IT_SNECCERR_BANK2 : Single ECC Error Correction on Bank 2 Interrupt source | |||
| * @arg FLASH_IT_DBECCERR_BANK2 : Double Detection ECC Error on Bank 2 Interrupt source | |||
| * @arg FLASH_IT_CRCEND_BANK2 : CRC End on Bank 2 Interrupt source | |||
| * @arg FLASH_IT_CRCRDERR_BANK2 : CRC Read error on Bank 2 Interrupt source | |||
| * @retval none | |||
| */ | |||
| #define __HAL_FLASH_DISABLE_IT_BANK1(__INTERRUPT__) (FLASH->CR1 &= ~(uint32_t)(__INTERRUPT__)) | |||
| #define __HAL_FLASH_DISABLE_IT_BANK2(__INTERRUPT__) (FLASH->CR2 &= ~(uint32_t)((__INTERRUPT__) & 0x7FFFFFFF)) | |||
| #define __HAL_FLASH_DISABLE_IT_BANK2(__INTERRUPT__) (FLASH->CR2 &= ~(uint32_t)((__INTERRUPT__) & 0x7FFFFFFFU)) | |||
| #define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) (IS_FLASH_IT_BANK1(__INTERRUPT__) ? \ | |||
| __HAL_FLASH_DISABLE_IT_BANK1(__INTERRUPT__) : \ | |||
| @@ -451,6 +431,7 @@ typedef struct | |||
| * @arg FLASH_FLAG_SNECCE_BANK1 : Single ECC Error Correction on Bank 1 flag | |||
| * @arg FLASH_FLAG_DBECCE_BANK1 : Double Detection ECC Error on Bank 1 flag | |||
| * @arg FLASH_FLAG_CRCEND_BANK1 : CRC End on Bank 1 flag | |||
| * @arg FLASH_FLAG_CRCRDERR_BANK1 : CRC Read error on Bank 1 flag | |||
| * | |||
| * In case of Bank 2 This parameter can be any combination of the following values : | |||
| * @arg FLASH_FLAG_BSY_BANK2 : FLASH Bank 2 Busy flag | |||
| @@ -468,14 +449,15 @@ typedef struct | |||
| * @arg FLASH_FLAG_SNECCE_BANK2 : Single ECC Error Correction on Bank 2 flag | |||
| * @arg FLASH_FLAG_DBECCE_BANK2 : Double Detection ECC Error on Bank 2 flag | |||
| * @arg FLASH_FLAG_CRCEND_BANK2 : CRC End on Bank 2 flag | |||
| * @arg FLASH_FLAG_CRCRDERR_BANK2 : CRC Read error on Bank 2 flag | |||
| * @retval The new state of FLASH_FLAG (SET or RESET). | |||
| */ | |||
| #define __HAL_FLASH_GET_FLAG_BANK1(__FLAG__) (READ_BIT(FLASH->SR1, (__FLAG__)) == (__FLAG__)) | |||
| #define __HAL_FLASH_GET_FLAG_BANK1(__FLAG__) (READ_BIT(FLASH->SR1, (__FLAG__)) == (__FLAG__)) | |||
| #define __HAL_FLASH_GET_FLAG_BANK2(__FLAG__) (READ_BIT(FLASH->SR2, ((__FLAG__) & 0x7FFFFFFF)) == (((__FLAG__) & 0x7FFFFFFF))) | |||
| #define __HAL_FLASH_GET_FLAG_BANK2(__FLAG__) (READ_BIT(FLASH->SR2, ((__FLAG__) & 0x7FFFFFFFU)) == (((__FLAG__) & 0x7FFFFFFFU))) | |||
| #define __HAL_FLASH_GET_FLAG(__FLAG__) (IS_FLASH_FLAG_BANK1(__FLAG__) ? __HAL_FLASH_GET_FLAG_BANK1(__FLAG__) : \ | |||
| __HAL_FLASH_GET_FLAG_BANK2(__FLAG__)) | |||
| #define __HAL_FLASH_GET_FLAG(__FLAG__) (IS_FLASH_FLAG_BANK1(__FLAG__) ? __HAL_FLASH_GET_FLAG_BANK1(__FLAG__) : \ | |||
| __HAL_FLASH_GET_FLAG_BANK2(__FLAG__)) | |||
| /** | |||
| @@ -493,6 +475,7 @@ typedef struct | |||
| * @arg FLASH_FLAG_SNECCE_BANK1 : Single ECC Error Correction on Bank 1 flag | |||
| * @arg FLASH_FLAG_DBECCE_BANK1 : Double Detection ECC Error on Bank 1 flag | |||
| * @arg FLASH_FLAG_CRCEND_BANK1 : CRC End on Bank 1 flag | |||
| * @arg FLASH_FLAG_CRCRDERR_BANK1 : CRC Read error on Bank 1 flag | |||
| * | |||
| * In case of Bank 2 This parameter can be any combination of the following values : | |||
| * @arg FLASH_FLAG_EOP_BANK2 : End Of Program on Bank 2 flag | |||
| @@ -506,12 +489,13 @@ typedef struct | |||
| * @arg FLASH_FLAG_SNECCE_BANK2 : Single ECC Error Correction on Bank 2 flag | |||
| * @arg FLASH_FLAG_DBECCE_BANK2 : Double Detection ECC Error on Bank 2 flag | |||
| * @arg FLASH_FLAG_CRCEND_BANK2 : CRC End on Bank 2 flag | |||
| * @arg FLASH_FLAG_CRCRDERR_BANK2 : CRC Read error on Bank 2 flag | |||
| * @retval none | |||
| */ | |||
| #define __HAL_FLASH_CLEAR_FLAG_BANK1(__FLAG__) WRITE_REG(FLASH->CCR1, (__FLAG__)) | |||
| #define __HAL_FLASH_CLEAR_FLAG_BANK2(__FLAG__) WRITE_REG(FLASH->CCR2, ((__FLAG__) & 0x7FFFFFFF)) | |||
| #define __HAL_FLASH_CLEAR_FLAG_BANK2(__FLAG__) WRITE_REG(FLASH->CCR2, ((__FLAG__) & 0x7FFFFFFFU)) | |||
| #define __HAL_FLASH_CLEAR_FLAG(__FLAG__) (IS_FLASH_FLAG_BANK1(__FLAG__) ? __HAL_FLASH_CLEAR_FLAG_BANK1(__FLAG__) : \ | |||
| __HAL_FLASH_CLEAR_FLAG_BANK2(__FLAG__)) | |||
| @@ -531,8 +515,8 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| /* Program operation functions ***********************************************/ | |||
| HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t DataAddress); | |||
| HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t DataAddress); | |||
| HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t FlashAddress, uint32_t DataAddress); | |||
| HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t FlashAddress, uint32_t DataAddress); | |||
| /* FLASH IRQ handler method */ | |||
| void HAL_FLASH_IRQHandler(void); | |||
| /* Callbacks in non blocking modes */ | |||
| @@ -561,8 +545,6 @@ HAL_StatusTypeDef HAL_FLASH_OB_Launch(void); | |||
| */ | |||
| /* Peripheral State functions ************************************************/ | |||
| uint32_t HAL_FLASH_GetError(void); | |||
| HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout, uint32_t Bank); | |||
| HAL_StatusTypeDef FLASH_OB_WaitForLastOperation(uint32_t Timeout); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -575,7 +557,7 @@ HAL_StatusTypeDef FLASH_OB_WaitForLastOperation(uint32_t Timeout); | |||
| /** @defgroup FLASH_Private_Variables FLASH Private Variables | |||
| * @{ | |||
| */ | |||
| extern FLASH_ProcessTypeDef pFlash; | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -584,7 +566,6 @@ HAL_StatusTypeDef FLASH_OB_WaitForLastOperation(uint32_t Timeout); | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -605,9 +586,9 @@ HAL_StatusTypeDef FLASH_OB_WaitForLastOperation(uint32_t Timeout); | |||
| * @{ | |||
| */ | |||
| #define IS_FLASH_IT_BANK1(IT) (((IT) & FLASH_IT_ALL_BANK1) == (IT)) | |||
| #define IS_FLASH_IT_BANK1(IT) (((IT) & FLASH_IT_ALL_BANK1) == (IT)) | |||
| #define IS_FLASH_IT_BANK2(IT) (((IT) & FLASH_IT_ALL_BANK2) == (IT)) | |||
| #define IS_FLASH_IT_BANK2(IT) (((IT) & FLASH_IT_ALL_BANK2) == (IT)) | |||
| /** | |||
| * @} | |||
| @@ -621,8 +602,8 @@ HAL_StatusTypeDef FLASH_OB_WaitForLastOperation(uint32_t Timeout); | |||
| * @{ | |||
| */ | |||
| #define IS_FLASH_PROGRAM_ADDRESS_BANK1(ADDRESS) (((ADDRESS) >= FLASH_BANK1_BASE) && ((ADDRESS) < (FLASH_BANK1_BASE + FLASH_BANK_SIZE) )) | |||
| #define IS_FLASH_PROGRAM_ADDRESS_BANK2(ADDRESS) (((ADDRESS) >= FLASH_BANK2_BASE ) && ((ADDRESS) < (FLASH_BANK2_BASE + FLASH_BANK_SIZE) )) | |||
| #define IS_FLASH_PROGRAM_ADDRESS_BANK1(ADDRESS) (((ADDRESS) >= FLASH_BANK1_BASE) && ((ADDRESS) < FLASH_BANK2_BASE)) | |||
| #define IS_FLASH_PROGRAM_ADDRESS_BANK2(ADDRESS) (((ADDRESS) >= FLASH_BANK2_BASE ) && ((ADDRESS) <= FLASH_END)) | |||
| #define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (IS_FLASH_PROGRAM_ADDRESS_BANK1(ADDRESS) || IS_FLASH_PROGRAM_ADDRESS_BANK2(ADDRESS)) | |||
| #define IS_BOOT_ADDRESS(ADDRESS) ((ADDRESS) <= (0x3FFF0000U)) | |||
| @@ -645,7 +626,9 @@ HAL_StatusTypeDef FLASH_OB_WaitForLastOperation(uint32_t Timeout); | |||
| /** @defgroup FLASH_Private_Functions FLASH Private functions | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout, uint32_t Bank); | |||
| HAL_StatusTypeDef FLASH_OB_WaitForLastOperation(uint32_t Timeout); | |||
| HAL_StatusTypeDef FLASH_CRC_WaitForLastOperation(uint32_t Timeout, uint32_t Bank); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -662,6 +645,6 @@ HAL_StatusTypeDef FLASH_OB_WaitForLastOperation(uint32_t Timeout); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_FLASH_H */ | |||
| #endif /* STM32H7xx_HAL_FLASH_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32H7xx_hal_flash_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of FLASH HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_FLASH_EX_H | |||
| #define __STM32H7xx_HAL_FLASH_EX_H | |||
| #ifndef STM32H7xx_HAL_FLASH_EX_H | |||
| #define STM32H7xx_HAL_FLASH_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -105,10 +87,12 @@ typedef struct | |||
| uint32_t USERType; /*!< User option byte(s) to be configured (used for OPTIONBYTE_USER). | |||
| This parameter can be a combination of @ref FLASHEx_OB_USER_Type */ | |||
| uint32_t USERConfig; /*!< Program the FLASH User Option Byte: WWDG_SW / IWDG_SW / RST_STOP / RST_STDBY / | |||
| IWDG_FREEZE_STOP / IWDG_FREEZE_SANDBY. */ | |||
| uint32_t USERConfig; /*!< Program the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY / | |||
| IWDG_FREEZE_STOP / IWDG_FREEZE_SANDBY / IO_HSLV / SWAP_BANK_OPT */ | |||
| uint32_t Banks; /*!< Select banks for WRP , PCROP and secure area config . | |||
| This parameter must be a value of @ref FLASHEx_Banks */ | |||
| uint32_t PCROPConfig; /*!< specifies if the PCROP area shall be erased or not | |||
| when RDP level decreased from Level 1 to Level 0 or during a mass erase. | |||
| This parameter must be a value of @ref FLASHEx_OB_PCROP_RDP enumeration */ | |||
| @@ -127,19 +111,58 @@ typedef struct | |||
| uint32_t BootAddr1; /*!< Boot Address 1. | |||
| This parameter must be a value between begin and end of a bank */ | |||
| #if defined(DUAL_CORE) | |||
| uint32_t CM4BootConfig; /*!< specifies if the CM4 boot Address to be configured BOOT_ADD0, BOOT_ADD1 | |||
| or both. | |||
| This parameter must be a value of @ref FLASHEx_OB_BOOT_OPTION enumeration */ | |||
| uint32_t CM4BootAddr0; /*!< CM4 Boot Address 0. | |||
| This parameter must be a value between begin and end of a bank */ | |||
| uint32_t CM4BootAddr1; /*!< CM4 Boot Address 1. | |||
| This parameter must be a value between begin and end of a bank */ | |||
| #endif /*DUAL_CORE*/ | |||
| uint32_t SecureAreaConfig; /*!< specifies if the bank secured area shall be erased or not | |||
| when RDP level decreased from Level 1 to Level 0 or during a mass erase. | |||
| This parameter must be a value of @ref FLASHEx_OB_SECURE_RDP enumeration */ | |||
| uint32_t SecureAreaStartAddr; /*!< Bank Secure area Start address. | |||
| This parameter must be a value between begin and end of bank1 */ | |||
| This parameter must be a value between begin address and end address of bank1 */ | |||
| uint32_t SecureAreaEndAddr; /*!< Bank Secure area End address . | |||
| This parameter must be a value between Start address and end of a bank1 */ | |||
| This parameter must be a value between Secure Area Start address and end address of a bank1 */ | |||
| } FLASH_OBProgramInitTypeDef; | |||
| /** | |||
| * @brief FLASH Erase structure definition | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t TypeCRC; /*!< CRC Selection Type. | |||
| This parameter can be a value of @ref FLASHEx_CRC_Selection_Type */ | |||
| uint32_t BurstSize; /*!< CRC Burst Size. | |||
| This parameter can be a value of @ref FLASHEx_CRC_Burst_Size */ | |||
| uint32_t Bank; /*!< Select bank where CRC computation is enabled. | |||
| This parameter must be FLASH_BANK_1 or FLASH_BANK_2 */ | |||
| uint32_t Sector; /*!< Initial FLASH sector from which starts the CRC computation | |||
| This parameter must be a value of @ref FLASH_Sectors */ | |||
| uint32_t NbSectors; /*!< Number of sectors to be computed. | |||
| This parameter must be a value between 1 and (max number of sectors - value of Initial sector)*/ | |||
| uint32_t CRCStartAddr; /*!< CRC Start address. | |||
| This parameter must be a value between begin address and end address of a bank */ | |||
| uint32_t CRCEndAddr; /*!< CRC End address. | |||
| This parameter must be a value between CRC Start address and end address of a bank */ | |||
| } FLASH_CRCInitTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -152,8 +175,8 @@ typedef struct | |||
| /** @defgroup FLASHEx_Type_Erase FLASH Type Erase | |||
| * @{ | |||
| */ | |||
| #define FLASH_TYPEERASE_SECTORS ((uint32_t)0x00U) /*!< Sectors erase only */ | |||
| #define FLASH_TYPEERASE_MASSERASE ((uint32_t)0x01U) /*!< Flash Mass erase activation */ | |||
| #define FLASH_TYPEERASE_SECTORS 0x00U /*!< Sectors erase only */ | |||
| #define FLASH_TYPEERASE_MASSERASE 0x01U /*!< Flash Mass erase activation */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -161,11 +184,10 @@ typedef struct | |||
| /** @defgroup FLASHEx_Voltage_Range FLASH Voltage Range | |||
| * @{ | |||
| */ | |||
| #define FLASH_VOLTAGE_RANGE_1 ((uint32_t)0x00U) /*!< Flash program/erase by 8 bits */ | |||
| #define FLASH_VOLTAGE_RANGE_2 ((uint32_t)FLASH_CR_PSIZE_0) /*!< Flash program/erase by 16 bits */ | |||
| #define FLASH_VOLTAGE_RANGE_3 ((uint32_t)FLASH_CR_PSIZE_1) /*!< Flash program/erase by 32 bits */ | |||
| #define FLASH_VOLTAGE_RANGE_4 ((uint32_t)FLASH_CR_PSIZE) /*!< Flash program/erase by 64 bits */ | |||
| #define FLASH_VOLTAGE_RANGE_1 0x00000000U /*!< Flash program/erase by 8 bits */ | |||
| #define FLASH_VOLTAGE_RANGE_2 FLASH_CR_PSIZE_0 /*!< Flash program/erase by 16 bits */ | |||
| #define FLASH_VOLTAGE_RANGE_3 FLASH_CR_PSIZE_1 /*!< Flash program/erase by 32 bits */ | |||
| #define FLASH_VOLTAGE_RANGE_4 FLASH_CR_PSIZE /*!< Flash program/erase by 64 bits */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -173,8 +195,8 @@ typedef struct | |||
| /** @defgroup FLASHEx_WRP_State FLASH WRP State | |||
| * @{ | |||
| */ | |||
| #define OB_WRPSTATE_DISABLE ((uint32_t)0x00U) /*!< Disable the write protection of the desired bank 1 sectors */ | |||
| #define OB_WRPSTATE_ENABLE ((uint32_t)0x01U) /*!< Enable the write protection of the desired bank 1 sectors */ | |||
| #define OB_WRPSTATE_DISABLE 0x00000000U /*!< Disable the write protection of the desired bank 1 sectors */ | |||
| #define OB_WRPSTATE_ENABLE 0x00000001U /*!< Enable the write protection of the desired bank 1 sectors */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -182,13 +204,19 @@ typedef struct | |||
| /** @defgroup FLASHEx_Option_Type FLASH Option Type | |||
| * @{ | |||
| */ | |||
| #define OPTIONBYTE_WRP ((uint32_t)0x01U) /*!< WRP option byte configuration */ | |||
| #define OPTIONBYTE_RDP ((uint32_t)0x02U) /*!< RDP option byte configuration */ | |||
| #define OPTIONBYTE_USER ((uint32_t)0x04U) /*!< USER option byte configuration */ | |||
| #define OPTIONBYTE_PCROP ((uint32_t)0x08U) /*!< PCROP option byte configuration */ | |||
| #define OPTIONBYTE_BOR ((uint32_t)0x10U) /*!< BOR option byte configuration */ | |||
| #define OPTIONBYTE_SECURE_AREA ((uint32_t)0x20U) /*!< secure area option byte configuration */ | |||
| #define OPTIONBYTE_BOOTADD ((uint32_t)0x40U) /*!< BOOT ADD option byte configuration */ | |||
| #define OPTIONBYTE_WRP 0x01U /*!< WRP option byte configuration */ | |||
| #define OPTIONBYTE_RDP 0x02U /*!< RDP option byte configuration */ | |||
| #define OPTIONBYTE_USER 0x04U /*!< USER option byte configuration */ | |||
| #define OPTIONBYTE_PCROP 0x08U /*!< PCROP option byte configuration */ | |||
| #define OPTIONBYTE_BOR 0x10U /*!< BOR option byte configuration */ | |||
| #define OPTIONBYTE_SECURE_AREA 0x20U /*!< secure area option byte configuration */ | |||
| #if defined(DUAL_CORE) | |||
| #define OPTIONBYTE_CM7_BOOTADD 0x40U /*!< CM7 BOOT ADD option byte configuration */ | |||
| #define OPTIONBYTE_CM4_BOOTADD 0x80U /*!< CM4 BOOT ADD option byte configuration */ | |||
| #define OPTIONBYTE_BOOTADD OPTIONBYTE_CM7_BOOTADD /*!< BOOT ADD option byte configuration */ | |||
| #else /* Single core*/ | |||
| #define OPTIONBYTE_BOOTADD 0x40U /*!< BOOT ADD option byte configuration */ | |||
| #endif /*DUAL_CORE*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -196,10 +224,10 @@ typedef struct | |||
| /** @defgroup FLASHEx_Option_Bytes_Read_Protection FLASH Option Bytes Read Protection | |||
| * @{ | |||
| */ | |||
| #define OB_RDP_LEVEL_0 ((uint32_t)0xAA00U) | |||
| #define OB_RDP_LEVEL_1 ((uint32_t)0x5500U) | |||
| #define OB_RDP_LEVEL_2 ((uint32_t)0xCC00U) /*!< Warning: When enabling read protection level 2 | |||
| it s no more possible to go back to level 1 or 0 */ | |||
| #define OB_RDP_LEVEL_0 0xAA00U | |||
| #define OB_RDP_LEVEL_1 0x5500U | |||
| #define OB_RDP_LEVEL_2 0xCC00U /*!< Warning: When enabling read protection level 2 | |||
| it s no more possible to go back to level 1 or 0 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -207,8 +235,8 @@ typedef struct | |||
| /** @defgroup FLASHEx_Option_Bytes_WWatchdog FLASH Option Bytes WWatchdog | |||
| * @{ | |||
| */ | |||
| #define OB_WWDG_SW ((uint32_t)0x10U) /*!< Software WWDG selected */ | |||
| #define OB_WWDG_HW ((uint32_t)0x00U) /*!< Hardware WWDG selected */ | |||
| #define OB_WWDG_SW 0x10U /*!< Software WWDG selected */ | |||
| #define OB_WWDG_HW 0x00U /*!< Hardware WWDG selected */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -217,8 +245,8 @@ typedef struct | |||
| /** @defgroup FLASHEx_Option_Bytes_IWatchdog FLASH Option Bytes IWatchdog | |||
| * @{ | |||
| */ | |||
| #define OB_IWDG_SW ((uint32_t)0x20U) /*!< Software IWDG selected */ | |||
| #define OB_IWDG_HW ((uint32_t)0x00U) /*!< Hardware IWDG selected */ | |||
| #define OB_IWDG_SW 0x20U /*!< Software IWDG selected */ | |||
| #define OB_IWDG_HW 0x00U /*!< Hardware IWDG selected */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -226,8 +254,8 @@ typedef struct | |||
| /** @defgroup FLASHEx_Option_Bytes_nRST_STOP FLASH Option Bytes nRST_STOP | |||
| * @{ | |||
| */ | |||
| #define OB_STOP_NO_RST ((uint32_t)0x40U) /*!< No reset generated when entering in STOP */ | |||
| #define OB_STOP_RST ((uint32_t)0x00U) /*!< Reset generated when entering in STOP */ | |||
| #define OB_STOP_NO_RST 0x40U /*!< No reset generated when entering in STOP */ | |||
| #define OB_STOP_RST 0x00U /*!< Reset generated when entering in STOP */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -235,8 +263,8 @@ typedef struct | |||
| /** @defgroup FLASHEx_Option_Bytes_nRST_STDBY FLASH Option Bytes nRST_STDBY | |||
| * @{ | |||
| */ | |||
| #define OB_STDBY_NO_RST ((uint32_t)0x80U) /*!< No reset generated when entering in STANDBY */ | |||
| #define OB_STDBY_RST ((uint32_t)0x00U) /*!< Reset generated when entering in STANDBY */ | |||
| #define OB_STDBY_NO_RST 0x80U /*!< No reset generated when entering in STANDBY */ | |||
| #define OB_STDBY_RST 0x00U /*!< Reset generated when entering in STANDBY */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -244,8 +272,8 @@ typedef struct | |||
| /** @defgroup FLASHEx_Option_Bytes_IWDG_FREEZE_STOP FLASH IWDG Counter Freeze in STOP | |||
| * @{ | |||
| */ | |||
| #define OB_IWDG_STOP_FREEZE ((uint32_t)0x00000000U) /*!< Freeze IWDG counter in STOP mode */ | |||
| #define OB_IWDG_STOP_ACTIVE ((uint32_t)FLASH_OPTSR_FZ_IWDG_STOP) /*!< IWDG counter active in STOP mode */ | |||
| #define OB_IWDG_STOP_FREEZE 0x00000000U /*!< Freeze IWDG counter in STOP mode */ | |||
| #define OB_IWDG_STOP_ACTIVE FLASH_OPTSR_FZ_IWDG_STOP /*!< IWDG counter active in STOP mode */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -253,8 +281,8 @@ typedef struct | |||
| /** @defgroup FLASHEx_Option_Bytes_IWDG_FREEZE_SANDBY FLASH IWDG Counter Freeze in STANDBY | |||
| * @{ | |||
| */ | |||
| #define OB_IWDG_STDBY_FREEZE ((uint32_t)0x00000000U) /*!< Freeze IWDG counter in STANDBY mode */ | |||
| #define OB_IWDG_STDBY_ACTIVE ((uint32_t)FLASH_OPTSR_FZ_IWDG_SDBY) /*!< IWDG counter active in STANDBY mode */ | |||
| #define OB_IWDG_STDBY_FREEZE 0x00000000U /*!< Freeze IWDG counter in STANDBY mode */ | |||
| #define OB_IWDG_STDBY_ACTIVE FLASH_OPTSR_FZ_IWDG_SDBY /*!< IWDG counter active in STANDBY mode */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -262,10 +290,10 @@ typedef struct | |||
| /** @defgroup FLASHEx_BOR_Reset_Level FLASH BOR Reset Level | |||
| * @{ | |||
| */ | |||
| #define OB_BOR_LEVEL3 ((uint32_t)0x00U) /*!< Supply voltage ranges from 2.70 to 3.60 V */ | |||
| #define OB_BOR_LEVEL2 ((uint32_t)0x04U) /*!< Supply voltage ranges from 2.40 to 2.70 V */ | |||
| #define OB_BOR_LEVEL1 ((uint32_t)0x08U) /*!< Supply voltage ranges from 2.10 to 2.40 V */ | |||
| #define OB_BOR_OFF ((uint32_t)0x0CU) /*!< Supply voltage ranges from 1.62 to 2.10 V */ | |||
| #define OB_BOR_LEVEL0 0x00000000U /*!< Reset level threshold is set to 1.6V */ | |||
| #define OB_BOR_LEVEL1 FLASH_OPTSR_BOR_LEV_0 /*!< Reset level threshold is set to 2.1V */ | |||
| #define OB_BOR_LEVEL2 FLASH_OPTSR_BOR_LEV_1 /*!< Reset level threshold is set to 2.4V */ | |||
| #define OB_BOR_LEVEL3 (FLASH_OPTSR_BOR_LEV_1 | FLASH_OPTSR_BOR_LEV_0) /*!< Reset level threshold is set to 2.7V */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -275,13 +303,13 @@ typedef struct | |||
| /** @defgroup FLASHEx_Boot_Address FLASH Boot Address | |||
| * @{ | |||
| */ | |||
| #define OB_BOOTADDR_ITCM_RAM ((uint32_t)0x0000U) /*!< Boot from ITCM RAM (0x00000000) */ | |||
| #define OB_BOOTADDR_SYSTEM ((uint32_t)0x0040U) /*!< Boot from System memory bootloader (0x00100000) */ | |||
| #define OB_BOOTADDR_ITCM_FLASH ((uint32_t)0x0080U) /*!< Boot from Flash on ITCM interface (0x00200000) */ | |||
| #define OB_BOOTADDR_AXIM_FLASH ((uint32_t)0x2000U) /*!< Boot from Flash on AXIM interface (0x08000000) */ | |||
| #define OB_BOOTADDR_DTCM_RAM ((uint32_t)0x8000U) /*!< Boot from DTCM RAM (0x20000000) */ | |||
| #define OB_BOOTADDR_SRAM1 ((uint32_t)0x8004U) /*!< Boot from SRAM1 (0x20010000) */ | |||
| #define OB_BOOTADDR_SRAM2 ((uint32_t)0x8013U) /*!< Boot from SRAM2 (0x2004C000) */ | |||
| #define OB_BOOTADDR_ITCM_RAM 0x0000U /*!< Boot from ITCM RAM (0x00000000) */ | |||
| #define OB_BOOTADDR_SYSTEM 0x0040U /*!< Boot from System memory bootloader (0x00100000) */ | |||
| #define OB_BOOTADDR_ITCM_FLASH 0x0080U /*!< Boot from Flash on ITCM interface (0x00200000) */ | |||
| #define OB_BOOTADDR_AXIM_FLASH 0x2000U /*!< Boot from Flash on AXIM interface (0x08000000) */ | |||
| #define OB_BOOTADDR_DTCM_RAM 0x8000U /*!< Boot from DTCM RAM (0x20000000) */ | |||
| #define OB_BOOTADDR_SRAM1 0x8004U /*!< Boot from SRAM1 (0x20010000) */ | |||
| #define OB_BOOTADDR_SRAM2 0x8013U /*!< Boot from SRAM2 (0x2004C000) */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -289,87 +317,130 @@ typedef struct | |||
| /** @defgroup FLASH_Latency FLASH Latency | |||
| * @{ | |||
| */ | |||
| #define FLASH_LATENCY_0 FLASH_ACR_LATENCY_0WS /*!< FLASH Zero Latency cycle */ | |||
| #define FLASH_LATENCY_1 FLASH_ACR_LATENCY_1WS /*!< FLASH One Latency cycle */ | |||
| #define FLASH_LATENCY_2 FLASH_ACR_LATENCY_2WS /*!< FLASH Two Latency cycles */ | |||
| #define FLASH_LATENCY_3 FLASH_ACR_LATENCY_3WS /*!< FLASH Three Latency cycles */ | |||
| #define FLASH_LATENCY_4 FLASH_ACR_LATENCY_4WS /*!< FLASH Four Latency cycles */ | |||
| #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 */ | |||
| #define FLASH_LATENCY_0 FLASH_ACR_LATENCY_0WS /*!< FLASH Zero Latency cycle */ | |||
| #define FLASH_LATENCY_1 FLASH_ACR_LATENCY_1WS /*!< FLASH One Latency cycle */ | |||
| #define FLASH_LATENCY_2 FLASH_ACR_LATENCY_2WS /*!< FLASH Two Latency cycles */ | |||
| #define FLASH_LATENCY_3 FLASH_ACR_LATENCY_3WS /*!< FLASH Three Latency cycles */ | |||
| #define FLASH_LATENCY_4 FLASH_ACR_LATENCY_4WS /*!< FLASH Four Latency cycles */ | |||
| #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 */ | |||
| #define FLASH_LATENCY_8 FLASH_ACR_LATENCY_8WS /*!< FLASH Eight Latency cycle */ | |||
| #define FLASH_LATENCY_9 FLASH_ACR_LATENCY_9WS /*!< FLASH Nine Latency cycle */ | |||
| #define FLASH_LATENCY_10 FLASH_ACR_LATENCY_10WS /*!< FLASH Ten Latency cycles */ | |||
| #define FLASH_LATENCY_11 FLASH_ACR_LATENCY_11WS /*!< FLASH Eleven Latency cycles */ | |||
| #define FLASH_LATENCY_12 FLASH_ACR_LATENCY_12WS /*!< FLASH Twelve Latency cycles */ | |||
| #define FLASH_LATENCY_13 FLASH_ACR_LATENCY_13WS /*!< FLASH Thirteen Latency cycles */ | |||
| #define FLASH_LATENCY_14 FLASH_ACR_LATENCY_14WS /*!< FLASH Fourteen Latency cycles */ | |||
| #define FLASH_LATENCY_15 FLASH_ACR_LATENCY_15WS /*!< FLASH Fifteen Latency cycles */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FLASHEx_Banks FLASH Banks | |||
| * @{ | |||
| */ | |||
| #define FLASH_BANK_1 ((uint32_t)0x01U) /*!< Bank 1 */ | |||
| #define FLASH_BANK_2 ((uint32_t)0x02U) /*!< Bank 2 */ | |||
| #define FLASH_BANK_BOTH ((uint32_t)(FLASH_BANK_1 | FLASH_BANK_2)) /*!< Bank1 and Bank2 */ | |||
| #define FLASH_BANK_1 0x01U /*!< Bank 1 */ | |||
| #define FLASH_BANK_2 0x02U /*!< Bank 2 */ | |||
| #define FLASH_BANK_BOTH (FLASH_BANK_1 | FLASH_BANK_2) /*!< Bank1 and Bank2 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FLASHEx_OB_PCROP_RDP FLASHEx OB PCROP RDP | |||
| * @{ | |||
| */ | |||
| #define OB_PCROP_RDP_NOT_ERASE ((uint32_t)0x00000000U) /*!< PCROP area is not erased when the RDP level | |||
| is decreased from Level 1 to Level 0 or during a mass erase */ | |||
| #define OB_PCROP_RDP_ERASE ((uint32_t)FLASH_PRAR_DMEP) /*!< PCROP area is erased when the RDP level is | |||
| decreased from Level 1 to Level 0 (full mass erase) */ | |||
| #define OB_PCROP_RDP_NOT_ERASE 0x00000000U /*!< PCROP area is not erased when the RDP level | |||
| is decreased from Level 1 to Level 0 or during a mass erase */ | |||
| #define OB_PCROP_RDP_ERASE FLASH_PRAR_DMEP /*!< PCROP area is erased when the RDP level is | |||
| decreased from Level 1 to Level 0 (full mass erase) */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FLASHEx_Option_Bytes_Write_Protection FLASH Option Bytes Write Protection | |||
| * @{ | |||
| */ | |||
| #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_All ((uint32_t)0x000000FFU) /*!< Write protection of all Sectors */ | |||
| #define OB_WRP_SECTOR_0 0x00000001U /*!< Write protection of Sector0 */ | |||
| #define OB_WRP_SECTOR_1 0x00000002U /*!< Write protection of Sector1 */ | |||
| #define OB_WRP_SECTOR_2 0x00000004U /*!< Write protection of Sector2 */ | |||
| #define OB_WRP_SECTOR_3 0x00000008U /*!< Write protection of Sector3 */ | |||
| #define OB_WRP_SECTOR_4 0x00000010U /*!< Write protection of Sector4 */ | |||
| #define OB_WRP_SECTOR_5 0x00000020U /*!< Write protection of Sector5 */ | |||
| #define OB_WRP_SECTOR_6 0x00000040U /*!< Write protection of Sector6 */ | |||
| #define OB_WRP_SECTOR_7 0x00000080U /*!< Write protection of Sector7 */ | |||
| #define OB_WRP_SECTOR_All 0x000000FFU /*!< Write protection of all Sectors */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FLASHEx_OB_SECURITY FLASHEx OB SECURITY | |||
| * @{ | |||
| */ | |||
| #define OB_SECURITY_DISABLE ((uint32_t)0x00000U) /*!< security enabled */ | |||
| #define OB_SECURITY_ENABLE ((uint32_t)FLASH_OPTSR_SECURITY) /*!< security disabled */ | |||
| #define OB_SECURITY_DISABLE 0x00000000U /*!< security enabled */ | |||
| #define OB_SECURITY_ENABLE FLASH_OPTSR_SECURITY /*!< security disabled */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FLASHEx_OB_ST_RAM_SIZE FLASHEx OB ST RAM SIZE | |||
| * @{ | |||
| */ | |||
| #define OB_ST_RAM_SIZE_2KB 0x00000000U /*!< 2 Kbytes reserved to ST code */ | |||
| #define OB_ST_RAM_SIZE_4KB FLASH_OPTSR_ST_RAM_SIZE_0 /*!< 4 Kbytes reserved to ST code */ | |||
| #define OB_ST_RAM_SIZE_8KB FLASH_OPTSR_ST_RAM_SIZE_1 /*!< 8 Kbytes reserved to ST code */ | |||
| #define OB_ST_RAM_SIZE_16KB FLASH_OPTSR_ST_RAM_SIZE /*!< 16 Kbytes reserved to ST code */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #if defined(DUAL_CORE) | |||
| /** @defgroup FLASHEx_OB_BCM7 FLASHEx OB BCM7 | |||
| * @{ | |||
| */ | |||
| #define OB_BCM7_DISABLE 0x00000000U /*!< CM7 Boot disabled */ | |||
| #define OB_BCM7_ENABLE FLASH_OPTSR_BCM7 /*!< CM7 Boot enabled */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FLASHEx_OB_BCM4 FLASHEx OB BCM4 | |||
| * @{ | |||
| */ | |||
| #define OB_BCM4_DISABLE 0x00000000U /*!< CM4 Boot disabled */ | |||
| #define OB_BCM4_ENABLE FLASH_OPTSR_BCM4 /*!< CM4 Boot enabled */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /*DUAL_CORE*/ | |||
| /** @defgroup FLASHEx_OB_IWDG1_SW FLASHEx OB IWDG1 SW | |||
| * @{ | |||
| */ | |||
| #define OB_IWDG1_SW ((uint32_t)FLASH_OPTSR_IWDG1_SW) /*!< Hardware independent watchdog 1 */ | |||
| #define OB_IWDG1_HW ((uint32_t)0x00000U) /*!< Software independent watchdog 1 */ | |||
| #define OB_IWDG1_SW FLASH_OPTSR_IWDG1_SW /*!< Hardware independent watchdog 1 */ | |||
| #define OB_IWDG1_HW 0x00000000U /*!< Software independent watchdog 1 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FLASHEx_OB_NRST_STOP_D1 FLASHEx OB NRST STOP D1 | |||
| #if defined(DUAL_CORE) | |||
| /** @defgroup FLASHEx_OB_IWDG2_SW FLASHEx OB IWDG2 SW | |||
| * @{ | |||
| */ | |||
| #define OB_STOP_RST_D1 ((uint32_t)0x0000U) /*!< Reset generated when entering the D1 to stop mode */ | |||
| #define OB_STOP_NO_RST_D1 ((uint32_t)FLASH_OPTSR_NRST_STOP_D1) /*!< No reset generated when entering the D1 to stop mode */ | |||
| #define OB_IWDG2_SW FLASH_OPTSR_IWDG2_SW /*!< Hardware independent watchdog 2*/ | |||
| #define OB_IWDG2_HW 0x00000000U /*!< Software independent watchdog 2*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif | |||
| /** @defgroup FLASHEx_OB_NRST_STOP_D1 FLASHEx OB NRST STOP D1 | |||
| * @{ | |||
| */ | |||
| #define OB_STOP_RST_D1 0x00000000U /*!< Reset generated when entering the D1 to stop mode */ | |||
| #define OB_STOP_NO_RST_D1 FLASH_OPTSR_NRST_STOP_D1 /*!< No reset generated when entering the D1 to stop mode */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -377,19 +448,37 @@ typedef struct | |||
| /** @defgroup FLASHEx_OB_NRST_STDBY_D1 FLASHEx OB NRST STDBY D1 | |||
| * @{ | |||
| */ | |||
| #define OB_STDBY_RST_D1 ((uint32_t)0x0000U) /*!< Reset generated when entering the D1 to standby mode */ | |||
| #define OB_STDBY_NO_RST_D1 ((uint32_t)FLASH_OPTSR_NRST_STBY_D1) /*!< No reset generated when entering the D1 to standby mode */ | |||
| #define OB_STDBY_RST_D1 0x00000000U /*!< Reset generated when entering the D1 to standby mode */ | |||
| #define OB_STDBY_NO_RST_D1 FLASH_OPTSR_NRST_STBY_D1 /*!< No reset generated when entering the D1 to standby mode */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #if defined(DUAL_CORE) | |||
| /** @defgroup FLASHEx_OB_NRST_STOP_D2 FLASHEx OB NRST STOP D2 | |||
| * @{ | |||
| */ | |||
| #define OB_STOP_RST_D2 0x00000000U /*!< Reset generated when entering the D2 to stop mode */ | |||
| #define OB_STOP_NO_RST_D2 FLASH_OPTSR_NRST_STOP_D2 /*!< No reset generated when entering the D2 to stop mode */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FLASHEx_OB_NRST_STDBY_D2 FLASHEx OB NRST STDBY D2 | |||
| * @{ | |||
| */ | |||
| #define OB_STDBY_RST_D2 0x00000000U /*!< Reset generated when entering the D2 to standby mode */ | |||
| #define OB_STDBY_NO_RST_D2 FLASH_OPTSR_NRST_STBY_D2 /*!< No reset generated when entering the D2 to standby mode */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif | |||
| /** @defgroup FLASHEx_OB_SWAP_BANK FLASHEx OB SWAP BANK | |||
| * @{ | |||
| */ | |||
| #define OB_SWAP_BANK_DISABLE ((uint32_t)0x00000U) /*!< Bank swap disabled */ | |||
| #define OB_SWAP_BANK_ENABLE ((uint32_t)FLASH_OPTSR_SWAP_BANK_OPT) /*!< Bank swap enabled */ | |||
| #define OB_SWAP_BANK_DISABLE 0x00000000U /*!< Bank swap disabled */ | |||
| #define OB_SWAP_BANK_ENABLE FLASH_OPTSR_SWAP_BANK_OPT /*!< Bank swap enabled */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -397,10 +486,8 @@ typedef struct | |||
| /** @defgroup FLASHEx_OB_IOHSLV FLASHEx OB IOHSLV | |||
| * @{ | |||
| */ | |||
| #define OB_IOHSLV_DISABLE ((uint32_t)0x00000000U) /*!< IOHSLV disabled */ | |||
| #define OB_IOHSLV_ENABLE ((uint32_t)FLASH_OPTSR_IO_HSLV) /*!< IOHSLV enabled */ | |||
| #define OB_IOHSLV_DISABLE 0x00000000U /*!< IOHSLV disabled */ | |||
| #define OB_IOHSLV_ENABLE FLASH_OPTSR_IO_HSLV /*!< IOHSLV enabled */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -408,11 +495,9 @@ typedef struct | |||
| /** @defgroup FLASHEx_OB_BOOT_OPTION FLASHEx OB BOOT OPTION | |||
| * @{ | |||
| */ | |||
| #define OB_BOOT_ADD0 ((uint32_t)0x01U) /*!< Select Boot Address 0 */ | |||
| #define OB_BOOT_ADD1 ((uint32_t)0x02U) /*!< Select Boot Address 1 */ | |||
| #define OB_BOOT_ADD_BOTH ((uint32_t)0x03U) /*!< Select Boot Address 0 and 1 */ | |||
| #define OB_BOOT_ADD0 0x01U /*!< Select Boot Address 0 */ | |||
| #define OB_BOOT_ADD1 0x02U /*!< Select Boot Address 1 */ | |||
| #define OB_BOOT_ADD_BOTH 0x03U /*!< Select Boot Address 0 and 1 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -420,15 +505,22 @@ typedef struct | |||
| /** @defgroup FLASHEx_OB_USER_Type FLASHEx OB USER Type | |||
| * @{ | |||
| */ | |||
| #define OB_USER_NRST_STOP_D1 ((uint32_t)0x0001U) /*!< Reset when entering Stop mode selection*/ | |||
| #define OB_USER_NRST_STDBY_D1 ((uint32_t)0x0002U) /*!< Reset when entering standby mode selection*/ | |||
| #define OB_USER_IWDG_STOP ((uint32_t)0x0004U) /*!< Independent watchdog counter freeze in stop mode */ | |||
| #define OB_USER_IWDG_STDBY ((uint32_t)0x0008U) /*!< Independent watchdog counter freeze in standby mode */ | |||
| #define OB_USER_ST_RAM_SIZE ((uint32_t)0x0010U) /*!< dedicated DTCM Ram size selection */ | |||
| #define OB_USER_SECURITY ((uint32_t)0x0020U) /*!< security selection */ | |||
| #define OB_USER_SWAP_BANK ((uint32_t)0x0100U) /*!< Bank swap selection */ | |||
| #define OB_USER_IOHSLV ((uint32_t)0x0200U) /*!< IO HSLV selection */ | |||
| #define OB_USER_IWDG1_SW ((uint32_t)0x0400U) /*!< Independent watchdog selection */ | |||
| #define OB_USER_IWDG1_SW 0x0001U /*!< Independent watchdog selection */ | |||
| #define OB_USER_NRST_STOP_D1 0x0002U /*!< Reset when entering Stop mode selection*/ | |||
| #define OB_USER_NRST_STDBY_D1 0x0004U /*!< Reset when entering standby mode selection*/ | |||
| #define OB_USER_IWDG_STOP 0x0008U /*!< Independent watchdog counter freeze in stop mode */ | |||
| #define OB_USER_IWDG_STDBY 0x0010U /*!< Independent watchdog counter freeze in standby mode */ | |||
| #define OB_USER_ST_RAM_SIZE 0x0020U /*!< dedicated DTCM Ram size selection */ | |||
| #define OB_USER_SECURITY 0x0040U /*!< security selection */ | |||
| #define OB_USER_IOHSLV 0x0080U /*!< IO HSLV selection */ | |||
| #define OB_USER_SWAP_BANK 0x0100U /*!< Bank swap selection */ | |||
| #if defined(DUAL_CORE) | |||
| #define OB_USER_IWDG2_SW 0x0200U /*!< Window watchdog selection */ | |||
| #define OB_USER_BCM4 0x0400U /*!< CM4 boot selection */ | |||
| #define OB_USER_BCM7 0x0800U /*!< CM7 boot selection */ | |||
| #define OB_USER_NRST_STOP_D2 0x1000U /*!< Reset when entering Stop mode selection*/ | |||
| #define OB_USER_NRST_STDBY_D2 0x2000U /*!< Reset when entering standby mode selection*/ | |||
| #endif /*DUAL_CORE*/ | |||
| /** | |||
| * @} | |||
| @@ -437,17 +529,49 @@ typedef struct | |||
| /** @defgroup FLASHEx_OB_SECURE_RDP FLASHEx OB SECURE RDP | |||
| * @{ | |||
| */ | |||
| #define OB_SECURE_RDP_NOT_ERASE ((uint32_t)0x00000000U) /*!< Secure area is not erased when the RDP level | |||
| is decreased from Level 1 to Level 0 or during a mass erase*/ | |||
| #define OB_SECURE_RDP_ERASE ((uint32_t)FLASH_SCAR_DMES) /*!< Secure area is erased when the RDP level is | |||
| decreased from Level 1 to Level 0 (full mass erase) */ | |||
| #define OB_SECURE_RDP_NOT_ERASE 0x00000000U /*!< Secure area is not erased when the RDP level | |||
| is decreased from Level 1 to Level 0 or during a mass erase */ | |||
| #define OB_SECURE_RDP_ERASE FLASH_SCAR_DMES /*!< Secure area is erased when the RDP level is | |||
| decreased from Level 1 to Level 0 (full mass erase) */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FLASHEx_CRC_Selection_Type FLASH CRC Selection Type | |||
| * @{ | |||
| */ | |||
| #define FLASH_CRC_ADDR 0x00000000U /*!< CRC selection type by address */ | |||
| #define FLASH_CRC_SECTORS FLASH_CRCCR_CRC_BY_SECT /*!< CRC selection type by sectors */ | |||
| #define FLASH_CRC_BANK (FLASH_CRCCR_ALL_BANK | FLASH_CRCCR_CRC_BY_SECT) /*!< CRC selection type by bank */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FLASHEx_CRC_Burst_Size FLASH CRC Burst Size | |||
| * @{ | |||
| */ | |||
| #define FLASH_CRC_BURST_SIZE_4 0x00000000U /*!< Every burst has a size of 4 Flash words (256-bit) */ | |||
| #define FLASH_CRC_BURST_SIZE_16 FLASH_CRCCR_CRC_BURST_0 /*!< Every burst has a size of 16 Flash words (256-bit) */ | |||
| #define FLASH_CRC_BURST_SIZE_64 FLASH_CRCCR_CRC_BURST_1 /*!< Every burst has a size of 64 Flash words (256-bit) */ | |||
| #define FLASH_CRC_BURST_SIZE_256 FLASH_CRCCR_CRC_BURST /*!< Every burst has a size of 256 Flash words (256-bit) */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup FLASHEx_Programming_Delay FLASH Programming Delay | |||
| * @{ | |||
| */ | |||
| #define FLASH_PROGRAMMING_DELAY_0 0x00000000U /*!< programming delay set for Flash running at 70 MHz or below */ | |||
| #define FLASH_PROGRAMMING_DELAY_1 FLASH_ACR_WRHIGHFREQ_0 /*!< programming delay set for Flash running between 70 MHz and 185 MHz */ | |||
| #define FLASH_PROGRAMMING_DELAY_2 FLASH_ACR_WRHIGHFREQ_1 /*!< programming delay set for Flash running between 185 MHz and 225 MHz */ | |||
| #define FLASH_PROGRAMMING_DELAY_3 FLASH_ACR_WRHIGHFREQ /*!< programming delay set for Flash at startup */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup FLASH_Exported_Macros FLASH Exported Macros | |||
| /** @defgroup FLASHEx_Exported_Macros FLASH Exported Macros | |||
| * @{ | |||
| */ | |||
| /** | |||
| @@ -456,11 +580,47 @@ typedef struct | |||
| * @param __ADDRESS__: FLASH Boot Address (in the range 0x0000 0000 to 0x2004 FFFF with a granularity of 16KB) | |||
| * @retval The FLASH Boot Base Adress | |||
| */ | |||
| #define __HAL_FLASH_CALC_BOOT_BASE_ADR(__ADDRESS__) ((__ADDRESS__) >> 14) | |||
| #define __HAL_FLASH_CALC_BOOT_BASE_ADR(__ADDRESS__) ((__ADDRESS__) >> 14U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @brief Set the FLASH Program/Erase parallelism. | |||
| * @param __PSIZE__ FLASH Program/Erase parallelism | |||
| * This parameter can be a value of @ref FLASH_Program_Parallelism | |||
| * @param __BANK__: Flash bank (FLASH_BANK_1 or FLASH_BANK_2) | |||
| * @retval none | |||
| */ | |||
| #define __HAL_FLASH_SET_PSIZE(__PSIZE__, __BANK__) (((__BANK__) == FLASH_BANK_1) ? \ | |||
| MODIFY_REG(FLASH->CR1, FLASH_CR_PSIZE, (__PSIZE__)) : \ | |||
| MODIFY_REG(FLASH->CR2, FLASH_CR_PSIZE, (__PSIZE__))) | |||
| /** | |||
| * @brief Get the FLASH Program/Erase parallelism. | |||
| * @param __BANK__ Flash bank (FLASH_BANK_1 or FLASH_BANK_2) | |||
| * @retval FLASH Program/Erase parallelism | |||
| * This return value can be a value of @ref FLASH_Program_Parallelism | |||
| */ | |||
| #define __HAL_FLASH_GET_PSIZE(__BANK__) (((__BANK__) == FLASH_BANK_1) ? \ | |||
| READ_BIT((FLASH->CR1), FLASH_CR_PSIZE) : \ | |||
| READ_BIT((FLASH->CR2), FLASH_CR_PSIZE)) | |||
| /** | |||
| * @brief Set the FLASH Programming Delay. | |||
| * @param __DELAY__ FLASH Programming Delay | |||
| * This parameter can be a value of @ref FLASHEx_Programming_Delay | |||
| * @retval none | |||
| */ | |||
| #define __HAL_FLASH_SET_PROGRAM_DELAY(__DELAY__) MODIFY_REG(FLASH->ACR, FLASH_ACR_WRHIGHFREQ, (__DELAY__)) | |||
| /** | |||
| * @brief Get the FLASH Programming Delay. | |||
| * @retval FLASH Programming Delay | |||
| * This return value can be a value of @ref FLASHEx_Programming_Delay | |||
| */ | |||
| #define __HAL_FLASH_GET_PROGRAM_DELAY() READ_BIT(FLASH->ACR, FLASH_ACR_WRHIGHFREQ) | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup FLASHEx_Exported_Functions | |||
| * @{ | |||
| @@ -480,6 +640,8 @@ HAL_StatusTypeDef HAL_FLASHEx_Lock_Bank1(void); | |||
| HAL_StatusTypeDef HAL_FLASHEx_Unlock_Bank2(void); | |||
| HAL_StatusTypeDef HAL_FLASHEx_Lock_Bank2(void); | |||
| HAL_StatusTypeDef HAL_FLASHEx_ComputeCRC(FLASH_CRCInitTypeDef *pCRCInit, uint32_t *CRC_Result); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -509,17 +671,17 @@ HAL_StatusTypeDef HAL_FLASHEx_Lock_Bank2(void); | |||
| #define IS_WRPSTATE(VALUE) (((VALUE) == OB_WRPSTATE_DISABLE) || \ | |||
| ((VALUE) == OB_WRPSTATE_ENABLE)) | |||
| #define IS_OPTIONBYTE(VALUE) ((VALUE) <= (OB_USER_IWDG1_SW | OB_USER_NRST_STDBY_D1 | OB_USER_NRST_STOP_D1 |\ | |||
| OB_USER_IWDG_STOP| OB_USER_IWDG_STDBY | OB_USER_SWAP_BANK |\ | |||
| OB_USER_ST_RAM_SIZE | OB_USER_SECURITY)) | |||
| #if defined(DUAL_CORE) | |||
| #define IS_OPTIONBYTE(VALUE) (((VALUE) <= 0x3FFFU) && ((VALUE) != 0U)) | |||
| #else | |||
| #define IS_OPTIONBYTE(VALUE) (((VALUE) <= 0x01FFU) && ((VALUE) != 0U)) | |||
| #endif /*DUAL_CORE*/ | |||
| #define IS_OB_BOOT_ADDRESS(ADDRESS) ((ADDRESS) <= 0x8013U) | |||
| #define IS_OB_RDP_LEVEL(LEVEL) (((LEVEL) == OB_RDP_LEVEL_0) ||\ | |||
| ((LEVEL) == OB_RDP_LEVEL_1) ||\ | |||
| ((LEVEL) == OB_RDP_LEVEL_2)) | |||
| #define IS_OB_RDP_LEVEL(LEVEL) (((LEVEL) == OB_RDP_LEVEL_0) ||\ | |||
| ((LEVEL) == OB_RDP_LEVEL_1) ||\ | |||
| ((LEVEL) == OB_RDP_LEVEL_2)) | |||
| #define IS_OB_WWDG_SOURCE(SOURCE) (((SOURCE) == OB_WWDG_SW) || ((SOURCE) == OB_WWDG_HW)) | |||
| @@ -533,8 +695,8 @@ HAL_StatusTypeDef HAL_FLASHEx_Lock_Bank2(void); | |||
| #define IS_OB_IWDG_STDBY_FREEZE(FREEZE) (((FREEZE) == OB_IWDG_STDBY_FREEZE) || ((FREEZE) == OB_IWDG_STDBY_ACTIVE)) | |||
| #define IS_OB_BOR_LEVEL(LEVEL) (((LEVEL) == OB_BOR_LEVEL1) || ((LEVEL) == OB_BOR_LEVEL2) ||\ | |||
| ((LEVEL) == OB_BOR_LEVEL3) || ((LEVEL) == OB_BOR_OFF)) | |||
| #define IS_OB_BOR_LEVEL(LEVEL) (((LEVEL) == OB_BOR_LEVEL0) || ((LEVEL) == OB_BOR_LEVEL1) || \ | |||
| ((LEVEL) == OB_BOR_LEVEL2) || ((LEVEL) == OB_BOR_LEVEL3)) | |||
| #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_LATENCY_0) || \ | |||
| ((LATENCY) == FLASH_LATENCY_1) || \ | |||
| @@ -543,7 +705,15 @@ HAL_StatusTypeDef HAL_FLASHEx_Lock_Bank2(void); | |||
| ((LATENCY) == FLASH_LATENCY_4) || \ | |||
| ((LATENCY) == FLASH_LATENCY_5) || \ | |||
| ((LATENCY) == FLASH_LATENCY_6) || \ | |||
| ((LATENCY) == FLASH_LATENCY_7)) | |||
| ((LATENCY) == FLASH_LATENCY_7) || \ | |||
| ((LATENCY) == FLASH_LATENCY_8) || \ | |||
| ((LATENCY) == FLASH_LATENCY_9) || \ | |||
| ((LATENCY) == FLASH_LATENCY_10) || \ | |||
| ((LATENCY) == FLASH_LATENCY_11) || \ | |||
| ((LATENCY) == FLASH_LATENCY_12) || \ | |||
| ((LATENCY) == FLASH_LATENCY_13) || \ | |||
| ((LATENCY) == FLASH_LATENCY_14) || \ | |||
| ((LATENCY) == FLASH_LATENCY_15)) | |||
| #define IS_FLASH_ADDRESS(ADDRESS) ((((ADDRESS) >= FLASH_BASE) && ((ADDRESS) <= FLASH_END)) || \ | |||
| (((ADDRESS) >= FLASH_OTP_BANK1_BASE) && ((ADDRESS) <= FLASH_OTP_BANK1_END)) || \ | |||
| @@ -556,23 +726,22 @@ HAL_StatusTypeDef HAL_FLASHEx_Lock_Bank2(void); | |||
| ((SECTOR) == FLASH_SECTOR_4) || ((SECTOR) == FLASH_SECTOR_5) ||\ | |||
| ((SECTOR) == FLASH_SECTOR_6) || ((SECTOR) == FLASH_SECTOR_7)) | |||
| #define IS_OB_WRP_SECTOR(SECTOR) ((((SECTOR) & (uint32_t)0xFFFFFF00) == 0x00000000U) && ((SECTOR) != 0x00000000U)) | |||
| #define IS_FLASH_BANK(BANK) (((BANK) == FLASH_BANK_1) || \ | |||
| ((BANK) == FLASH_BANK_2) || \ | |||
| ((BANK) == FLASH_BANK_BOTH)) | |||
| #define IS_OB_WRP_SECTOR(SECTOR) ((((SECTOR) & 0xFFFFFF00U) == 0x00000000U) && ((SECTOR) != 0x00000000U)) | |||
| #define IS_OB_PCROP_RDP(CONFIG) (((CONFIG) == OB_PCROP_RDP_NOT_ERASE) || \ | |||
| ((CONFIG) == OB_PCROP_RDP_ERASE)) | |||
| ((CONFIG) == OB_PCROP_RDP_ERASE)) | |||
| #define IS_OB_SECURE_RDP(CONFIG) (((CONFIG) == OB_SECURE_RDP_NOT_ERASE) || \ | |||
| ((CONFIG) == OB_SECURE_RDP_ERASE)) | |||
| ((CONFIG) == OB_SECURE_RDP_ERASE)) | |||
| #define IS_OB_USER_SWAP_BANK(VALUE) (((VALUE) == OB_SWAP_BANK_DISABLE) || ((VALUE) == OB_SWAP_BANK_ENABLE)) | |||
| #define IS_OB_USER_IOHSLV(VALUE) (((VALUE) == OB_IOHSLV_DISABLE) || ((VALUE) == OB_IOHSLV_ENABLE)) | |||
| #define IS_OB_IWDG1_SOURCE(SOURCE) (((SOURCE) == OB_IWDG1_SW) || ((SOURCE) == OB_IWDG1_HW)) | |||
| #if defined(DUAL_CORE) | |||
| #define IS_OB_IWDG2_SOURCE(SOURCE) (((SOURCE) == OB_IWDG2_SW) || ((SOURCE) == OB_IWDG2_HW)) | |||
| #endif /*DUAL_CORE*/ | |||
| #define IS_OB_STOP_D1_RESET(VALUE) (((VALUE) == OB_STOP_NO_RST_D1) || ((VALUE) == OB_STOP_RST_D1)) | |||
| #define IS_OB_STDBY_D1_RESET(VALUE) (((VALUE) == OB_STDBY_NO_RST_D1) || ((VALUE) == OB_STDBY_RST_D1)) | |||
| @@ -581,13 +750,33 @@ HAL_StatusTypeDef HAL_FLASHEx_Lock_Bank2(void); | |||
| #define IS_OB_USER_IWDG_STDBY(VALUE) (((VALUE) == OB_IWDG_STDBY_FREEZE) || ((VALUE) == OB_IWDG_STDBY_ACTIVE)) | |||
| #define IS_OB_USER_SECURITY(VALUE) (((VALUE) == OB_SECURITY_ENABLE) || ((VALUE) == OB_SECURITY_DISABLE)) /*User can only move the security bit from 0 to 1*/ | |||
| #define IS_OB_USER_TYPE(TYPE) (((TYPE) <= (uint32_t)0x400U) && ((TYPE) != 0)) | |||
| #define IS_OB_USER_ST_RAM_SIZE(VALUE) (((VALUE) == OB_ST_RAM_SIZE_2KB) || ((VALUE) == OB_ST_RAM_SIZE_4KB) || \ | |||
| ((VALUE) == OB_ST_RAM_SIZE_8KB) || ((VALUE) == OB_ST_RAM_SIZE_16KB)) | |||
| #define IS_OB_USER_SECURITY(VALUE) (((VALUE) == OB_SECURITY_ENABLE) || ((VALUE) == OB_SECURITY_DISABLE)) | |||
| #if defined(DUAL_CORE) | |||
| #define IS_OB_USER_BCM4(VALUE) (((VALUE) == OB_BCM4_DISABLE) || ((VALUE) == OB_BCM4_ENABLE)) | |||
| #define IS_OB_USER_BCM7(VALUE) (((VALUE) == OB_BCM7_DISABLE) || ((VALUE) == OB_BCM7_ENABLE)) | |||
| #define IS_OB_STOP_D2_RESET(VALUE) (((VALUE) == OB_STOP_NO_RST_D2) || ((VALUE) == OB_STOP_RST_D2)) | |||
| #define IS_OB_STDBY_D2_RESET(VALUE) (((VALUE) == OB_STDBY_NO_RST_D2) || ((VALUE) == OB_STDBY_RST_D2)) | |||
| #endif /*DUAL_CORE*/ | |||
| #if defined(DUAL_CORE) | |||
| #define IS_OB_USER_TYPE(TYPE) (((TYPE) <= (uint32_t)0x3FFFU) && ((TYPE) != 0U)) | |||
| #else | |||
| #define IS_OB_USER_TYPE(TYPE) (((TYPE) <= (uint32_t)0x73FU) && ((TYPE) != 0U)) | |||
| #endif | |||
| #define IS_OB_BOOT_ADD_OPTION(VALUE) (((VALUE) == OB_BOOT_ADD0) || \ | |||
| ((VALUE) == OB_BOOT_ADD1) || \ | |||
| ((VALUE) == OB_BOOT_ADD_BOTH)) | |||
| #define IS_OB_BOOT_ADD_OPTION(VALUE) (((VALUE) == OB_BOOT_ADD0) || \ | |||
| ((VALUE) == OB_BOOT_ADD1) || \ | |||
| ((VALUE) == OB_BOOT_ADD_BOTH)) | |||
| #define IS_FLASH_TYPECRC(VALUE) (((VALUE) == FLASH_CRC_ADDR) || \ | |||
| ((VALUE) == FLASH_CRC_SECTORS) || \ | |||
| ((VALUE) == FLASH_CRC_BANK)) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -597,10 +786,10 @@ HAL_StatusTypeDef HAL_FLASHEx_Lock_Bank2(void); | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup FLASHEx_Private_Functions Extended FLASH Private functions | |||
| /** @defgroup FLASHEx_Private_Functions FLASHEx Private Functions | |||
| * @{ | |||
| */ | |||
| void FLASH_Erase_Sector(uint32_t Sector, uint32_t Bank, uint32_t VoltageRange); | |||
| void FLASH_Erase_Sector(uint32_t Sector, uint32_t Banks, uint32_t VoltageRange); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -621,6 +810,6 @@ void FLASH_Erase_Sector(uint32_t Sector, uint32_t Bank, uint32_t VoltageRange); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_FLASH_EX_H */ | |||
| #endif /* STM32H7xx_HAL_FLASH_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_gpio.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of GPIO HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_GPIO_H | |||
| #define __STM32H7xx_HAL_GPIO_H | |||
| #ifndef STM32H7xx_HAL_GPIO_H | |||
| #define STM32H7xx_HAL_GPIO_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -78,16 +60,16 @@ typedef struct | |||
| uint32_t Alternate; /*!< Peripheral to be connected to the selected pins. | |||
| This parameter can be a value of @ref GPIO_Alternate_function_selection */ | |||
| }GPIO_InitTypeDef; | |||
| } GPIO_InitTypeDef; | |||
| /** | |||
| * @brief GPIO Bit SET and Bit RESET enumeration | |||
| */ | |||
| typedef enum | |||
| { | |||
| GPIO_PIN_RESET = 0, | |||
| GPIO_PIN_RESET = 0U, | |||
| GPIO_PIN_SET | |||
| }GPIO_PinState; | |||
| } GPIO_PinState; | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -101,25 +83,25 @@ typedef enum | |||
| /** @defgroup GPIO_pins_define GPIO pins define | |||
| * @{ | |||
| */ | |||
| #define GPIO_PIN_0 ((uint16_t)0x0001U) /* Pin 0 selected */ | |||
| #define GPIO_PIN_1 ((uint16_t)0x0002U) /* Pin 1 selected */ | |||
| #define GPIO_PIN_2 ((uint16_t)0x0004U) /* Pin 2 selected */ | |||
| #define GPIO_PIN_3 ((uint16_t)0x0008U) /* Pin 3 selected */ | |||
| #define GPIO_PIN_4 ((uint16_t)0x0010U) /* Pin 4 selected */ | |||
| #define GPIO_PIN_5 ((uint16_t)0x0020U) /* Pin 5 selected */ | |||
| #define GPIO_PIN_6 ((uint16_t)0x0040U) /* Pin 6 selected */ | |||
| #define GPIO_PIN_7 ((uint16_t)0x0080U) /* Pin 7 selected */ | |||
| #define GPIO_PIN_8 ((uint16_t)0x0100U) /* Pin 8 selected */ | |||
| #define GPIO_PIN_9 ((uint16_t)0x0200U) /* Pin 9 selected */ | |||
| #define GPIO_PIN_10 ((uint16_t)0x0400U) /* Pin 10 selected */ | |||
| #define GPIO_PIN_11 ((uint16_t)0x0800U) /* Pin 11 selected */ | |||
| #define GPIO_PIN_12 ((uint16_t)0x1000U) /* Pin 12 selected */ | |||
| #define GPIO_PIN_13 ((uint16_t)0x2000U) /* Pin 13 selected */ | |||
| #define GPIO_PIN_14 ((uint16_t)0x4000U) /* Pin 14 selected */ | |||
| #define GPIO_PIN_15 ((uint16_t)0x8000U) /* Pin 15 selected */ | |||
| #define GPIO_PIN_All ((uint16_t)0xFFFFU) /* All pins selected */ | |||
| #define GPIO_PIN_MASK ((uint32_t)0x0000FFFFU) /* PIN mask for assert test */ | |||
| #define GPIO_PIN_0 ((uint16_t)0x0001) /* Pin 0 selected */ | |||
| #define GPIO_PIN_1 ((uint16_t)0x0002) /* Pin 1 selected */ | |||
| #define GPIO_PIN_2 ((uint16_t)0x0004) /* Pin 2 selected */ | |||
| #define GPIO_PIN_3 ((uint16_t)0x0008) /* Pin 3 selected */ | |||
| #define GPIO_PIN_4 ((uint16_t)0x0010) /* Pin 4 selected */ | |||
| #define GPIO_PIN_5 ((uint16_t)0x0020) /* Pin 5 selected */ | |||
| #define GPIO_PIN_6 ((uint16_t)0x0040) /* Pin 6 selected */ | |||
| #define GPIO_PIN_7 ((uint16_t)0x0080) /* Pin 7 selected */ | |||
| #define GPIO_PIN_8 ((uint16_t)0x0100) /* Pin 8 selected */ | |||
| #define GPIO_PIN_9 ((uint16_t)0x0200) /* Pin 9 selected */ | |||
| #define GPIO_PIN_10 ((uint16_t)0x0400) /* Pin 10 selected */ | |||
| #define GPIO_PIN_11 ((uint16_t)0x0800) /* Pin 11 selected */ | |||
| #define GPIO_PIN_12 ((uint16_t)0x1000) /* Pin 12 selected */ | |||
| #define GPIO_PIN_13 ((uint16_t)0x2000) /* Pin 13 selected */ | |||
| #define GPIO_PIN_14 ((uint16_t)0x4000) /* Pin 14 selected */ | |||
| #define GPIO_PIN_15 ((uint16_t)0x8000) /* Pin 15 selected */ | |||
| #define GPIO_PIN_All ((uint16_t)0xFFFF) /* All pins selected */ | |||
| #define GPIO_PIN_MASK (0x0000FFFFU) /* PIN mask for assert test */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -134,21 +116,21 @@ typedef enum | |||
| * - Z : IO Direction mode (Input, Output, Alternate or Analog) | |||
| * @{ | |||
| */ | |||
| #define GPIO_MODE_INPUT ((uint32_t)0x00000000U) /*!< Input Floating Mode */ | |||
| #define GPIO_MODE_OUTPUT_PP ((uint32_t)0x00000001U) /*!< Output Push Pull Mode */ | |||
| #define GPIO_MODE_OUTPUT_OD ((uint32_t)0x00000011U) /*!< Output Open Drain Mode */ | |||
| #define GPIO_MODE_AF_PP ((uint32_t)0x00000002U) /*!< Alternate Function Push Pull Mode */ | |||
| #define GPIO_MODE_AF_OD ((uint32_t)0x00000012U) /*!< Alternate Function Open Drain Mode */ | |||
| #define GPIO_MODE_INPUT (0x00000000U) /*!< Input Floating Mode */ | |||
| #define GPIO_MODE_OUTPUT_PP (0x00000001U) /*!< Output Push Pull Mode */ | |||
| #define GPIO_MODE_OUTPUT_OD (0x00000011U) /*!< Output Open Drain Mode */ | |||
| #define GPIO_MODE_AF_PP (0x00000002U) /*!< Alternate Function Push Pull Mode */ | |||
| #define GPIO_MODE_AF_OD (0x00000012U) /*!< Alternate Function Open Drain Mode */ | |||
| #define GPIO_MODE_ANALOG ((uint32_t)0x00000003U) /*!< Analog Mode */ | |||
| #define GPIO_MODE_ANALOG (0x00000003U) /*!< Analog Mode */ | |||
| #define GPIO_MODE_IT_RISING ((uint32_t)0x11110000U) /*!< External Interrupt Mode with Rising edge trigger detection */ | |||
| #define GPIO_MODE_IT_FALLING ((uint32_t)0x11210000U) /*!< External Interrupt Mode with Falling edge trigger detection */ | |||
| #define GPIO_MODE_IT_RISING_FALLING ((uint32_t)0x11310000U) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */ | |||
| #define GPIO_MODE_IT_RISING (0x11110000U) /*!< External Interrupt Mode with Rising edge trigger detection */ | |||
| #define GPIO_MODE_IT_FALLING (0x11210000U) /*!< External Interrupt Mode with Falling edge trigger detection */ | |||
| #define GPIO_MODE_IT_RISING_FALLING (0x11310000U) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */ | |||
| #define GPIO_MODE_EVT_RISING ((uint32_t)0x11120000U) /*!< External Event Mode with Rising edge trigger detection */ | |||
| #define GPIO_MODE_EVT_FALLING ((uint32_t)0x11220000U) /*!< External Event Mode with Falling edge trigger detection */ | |||
| #define GPIO_MODE_EVT_RISING_FALLING ((uint32_t)0x11320000U) /*!< External Event Mode with Rising/Falling edge trigger detection */ | |||
| #define GPIO_MODE_EVT_RISING (0x11120000U) /*!< External Event Mode with Rising edge trigger detection */ | |||
| #define GPIO_MODE_EVT_FALLING (0x11220000U) /*!< External Event Mode with Falling edge trigger detection */ | |||
| #define GPIO_MODE_EVT_RISING_FALLING (0x11320000U) /*!< External Event Mode with Rising/Falling edge trigger detection */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -157,21 +139,21 @@ typedef enum | |||
| * @brief GPIO Output Maximum frequency | |||
| * @{ | |||
| */ | |||
| #define GPIO_SPEED_FREQ_LOW ((uint32_t)0x00000000U) /*!< Low speed */ | |||
| #define GPIO_SPEED_FREQ_MEDIUM ((uint32_t)0x00000001U) /*!< Medium speed */ | |||
| #define GPIO_SPEED_FREQ_HIGH ((uint32_t)0x00000002U) /*!< Fast speed */ | |||
| #define GPIO_SPEED_FREQ_VERY_HIGH ((uint32_t)0x00000003U) /*!< High speed */ | |||
| #define GPIO_SPEED_FREQ_LOW (0x00000000U) /*!< Low speed */ | |||
| #define GPIO_SPEED_FREQ_MEDIUM (0x00000001U) /*!< Medium speed */ | |||
| #define GPIO_SPEED_FREQ_HIGH (0x00000002U) /*!< Fast speed */ | |||
| #define GPIO_SPEED_FREQ_VERY_HIGH (0x00000003U) /*!< High speed */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup GPIO_pull_define GPIO pull define | |||
| * @brief GPIO Pull-Up or Pull-Down Activation | |||
| * @{ | |||
| */ | |||
| #define GPIO_NOPULL ((uint32_t)0x00000000U) /*!< No Pull-up or Pull-down activation */ | |||
| #define GPIO_PULLUP ((uint32_t)0x00000001U) /*!< Pull-up activation */ | |||
| #define GPIO_PULLDOWN ((uint32_t)0x00000002U) /*!< Pull-down activation */ | |||
| /** @defgroup GPIO_pull_define GPIO pull define | |||
| * @brief GPIO Pull-Up or Pull-Down Activation | |||
| * @{ | |||
| */ | |||
| #define GPIO_NOPULL (0x00000000U) /*!< No Pull-up or Pull-down activation */ | |||
| #define GPIO_PULLUP (0x00000001U) /*!< Pull-up activation */ | |||
| #define GPIO_PULLDOWN (0x00000002U) /*!< Pull-down activation */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -217,6 +199,40 @@ typedef enum | |||
| */ | |||
| #define __HAL_GPIO_EXTI_CLEAR_IT(__EXTI_LINE__) (EXTI_D1->PR1 = (__EXTI_LINE__)) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Checks whether the specified EXTI line flag is set or not. | |||
| * @param __EXTI_LINE__: specifies the EXTI line flag to check. | |||
| * This parameter can be GPIO_PIN_x where x can be(0..15) | |||
| * @retval The new state of __EXTI_LINE__ (SET or RESET). | |||
| */ | |||
| #define __HAL_GPIO_EXTID2_GET_FLAG(__EXTI_LINE__) (EXTI_D2->PR1 & (__EXTI_LINE__)) | |||
| /** | |||
| * @brief Clears the EXTI's line pending flags. | |||
| * @param __EXTI_LINE__: specifies the EXTI lines flags to clear. | |||
| * This parameter can be any combination of GPIO_PIN_x where x can be (0..15) | |||
| * @retval None | |||
| */ | |||
| #define __HAL_GPIO_EXTID2_CLEAR_FLAG(__EXTI_LINE__) (EXTI_D2->PR1 = (__EXTI_LINE__)) | |||
| /** | |||
| * @brief Checks whether the specified EXTI line is asserted or not. | |||
| * @param __EXTI_LINE__: specifies the EXTI line to check. | |||
| * This parameter can be GPIO_PIN_x where x can be(0..15) | |||
| * @retval The new state of __EXTI_LINE__ (SET or RESET). | |||
| */ | |||
| #define __HAL_GPIO_EXTID2_GET_IT(__EXTI_LINE__) (EXTI_D2->PR1 & (__EXTI_LINE__)) | |||
| /** | |||
| * @brief Clears the EXTI's line pending bits. | |||
| * @param __EXTI_LINE__: specifies the EXTI lines to clear. | |||
| * This parameter can be any combination of GPIO_PIN_x where x can be (0..15) | |||
| * @retval None | |||
| */ | |||
| #define __HAL_GPIO_EXTID2_CLEAR_IT(__EXTI_LINE__) (EXTI_D2->PR1 = (__EXTI_LINE__)) | |||
| #endif | |||
| /** | |||
| * @brief Generates a Software interrupt on selected EXTI line. | |||
| * @param __EXTI_LINE__: specifies the EXTI line to check. | |||
| @@ -250,10 +266,10 @@ void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin); | |||
| * @{ | |||
| */ | |||
| /* IO operation functions *****************************************************/ | |||
| GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); | |||
| void HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState); | |||
| void HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); | |||
| HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); | |||
| GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin); | |||
| void HAL_GPIO_WritePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState); | |||
| void HAL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin); | |||
| HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin); | |||
| void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin); | |||
| void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin); | |||
| @@ -280,7 +296,8 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin); | |||
| * @{ | |||
| */ | |||
| #define IS_GPIO_PIN_ACTION(ACTION) (((ACTION) == GPIO_PIN_RESET) || ((ACTION) == GPIO_PIN_SET)) | |||
| #define IS_GPIO_PIN(__PIN__) ((((__PIN__) & GPIO_PIN_MASK ) != (uint32_t)0x00)) | |||
| #define IS_GPIO_PIN(__PIN__) ((((__PIN__) & GPIO_PIN_MASK) != 0x00U) &&\ | |||
| (((__PIN__) & ~GPIO_PIN_MASK) == 0x00U)) | |||
| #define IS_GPIO_MODE(MODE) (((MODE) == GPIO_MODE_INPUT) ||\ | |||
| ((MODE) == GPIO_MODE_OUTPUT_PP) ||\ | |||
| ((MODE) == GPIO_MODE_OUTPUT_OD) ||\ | |||
| @@ -298,6 +315,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin); | |||
| #define IS_GPIO_PULL(PULL) (((PULL) == GPIO_NOPULL) || ((PULL) == GPIO_PULLUP) || \ | |||
| ((PULL) == GPIO_PULLDOWN)) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -323,6 +341,6 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_GPIO_H */ | |||
| #endif /* STM32H7xx_HAL_GPIO_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_gpio_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of GPIO HAL Extension module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_GPIO_EX_H | |||
| #define __STM32H7xx_HAL_GPIO_EX_H | |||
| #ifndef STM32H7xx_HAL_GPIO_EX_H | |||
| #define STM32H7xx_HAL_GPIO_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -70,8 +52,16 @@ | |||
| #define GPIO_AF0_RTC_50Hz ((uint8_t)0x00) /* RTC_50Hz Alternate Function mapping */ | |||
| #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO (MCO1 and MCO2) Alternate Function mapping */ | |||
| #define GPIO_AF0_SWJ ((uint8_t)0x00) /* SWJ (SWD and JTAG) Alternate Function mapping */ | |||
| #define GPIO_AF0_LCDBIAS ((uint8_t)0x00) /* LCDBIAS Alternate Function mapping */ | |||
| #define GPIO_AF0_LCDBIAS ((uint8_t)0x00) /* LCDBIAS Alternate Function mapping */ | |||
| #define GPIO_AF0_TRACE ((uint8_t)0x00) /* TRACE Alternate Function mapping */ | |||
| #define GPIO_AF0_C1DSLEEP ((uint8_t)0x00) /* Cortex-M7 Deep Sleep Alternate Function mapping : available on STM32H7 Rev.B and above */ | |||
| #define GPIO_AF0_C1SLEEP ((uint8_t)0x00) /* Cortex-M7 Sleep Alternate Function mapping : available on STM32H7 Rev.B and above */ | |||
| #define GPIO_AF0_D1PWREN ((uint8_t)0x00) /* Domain 1 PWR enable Alternate Function mapping : available on STM32H7 Rev.B and above */ | |||
| #define GPIO_AF0_D2PWREN ((uint8_t)0x00) /* Domain 2 PWR enable Alternate Function mapping : available on STM32H7 Rev.B and above */ | |||
| #if defined(DUAL_CORE) | |||
| #define GPIO_AF0_C2DSLEEP ((uint8_t)0x00) /* Cortex-M4 Deep Sleep Alternate Function mapping : available on STM32H7 Rev.B and above */ | |||
| #define GPIO_AF0_C2SLEEP ((uint8_t)0x00) /* Cortex-M4 Sleep Alternate Function mapping : available on STM32H7 Rev.B and above */ | |||
| #endif /* DUAL_CORE */ | |||
| /** | |||
| * @brief AF 1 selection | |||
| @@ -153,7 +143,7 @@ | |||
| #define GPIO_AF7_USART6 ((uint8_t)0x07) /* USART6 Alternate Function mapping */ | |||
| #define GPIO_AF7_UART7 ((uint8_t)0x07) /* UART7 Alternate Function mapping */ | |||
| #define GPIO_AF7_DFSDM1 ((uint8_t)0x07) /* DFSDM Alternate Function mapping */ | |||
| #define GPIO_AF7_SDIO1 ((uint8_t)0x07) /* SDIO1 Alternate Function mapping */ | |||
| #define GPIO_AF7_SDMMC1 ((uint8_t)0x07) /* SDMMC1 Alternate Function mapping */ | |||
| /** | |||
| * @brief AF 8 selection | |||
| @@ -166,7 +156,7 @@ | |||
| #define GPIO_AF8_UART8 ((uint8_t)0x08) /* UART8 Alternate Function mapping */ | |||
| #define GPIO_AF8_SPDIF ((uint8_t)0x08) /* SPDIF Alternate Function mapping */ | |||
| #define GPIO_AF8_LPUART ((uint8_t)0x08) /* LPUART Alternate Function mapping */ | |||
| #define GPIO_AF8_SDIO1 ((uint8_t)0x08) /* SDIO1 Alternate Function mapping */ | |||
| #define GPIO_AF8_SDMMC1 ((uint8_t)0x08) /* SDMMC1 Alternate Function mapping */ | |||
| /** | |||
| * @brief AF 9 selection | |||
| @@ -176,8 +166,8 @@ | |||
| #define GPIO_AF9_TIM13 ((uint8_t)0x09) /* TIM13 Alternate Function mapping */ | |||
| #define GPIO_AF9_TIM14 ((uint8_t)0x09) /* TIM14 Alternate Function mapping */ | |||
| #define GPIO_AF9_QUADSPI ((uint8_t)0x09) /* QUADSPI Alternate Function mapping */ | |||
| #define GPIO_AF9_SDIO2 ((uint8_t)0x09) /* SDIO2 Alternate Function mapping */ | |||
| #define GPIO_AF9_LTDC ((uint8_t)0x09) /* LTDC Alternate Function mapping */ | |||
| #define GPIO_AF9_SDMMC2 ((uint8_t)0x09) /* SDMMC2 Alternate Function mapping */ | |||
| #define GPIO_AF9_LTDC ((uint8_t)0x09) /* LTDC Alternate Function mapping */ | |||
| #define GPIO_AF9_SPDIF ((uint8_t)0x09) /* SPDIF Alternate Function mapping */ | |||
| #define GPIO_AF9_FMC ((uint8_t)0x09) /* FMC Alternate Function mapping */ | |||
| #define GPIO_AF9_SAI4 ((uint8_t)0x09) /* SAI4 Alternate Function mapping */ | |||
| @@ -188,12 +178,14 @@ | |||
| #define GPIO_AF10_QUADSPI ((uint8_t)0xA) /* QUADSPI Alternate Function mapping */ | |||
| #define GPIO_AF10_SAI2 ((uint8_t)0xA) /* SAI2 Alternate Function mapping */ | |||
| #define GPIO_AF10_SAI4 ((uint8_t)0xA) /* SAI4 Alternate Function mapping */ | |||
| #define GPIO_AF10_SDIO2 ((uint8_t)0xA) /* SDIO2 Alternate Function mapping */ | |||
| #define GPIO_AF10_SDMMC2 ((uint8_t)0xA) /* SDMMC2 Alternate Function mapping */ | |||
| #define GPIO_AF10_OTG2_HS ((uint8_t)0xA) /* OTG2_HS Alternate Function mapping */ | |||
| #define GPIO_AF10_OTG1_FS ((uint8_t)0xA) /* OTG1_FS Alternate Function mapping */ | |||
| #define GPIO_AF10_COMP1 ((uint8_t)0xA) /* COMP1 Alternate Function mapping */ | |||
| #define GPIO_AF10_COMP2 ((uint8_t)0xA) /* COMP2 Alternate Function mapping */ | |||
| #define GPIO_AF10_LTDC ((uint8_t)0xA) /* LTDC Alternate Function mapping */ | |||
| #define GPIO_AF10_CRS_SYNC ((uint8_t)0xA) /* CRS Sync Alternate Function mapping : available on STM32H7 Rev.B and above */ | |||
| /** | |||
| * @brief AF 11 selection | |||
| @@ -203,7 +195,7 @@ | |||
| #define GPIO_AF11_MDIOS ((uint8_t)0x0B) /* MDIOS Alternate Function mapping */ | |||
| #define GPIO_AF11_OTG1_HS ((uint8_t)0x0B) /* OTG1_HS Alternate Function mapping */ | |||
| #define GPIO_AF11_UART7 ((uint8_t)0x0B) /* UART7 Alternate Function mapping */ | |||
| #define GPIO_AF11_SDIO2 ((uint8_t)0x0B) /* SDIO2 Alternate Function mapping */ | |||
| #define GPIO_AF11_SDMMC2 ((uint8_t)0x0B) /* SDMMC2 Alternate Function mapping */ | |||
| #define GPIO_AF11_DFSDM1 ((uint8_t)0x0B) /* DFSDM Alternate Function mapping */ | |||
| #define GPIO_AF11_COMP1 ((uint8_t)0x0B) /* COMP1 Alternate Function mapping */ | |||
| #define GPIO_AF11_COMP2 ((uint8_t)0x0B) /* COMP2 Alternate Function mapping */ | |||
| @@ -213,7 +205,7 @@ | |||
| * @brief AF 12 selection | |||
| */ | |||
| #define GPIO_AF12_FMC ((uint8_t)0xC) /* FMC Alternate Function mapping */ | |||
| #define GPIO_AF12_SDIO1 ((uint8_t)0xC) /* SDIO1 Alternate Function mapping */ | |||
| #define GPIO_AF12_SDMMC1 ((uint8_t)0xC) /* SDMMC1 Alternate Function mapping */ | |||
| #define GPIO_AF12_MDIOS ((uint8_t)0xC) /* MDIOS Alternate Function mapping */ | |||
| #define GPIO_AF12_OTG2_FS ((uint8_t)0xC) /* OTG2_FS Alternate Function mapping */ | |||
| #define GPIO_AF12_COMP1 ((uint8_t)0xC) /* COMP1 Alternate Function mapping */ | |||
| @@ -302,32 +294,20 @@ | |||
| /** @defgroup GPIOEx_Get_Port_Index GPIO Get Port Index | |||
| * @{ | |||
| */ | |||
| #define GPIO_GET_INDEX(__GPIOx__) (uint8_t)(((__GPIOx__) == (GPIOA))? 0U :\ | |||
| ((__GPIOx__) == (GPIOB))? 1U :\ | |||
| ((__GPIOx__) == (GPIOC))? 2U :\ | |||
| ((__GPIOx__) == (GPIOD))? 3U :\ | |||
| ((__GPIOx__) == (GPIOE))? 4U :\ | |||
| ((__GPIOx__) == (GPIOF))? 5U :\ | |||
| ((__GPIOx__) == (GPIOG))? 6U :\ | |||
| ((__GPIOx__) == (GPIOH))? 7U :\ | |||
| ((__GPIOx__) == (GPIOI))? 8U :\ | |||
| ((__GPIOx__) == (GPIOJ))? 9U : 10U) | |||
| #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0UL :\ | |||
| ((__GPIOx__) == (GPIOB))? 1UL :\ | |||
| ((__GPIOx__) == (GPIOC))? 2UL :\ | |||
| ((__GPIOx__) == (GPIOD))? 3UL :\ | |||
| ((__GPIOx__) == (GPIOE))? 4UL :\ | |||
| ((__GPIOx__) == (GPIOF))? 5UL :\ | |||
| ((__GPIOx__) == (GPIOG))? 6UL :\ | |||
| ((__GPIOx__) == (GPIOH))? 7UL :\ | |||
| ((__GPIOx__) == (GPIOI))? 8UL :\ | |||
| ((__GPIOx__) == (GPIOJ))? 9UL : 10UL) | |||
| /** | |||
| * @} | |||
| */ | |||
| #define IS_GPIO_PIN_AVAILABLE(__INSTANCE__,__PIN__) \ | |||
| ((((__INSTANCE__) == GPIOA) && (((__PIN__) & (GPIOA_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOA_PIN_AVAILABLE)) == (GPIOA_PIN_AVAILABLE))) || \ | |||
| (((__INSTANCE__) == GPIOB) && (((__PIN__) & (GPIOB_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOB_PIN_AVAILABLE)) == (GPIOB_PIN_AVAILABLE))) || \ | |||
| (((__INSTANCE__) == GPIOC) && (((__PIN__) & (GPIOC_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOC_PIN_AVAILABLE)) == (GPIOC_PIN_AVAILABLE))) || \ | |||
| (((__INSTANCE__) == GPIOD) && (((__PIN__) & (GPIOD_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOD_PIN_AVAILABLE)) == (GPIOD_PIN_AVAILABLE))) || \ | |||
| (((__INSTANCE__) == GPIOE) && (((__PIN__) & (GPIOE_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOE_PIN_AVAILABLE)) == (GPIOE_PIN_AVAILABLE))) || \ | |||
| (((__INSTANCE__) == GPIOF) && (((__PIN__) & (GPIOF_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOF_PIN_AVAILABLE)) == (GPIOF_PIN_AVAILABLE))) || \ | |||
| (((__INSTANCE__) == GPIOG) && (((__PIN__) & (GPIOG_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOG_PIN_AVAILABLE)) == (GPIOG_PIN_AVAILABLE))) || \ | |||
| (((__INSTANCE__) == GPIOI) && (((__PIN__) & (GPIOI_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOI_PIN_AVAILABLE)) == (GPIOI_PIN_AVAILABLE))) || \ | |||
| (((__INSTANCE__) == GPIOJ) && (((__PIN__) & (GPIOJ_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOJ_PIN_AVAILABLE)) == (GPIOJ_PIN_AVAILABLE))) || \ | |||
| (((__INSTANCE__) == GPIOK) && (((__PIN__) & (GPIOK_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOK_PIN_AVAILABLE)) == (GPIOK_PIN_AVAILABLE))) || \ | |||
| (((__INSTANCE__) == GPIOH) && (((__PIN__) & (GPIOH_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOH_PIN_AVAILABLE)) == (GPIOH_PIN_AVAILABLE)))) | |||
| /** @defgroup GPIOEx_IS_Alternat_function_selection GPIO Check Alternate Function | |||
| * @{ | |||
| */ | |||
| @@ -360,6 +340,6 @@ | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_GPIO_EX_H */ | |||
| #endif /* STM32H7xx_HAL_GPIO_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_hash.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of HASH HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_HASH_H | |||
| #define __STM32H7xx_HAL_HASH_H | |||
| #ifndef STM32H7xx_HAL_HASH_H | |||
| #define STM32H7xx_HAL_HASH_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -49,9 +31,7 @@ | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| #if defined (HASH) | |||
| /** @addtogroup HASH | |||
| * @{ | |||
| */ | |||
| @@ -80,12 +60,12 @@ typedef struct | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_HASH_STATE_RESET = 0x00, /*!< Peripheral is not initialized */ | |||
| HAL_HASH_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */ | |||
| HAL_HASH_STATE_BUSY = 0x02, /*!< Processing (hashing) is ongoing */ | |||
| HAL_HASH_STATE_TIMEOUT = 0x06, /*!< Timeout state */ | |||
| HAL_HASH_STATE_ERROR = 0x07, /*!< Error state */ | |||
| HAL_HASH_STATE_SUSPENDED = 0x08 /*!< Suspended state */ | |||
| HAL_HASH_STATE_RESET = 0x00U, /*!< Peripheral is not initialized */ | |||
| HAL_HASH_STATE_READY = 0x01U, /*!< Peripheral Initialized and ready for use */ | |||
| HAL_HASH_STATE_BUSY = 0x02U, /*!< Processing (hashing) is ongoing */ | |||
| HAL_HASH_STATE_TIMEOUT = 0x06U, /*!< Timeout state */ | |||
| HAL_HASH_STATE_ERROR = 0x07U, /*!< Error state */ | |||
| HAL_HASH_STATE_SUSPENDED = 0x08U /*!< Suspended state */ | |||
| }HAL_HASH_StateTypeDef; | |||
| /** | |||
| @@ -93,13 +73,13 @@ typedef enum | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_HASH_PHASE_READY = 0x01, /*!< HASH peripheral is ready to start */ | |||
| HAL_HASH_PHASE_PROCESS = 0x02, /*!< HASH peripheral is in HASH processing phase */ | |||
| HAL_HASH_PHASE_HMAC_STEP_1 = 0x03, /*!< HASH peripheral is in HMAC step 1 processing phase | |||
| HAL_HASH_PHASE_READY = 0x01U, /*!< HASH peripheral is ready to start */ | |||
| HAL_HASH_PHASE_PROCESS = 0x02U, /*!< HASH peripheral is in HASH processing phase */ | |||
| HAL_HASH_PHASE_HMAC_STEP_1 = 0x03U, /*!< HASH peripheral is in HMAC step 1 processing phase | |||
| (step 1 consists in entering the inner hash function key) */ | |||
| HAL_HASH_PHASE_HMAC_STEP_2 = 0x04, /*!< HASH peripheral is in HMAC step 2 processing phase | |||
| HAL_HASH_PHASE_HMAC_STEP_2 = 0x04U, /*!< HASH peripheral is in HMAC step 2 processing phase | |||
| (step 2 consists in entering the message text) */ | |||
| HAL_HASH_PHASE_HMAC_STEP_3 = 0x05 /*!< HASH peripheral is in HMAC step 3 processing phase | |||
| HAL_HASH_PHASE_HMAC_STEP_3 = 0x05U /*!< HASH peripheral is in HMAC step 3 processing phase | |||
| (step 3 consists in entering the outer hash function key) */ | |||
| }HAL_HASH_PhaseTypeDef; | |||
| @@ -108,15 +88,33 @@ typedef enum | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_HASH_SUSPEND_NONE = 0x00, /*!< HASH peripheral suspension not requested */ | |||
| HAL_HASH_SUSPEND = 0x01 /*!< HASH peripheral suspension is requested */ | |||
| HAL_HASH_SUSPEND_NONE = 0x00U, /*!< HASH peripheral suspension not requested */ | |||
| HAL_HASH_SUSPEND = 0x01U /*!< HASH peripheral suspension is requested */ | |||
| }HAL_HASH_SuspendTypeDef; | |||
| #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1U) | |||
| /** | |||
| * @brief HAL HASH common Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_HASH_MSPINIT_CB_ID = 0x00U, /*!< HASH MspInit callback ID */ | |||
| HAL_HASH_MSPDEINIT_CB_ID = 0x01U, /*!< HASH MspDeInit callback ID */ | |||
| HAL_HASH_INPUTCPLT_CB_ID = 0x02U, /*!< HASH input completion callback ID */ | |||
| HAL_HASH_DGSTCPLT_CB_ID = 0x03U, /*!< HASH digest computation completion callback ID */ | |||
| HAL_HASH_ERROR_CB_ID = 0x04U, /*!< HASH error callback ID */ | |||
| }HAL_HASH_CallbackIDTypeDef; | |||
| #endif /* USE_HAL_HASH_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @brief HASH Handle Structure definition | |||
| */ | |||
| #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1) | |||
| typedef struct __HASH_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* (USE_HAL_HASH_REGISTER_CALLBACKS) */ | |||
| { | |||
| HASH_InitTypeDef Init; /*!< HASH required parameters */ | |||
| @@ -128,30 +126,53 @@ typedef struct | |||
| uint8_t *pHashMsgBuffPtr; /*!< Pointer to message buffer (HMAC only) */ | |||
| uint32_t HashBuffSize; /*!< Size of buffer to be processed */ | |||
| uint32_t HashBuffSize; /*!< Size of buffer to be processed */ | |||
| __IO uint32_t HashInCount; /*!< Counter of inputted data */ | |||
| __IO uint32_t HashInCount; /*!< Counter of inputted data */ | |||
| __IO uint32_t HashITCounter; /*!< Counter of issued interrupts */ | |||
| __IO uint32_t HashITCounter; /*!< Counter of issued interrupts */ | |||
| __IO uint32_t HashKeyCount; /*!< Counter for Key inputted data (HMAC only) */ | |||
| __IO uint32_t HashKeyCount; /*!< Counter for Key inputted data (HMAC only) */ | |||
| HAL_StatusTypeDef Status; /*!< HASH peripheral status */ | |||
| HAL_HASH_PhaseTypeDef Phase; /*!< HASH peripheral phase */ | |||
| HAL_HASH_PhaseTypeDef Phase; /*!< HASH peripheral phase */ | |||
| DMA_HandleTypeDef *hdmain; /*!< HASH In DMA Handle parameters */ | |||
| HAL_LockTypeDef Lock; /*!< Locking object */ | |||
| __IO HAL_HASH_StateTypeDef State; /*!< HASH peripheral state */ | |||
| __IO HAL_HASH_StateTypeDef State; /*!< HASH peripheral state */ | |||
| HAL_HASH_SuspendTypeDef SuspendRequest; /*!< HASH peripheral suspension request flag */ | |||
| HAL_HASH_SuspendTypeDef SuspendRequest; /*!< HASH peripheral suspension request flag */ | |||
| FlagStatus DigestCalculationDisable; /*!< Digest calculation phase skip (MDMAT bit control) for multi-buffers DMA-based HMAC computation */ | |||
| FlagStatus DigestCalculationDisable; /*!< Digest calculation phase skip (MDMAT bit control) for multi-buffers DMA-based HMAC computation */ | |||
| __IO uint32_t NbWordsAlreadyPushed; /*!< Numbers of words already pushed in FIFO before inputting new block */ | |||
| __IO uint32_t ErrorCode; /*!< HASH Error code */ | |||
| #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1) | |||
| void (* InCpltCallback)( struct __HASH_HandleTypeDef * hhash); /*!< HASH input completion callback */ | |||
| void (* DgstCpltCallback)( struct __HASH_HandleTypeDef * hhash); /*!< HASH digest computation completion callback */ | |||
| void (* ErrorCallback)( struct __HASH_HandleTypeDef * hhash); /*!< HASH error callback */ | |||
| void (* MspInitCallback)( struct __HASH_HandleTypeDef * hhash); /*!< HASH Msp Init callback */ | |||
| void (* MspDeInitCallback)( struct __HASH_HandleTypeDef * hhash); /*!< HASH Msp DeInit callback */ | |||
| #endif /* (USE_HAL_HASH_REGISTER_CALLBACKS) */ | |||
| } HASH_HandleTypeDef; | |||
| #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1U) | |||
| /** | |||
| * @brief HAL HASH Callback pointer definition | |||
| */ | |||
| typedef void (*pHASH_CallbackTypeDef)(HASH_HandleTypeDef * hhash); /*!< pointer to a HASH common callback functions */ | |||
| #endif /* USE_HAL_HASH_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -165,10 +186,10 @@ typedef struct | |||
| /** @defgroup HASH_Algo_Selection HASH algorithm selection | |||
| * @{ | |||
| */ | |||
| #define HASH_ALGOSELECTION_SHA1 ((uint32_t)0x0000) /*!< HASH function is SHA1 */ | |||
| #define HASH_ALGOSELECTION_SHA1 0x00000000U /*!< HASH function is SHA1 */ | |||
| #define HASH_ALGOSELECTION_MD5 HASH_CR_ALGO_0 /*!< HASH function is MD5 */ | |||
| #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 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -176,7 +197,7 @@ typedef struct | |||
| /** @defgroup HASH_Algorithm_Mode HASH algorithm mode | |||
| * @{ | |||
| */ | |||
| #define HASH_ALGOMODE_HASH ((uint32_t)0x00000000) /*!< Algorithm is HASH */ | |||
| #define HASH_ALGOMODE_HASH 0x00000000U /*!< Algorithm is HASH */ | |||
| #define HASH_ALGOMODE_HMAC HASH_CR_MODE /*!< Algorithm is HMAC */ | |||
| /** | |||
| * @} | |||
| @@ -185,7 +206,7 @@ typedef struct | |||
| /** @defgroup HASH_Data_Type HASH input data type | |||
| * @{ | |||
| */ | |||
| #define HASH_DATATYPE_32B ((uint32_t)0x0000) /*!< 32-bit data. No swapping */ | |||
| #define HASH_DATATYPE_32B 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 */ | |||
| @@ -196,7 +217,7 @@ typedef struct | |||
| /** @defgroup HASH_HMAC_Long_key_only_for_HMAC_mode HMAC key length type | |||
| * @{ | |||
| */ | |||
| #define HASH_HMAC_KEYTYPE_SHORTKEY ((uint32_t)0x00000000) /*!< HMAC Key size is <= 64 bytes */ | |||
| #define HASH_HMAC_KEYTYPE_SHORTKEY 0x00000000U /*!< HMAC Key size is <= 64 bytes */ | |||
| #define HASH_HMAC_KEYTYPE_LONGKEY HASH_CR_LKEY /*!< HMAC Key size is > 64 bytes */ | |||
| /** | |||
| * @} | |||
| @@ -224,7 +245,6 @@ typedef struct | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HASH_alias HASH API alias | |||
| * @{ | |||
| */ | |||
| @@ -233,7 +253,18 @@ typedef struct | |||
| * @} | |||
| */ | |||
| /** @defgroup HASH_Error_Definition HASH Error Definition | |||
| * @{ | |||
| */ | |||
| #define HAL_HASH_ERROR_NONE 0x00000000U /*!< No error */ | |||
| #define HAL_HASH_ERROR_IT 0x00000001U /*!< IT-based process error */ | |||
| #define HAL_HASH_ERROR_DMA 0x00000002U /*!< DMA-based process error */ | |||
| #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1U) | |||
| #define HAL_HASH_ERROR_INVALID_CALLBACK 0x00000004U /*!< Invalid Callback error */ | |||
| #endif /* USE_HAL_HASH_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| @@ -291,7 +322,17 @@ typedef struct | |||
| * @param __HANDLE__: HASH handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_HASH_RESET_HANDLE_STATE(__HANDLE__) do{\ | |||
| (__HANDLE__)->State = HAL_HASH_STATE_RESET;\ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| }while(0) | |||
| #else | |||
| #define __HAL_HASH_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_HASH_STATE_RESET) | |||
| #endif /* USE_HAL_HASH_REGISTER_CALLBACKS */ | |||
| /** @brief Reset HASH handle status. | |||
| * @param __HANDLE__: HASH handle. | |||
| @@ -313,7 +354,6 @@ typedef struct | |||
| #define __HAL_HASH_RESET_MDMAT() CLEAR_BIT(HASH->CR, HASH_CR_MDMAT) | |||
| /** | |||
| * @brief Start the digest computation. | |||
| * @retval None | |||
| @@ -325,7 +365,7 @@ typedef struct | |||
| * @param __SIZE__: size in bytes of last data written in Data register. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_HASH_SET_NBVALIDBITS(__SIZE__) MODIFY_REG(HASH->STR, HASH_STR_NBLW, 8 * ((__SIZE__) % 4)) | |||
| #define __HAL_HASH_SET_NBVALIDBITS(__SIZE__) MODIFY_REG(HASH->STR, HASH_STR_NBLW, 8U * ((__SIZE__) % 4U)) | |||
| /** | |||
| * @brief Reset the HASH core. | |||
| @@ -342,20 +382,18 @@ typedef struct | |||
| /** @defgroup HASH_Private_Macros HASH Private Macros | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief Return digest length in bytes. | |||
| * @retval Digest length | |||
| */ | |||
| #define HASH_DIGEST_LENGTH() ((READ_BIT(HASH->CR, HASH_CR_ALGO) == HASH_ALGOSELECTION_SHA1) ? 20 : \ | |||
| ((READ_BIT(HASH->CR, HASH_CR_ALGO) == HASH_ALGOSELECTION_SHA224) ? 28 : \ | |||
| ((READ_BIT(HASH->CR, HASH_CR_ALGO) == HASH_ALGOSELECTION_SHA256) ? 32 : 16 ) ) ) | |||
| #define HASH_DIGEST_LENGTH() ((READ_BIT(HASH->CR, HASH_CR_ALGO) == HASH_ALGOSELECTION_SHA1) ? 20U : \ | |||
| ((READ_BIT(HASH->CR, HASH_CR_ALGO) == HASH_ALGOSELECTION_SHA224) ? 28U : \ | |||
| ((READ_BIT(HASH->CR, HASH_CR_ALGO) == HASH_ALGOSELECTION_SHA256) ? 32U : 16U ) ) ) | |||
| /** | |||
| * @brief Return number of words already pushed in the FIFO. | |||
| * @retval Number of words already pushed in the FIFO | |||
| */ | |||
| #define HASH_NBW_PUSHED() ((READ_BIT(HASH->CR, HASH_CR_NBW)) >> 8) | |||
| #define HASH_NBW_PUSHED() ((READ_BIT(HASH->CR, HASH_CR_NBW)) >> 8U) | |||
| /** | |||
| * @brief Ensure that HASH input data type is valid. | |||
| @@ -376,8 +414,7 @@ typedef struct | |||
| * @param __SIZE__: input data buffer size. | |||
| * @retval SET (__SIZE__ is valid) or RESET (__SIZE__ is invalid) | |||
| */ | |||
| #define IS_HASH_POLLING_MULTIBUFFER_SIZE(__SIZE__) (((__SIZE__) % 4) == 0) | |||
| #define IS_HASH_POLLING_MULTIBUFFER_SIZE(__SIZE__) (((__SIZE__) % 4U) == 0U) | |||
| /** | |||
| * @brief Ensure that input data buffer size is valid for multi-buffer HASH | |||
| * processing in DMA mode. | |||
| @@ -385,7 +422,7 @@ typedef struct | |||
| * @param __SIZE__: input data buffer size. | |||
| * @retval SET (__SIZE__ is valid) or RESET (__SIZE__ is invalid) | |||
| */ | |||
| #define IS_HASH_DMA_MULTIBUFFER_SIZE(__SIZE__) ((READ_BIT(HASH->CR, HASH_CR_MDMAT) == RESET) || (((__SIZE__) % 4) == 0)) | |||
| #define IS_HASH_DMA_MULTIBUFFER_SIZE(__SIZE__) ((READ_BIT(HASH->CR, HASH_CR_MDMAT) == 0U) || (((__SIZE__) % 4U) == 0U)) | |||
| /** | |||
| * @brief Ensure that input data buffer size is valid for multi-buffer HMAC | |||
| @@ -395,8 +432,7 @@ typedef struct | |||
| * @param __SIZE__: input data buffer size. | |||
| * @retval SET (__SIZE__ is valid) or RESET (__SIZE__ is invalid) | |||
| */ | |||
| #define IS_HMAC_DMA_MULTIBUFFER_SIZE(__HANDLE__,__SIZE__) ((((__HANDLE__)->DigestCalculationDisable) == RESET) || (((__SIZE__) % 4) == 0)) | |||
| #define IS_HMAC_DMA_MULTIBUFFER_SIZE(__HANDLE__,__SIZE__) ((((__HANDLE__)->DigestCalculationDisable) == RESET) || (((__SIZE__) % 4U) == 0U)) | |||
| /** | |||
| * @brief Ensure that handle phase is set to HASH processing. | |||
| * @param __HANDLE__: HASH handle. | |||
| @@ -417,7 +453,6 @@ typedef struct | |||
| * @} | |||
| */ | |||
| /* Include HASH HAL Extended module */ | |||
| #include "stm32h7xx_hal_hash_ex.h" | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| @@ -438,6 +473,12 @@ 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); | |||
| /* Callbacks Register/UnRegister functions ***********************************/ | |||
| #if (USE_HAL_HASH_REGISTER_CALLBACKS == 1) | |||
| HAL_StatusTypeDef HAL_HASH_RegisterCallback(HASH_HandleTypeDef *hhash, HAL_HASH_CallbackIDTypeDef CallbackID, pHASH_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_HASH_UnRegisterCallback(HASH_HandleTypeDef *hhash, HAL_HASH_CallbackIDTypeDef CallbackID); | |||
| #endif /* USE_HAL_HASH_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| @@ -531,6 +572,7 @@ void HAL_HASH_ContextSaving(HASH_HandleTypeDef *hhash, uint8_t* pMemBuffer); | |||
| void HAL_HASH_ContextRestoring(HASH_HandleTypeDef *hhash, uint8_t* pMemBuffer); | |||
| void HAL_HASH_SwFeed_ProcessSuspend(HASH_HandleTypeDef *hhash); | |||
| HAL_StatusTypeDef HAL_HASH_DMAFeed_ProcessSuspend(HASH_HandleTypeDef *hhash); | |||
| uint32_t HAL_HASH_GetError(HASH_HandleTypeDef *hhash); | |||
| /** | |||
| * @} | |||
| @@ -563,7 +605,7 @@ HAL_StatusTypeDef HMAC_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* HASH */ | |||
| #endif /* HASH*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -574,6 +616,6 @@ HAL_StatusTypeDef HMAC_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_HASH_H */ | |||
| #endif /* STM32H7xx_HAL_HASH_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_hash_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of HASH HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_HASH_EX_H | |||
| #define __STM32H7xx_HAL_HASH_EX_H | |||
| #ifndef STM32H7xx_HAL_HASH_EX_H | |||
| #define STM32H7xx_HAL_HASH_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -49,9 +31,7 @@ | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| #if defined (HASH) | |||
| #if defined (HASH) | |||
| /** @addtogroup HASHEx | |||
| * @{ | |||
| */ | |||
| @@ -145,7 +125,6 @@ HAL_StatusTypeDef HAL_HMACEx_MD5_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t | |||
| HAL_StatusTypeDef HAL_HMACEx_SHA1_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| HAL_StatusTypeDef HAL_HMACEx_SHA1_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| HAL_StatusTypeDef HAL_HMACEx_SHA1_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| HAL_StatusTypeDef HAL_HMACEx_SHA224_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| HAL_StatusTypeDef HAL_HMACEx_SHA224_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| HAL_StatusTypeDef HAL_HMACEx_SHA224_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| @@ -153,7 +132,6 @@ HAL_StatusTypeDef HAL_HMACEx_SHA224_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8 | |||
| HAL_StatusTypeDef HAL_HMACEx_SHA256_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| HAL_StatusTypeDef HAL_HMACEx_SHA256_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| HAL_StatusTypeDef HAL_HMACEx_SHA256_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -165,15 +143,17 @@ HAL_StatusTypeDef HAL_HMACEx_SHA256_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8 | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* HASH */ | |||
| #endif /* HASH*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_HASH_EX_H */ | |||
| #endif /* STM32H7xx_HAL_HASH_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,56 +2,38 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_hcd.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of HCD HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_HCD_H | |||
| #define __STM32H7xx_HAL_HCD_H | |||
| #ifndef STM32H7xx_HAL_HCD_H | |||
| #define STM32H7xx_HAL_HCD_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_ll_usb.h" | |||
| #if defined (USB_OTG_FS) || defined (USB_OTG_HS) | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @defgroup HCD HCD | |||
| * @brief HCD HAL module driver | |||
| /** @addtogroup HCD | |||
| * @{ | |||
| */ | |||
| @@ -65,18 +47,18 @@ | |||
| */ | |||
| 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 | |||
| HAL_HCD_STATE_RESET = 0x00, | |||
| HAL_HCD_STATE_READY = 0x01, | |||
| HAL_HCD_STATE_ERROR = 0x02, | |||
| HAL_HCD_STATE_BUSY = 0x03, | |||
| HAL_HCD_STATE_TIMEOUT = 0x04 | |||
| } 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 ; | |||
| typedef USB_OTG_HCTypeDef HCD_HCTypeDef; | |||
| typedef USB_OTG_URBStateTypeDef HCD_URBStateTypeDef; | |||
| typedef USB_OTG_HCStateTypeDef HCD_HCStateTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -84,14 +66,31 @@ typedef USB_OTG_HCStateTypeDef HCD_HCStateTypeDef ; | |||
| /** @defgroup HCD_Exported_Types_Group2 HCD Handle Structure definition | |||
| * @{ | |||
| */ | |||
| #if (USE_HAL_HCD_REGISTER_CALLBACKS == 1U) | |||
| typedef struct __HCD_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_HCD_REGISTER_CALLBACKS */ | |||
| { | |||
| HCD_TypeDef *Instance; /*!< Register base address */ | |||
| HCD_InitTypeDef Init; /*!< HCD required parameters */ | |||
| HCD_HCTypeDef hc[15]; /*!< Host channels parameters */ | |||
| HCD_HCTypeDef hc[16]; /*!< Host channels parameters */ | |||
| HAL_LockTypeDef Lock; /*!< HCD peripheral status */ | |||
| __IO HCD_StateTypeDef State; /*!< HCD communication state */ | |||
| __IO uint32_t ErrorCode; /*!< HCD Error code */ | |||
| void *pData; /*!< Pointer Stack Handler */ | |||
| #if (USE_HAL_HCD_REGISTER_CALLBACKS == 1U) | |||
| void (* SOFCallback)(struct __HCD_HandleTypeDef *hhcd); /*!< USB OTG HCD SOF callback */ | |||
| void (* ConnectCallback)(struct __HCD_HandleTypeDef *hhcd); /*!< USB OTG HCD Connect callback */ | |||
| void (* DisconnectCallback)(struct __HCD_HandleTypeDef *hhcd); /*!< USB OTG HCD Disconnect callback */ | |||
| void (* PortEnabledCallback)(struct __HCD_HandleTypeDef *hhcd); /*!< USB OTG HCD Port Enable callback */ | |||
| void (* PortDisabledCallback)(struct __HCD_HandleTypeDef *hhcd); /*!< USB OTG HCD Port Disable callback */ | |||
| void (* HC_NotifyURBChangeCallback)(struct __HCD_HandleTypeDef *hhcd, uint8_t chnum, | |||
| HCD_URBStateTypeDef urb_state); /*!< USB OTG HCD Host Channel Notify URB Change callback */ | |||
| void (* MspInitCallback)(struct __HCD_HandleTypeDef *hhcd); /*!< USB OTG HCD Msp Init callback */ | |||
| void (* MspDeInitCallback)(struct __HCD_HandleTypeDef *hhcd); /*!< USB OTG HCD Msp DeInit callback */ | |||
| #endif /* USE_HAL_HCD_REGISTER_CALLBACKS */ | |||
| } HCD_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| @@ -109,9 +108,10 @@ typedef struct | |||
| /** @defgroup HCD_Speed HCD Speed | |||
| * @{ | |||
| */ | |||
| #define HCD_SPEED_HIGH 0U | |||
| #define HCD_SPEED_LOW 2U | |||
| #define HCD_SPEED_FULL 3U | |||
| #define HCD_SPEED_HIGH USBH_HS_SPEED | |||
| #define HCD_SPEED_FULL USBH_FS_SPEED | |||
| #define HCD_SPEED_LOW USBH_LS_SPEED | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -121,6 +121,18 @@ typedef struct | |||
| */ | |||
| #define HCD_PHY_ULPI 1U | |||
| #define HCD_PHY_EMBEDDED 2U | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HCD_Error_Code_definition HCD Error Code definition | |||
| * @brief HCD Error Code definition | |||
| * @{ | |||
| */ | |||
| #if (USE_HAL_HCD_REGISTER_CALLBACKS == 1U) | |||
| #define HAL_HCD_ERROR_INVALID_CALLBACK (0x00000010U) /*!< Invalid Callback error */ | |||
| #endif /* USE_HAL_HCD_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -134,8 +146,8 @@ typedef struct | |||
| * @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_ENABLE(__HANDLE__) (void)USB_EnableGlobalInt ((__HANDLE__)->Instance) | |||
| #define __HAL_HCD_DISABLE(__HANDLE__) (void)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__)) | |||
| @@ -159,18 +171,59 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_HCD_Init(HCD_HandleTypeDef *hhcd); | |||
| HAL_StatusTypeDef HAL_HCD_DeInit (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); | |||
| 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); | |||
| #if (USE_HAL_HCD_REGISTER_CALLBACKS == 1U) | |||
| /** @defgroup HAL_HCD_Callback_ID_enumeration_definition HAL USB OTG HCD Callback ID enumeration definition | |||
| * @brief HAL USB OTG HCD Callback ID enumeration definition | |||
| * @{ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_HCD_SOF_CB_ID = 0x01, /*!< USB HCD SOF callback ID */ | |||
| HAL_HCD_CONNECT_CB_ID = 0x02, /*!< USB HCD Connect callback ID */ | |||
| HAL_HCD_DISCONNECT_CB_ID = 0x03, /*!< USB HCD Disconnect callback ID */ | |||
| HAL_HCD_PORT_ENABLED_CB_ID = 0x04, /*!< USB HCD Port Enable callback ID */ | |||
| HAL_HCD_PORT_DISABLED_CB_ID = 0x05, /*!< USB HCD Port Disable callback ID */ | |||
| HAL_HCD_MSPINIT_CB_ID = 0x06, /*!< USB HCD MspInit callback ID */ | |||
| HAL_HCD_MSPDEINIT_CB_ID = 0x07 /*!< USB HCD MspDeInit callback ID */ | |||
| } HAL_HCD_CallbackIDTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_HCD_Callback_pointer_definition HAL USB OTG HCD Callback pointer definition | |||
| * @brief HAL USB OTG HCD Callback pointer definition | |||
| * @{ | |||
| */ | |||
| typedef void (*pHCD_CallbackTypeDef)(HCD_HandleTypeDef *hhcd); /*!< pointer to a common USB OTG HCD callback function */ | |||
| typedef void (*pHCD_HC_NotifyURBChangeCallbackTypeDef)(HCD_HandleTypeDef *hhcd, | |||
| uint8_t epnum, | |||
| HCD_URBStateTypeDef urb_state); /*!< pointer to USB OTG HCD host channel callback */ | |||
| /** | |||
| * @} | |||
| */ | |||
| HAL_StatusTypeDef HAL_HCD_RegisterCallback(HCD_HandleTypeDef *hhcd, HAL_HCD_CallbackIDTypeDef CallbackID, pHCD_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_HCD_UnRegisterCallback(HCD_HandleTypeDef *hhcd, HAL_HCD_CallbackIDTypeDef CallbackID); | |||
| HAL_StatusTypeDef HAL_HCD_RegisterHC_NotifyURBChangeCallback(HCD_HandleTypeDef *hhcd, pHCD_HC_NotifyURBChangeCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_HCD_UnRegisterHC_NotifyURBChangeCallback(HCD_HandleTypeDef *hhcd); | |||
| #endif /* USE_HAL_HCD_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -180,22 +233,24 @@ void HAL_HCD_MspDeInit(HCD_HandleTypeDef *hhcd); | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_HCD_HC_SubmitRequest(HCD_HandleTypeDef *hhcd, | |||
| uint8_t pipe, | |||
| uint8_t direction , | |||
| uint8_t ch_num, | |||
| uint8_t direction, | |||
| uint8_t ep_type, | |||
| uint8_t token, | |||
| uint8_t* pbuff, | |||
| uint8_t *pbuff, | |||
| uint16_t length, | |||
| uint8_t do_ping); | |||
| /* Non-Blocking mode: Interrupt */ | |||
| void HAL_HCD_IRQHandler(HCD_HandleTypeDef *hhcd); | |||
| /* 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_PortEnabled_Callback(HCD_HandleTypeDef *hhcd); | |||
| void HAL_HCD_PortDisabled_Callback(HCD_HandleTypeDef *hhcd); | |||
| void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *hhcd, | |||
| uint8_t chnum, | |||
| HCD_URBStateTypeDef urb_state); | |||
| uint8_t chnum, | |||
| HCD_URBStateTypeDef urb_state); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -233,14 +288,6 @@ uint32_t HAL_HCD_GetCurrentSpeed(HCD_HandleTypeDef *hhcd); | |||
| /** @defgroup HCD_Private_Macros HCD Private Macros | |||
| * @{ | |||
| */ | |||
| /** @defgroup HCD_Instance_definition HCD Instance definition | |||
| * @{ | |||
| */ | |||
| #define IS_HCD_ALL_INSTANCE(INSTANCE) (((INSTANCE) == USB2_OTG_FS) || \ | |||
| ((INSTANCE) == USB1_OTG_HS)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| @@ -271,11 +318,12 @@ uint32_t HAL_HCD_GetCurrentSpeed(HCD_HandleTypeDef *hhcd); | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_HCD_H */ | |||
| #endif /* STM32H7xx_HAL_HCD_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,51 +2,32 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_hsem.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of HSEM HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_HSEM_H | |||
| #define __STM32H7xx_HAL_HSEM_H | |||
| #ifndef STM32H7xx_HAL_HSEM_H | |||
| #define STM32H7xx_HAL_HSEM_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_hal_def.h" | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| @@ -55,27 +36,6 @@ | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup HSEM_Exported_Types HSEM Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup HSEM_Exported_Constants HSEM Exported Constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup HSEM_Exported_Macros HSEM Exported Macros | |||
| * @{ | |||
| @@ -88,40 +48,69 @@ | |||
| */ | |||
| #define __HAL_HSEM_SEMID_TO_MASK(__SEMID__) (1 << (__SEMID__)) | |||
| /** | |||
| * @brief Enables the specified HSEM interrupts. | |||
| * @param __SEM_MASK__: semaphores Mask | |||
| * @retval None. | |||
| */ | |||
| #if defined(DUAL_CORE) | |||
| #define __HAL_HSEM_ENABLE_IT(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ | |||
| (HSEM->C1IER |= (__SEM_MASK__)) : \ | |||
| (HSEM->C2IER |= (__SEM_MASK__))) | |||
| #else | |||
| #define __HAL_HSEM_ENABLE_IT(__SEM_MASK__) (HSEM->IER |= (__SEM_MASK__)) | |||
| #endif /* DUAL_CORE */ | |||
| /** | |||
| * @brief Disables the specified HSEM interrupts. | |||
| * @param __SEM_MASK__: semaphores Mask | |||
| * @retval None. | |||
| */ | |||
| #if defined(DUAL_CORE) | |||
| #define __HAL_HSEM_DISABLE_IT(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ | |||
| (HSEM->C1IER &= ~(__SEM_MASK__)) : \ | |||
| (HSEM->C2IER &= ~(__SEM_MASK__))) | |||
| #else | |||
| #define __HAL_HSEM_DISABLE_IT(__SEM_MASK__) (HSEM->IER &= ~(__SEM_MASK__)) | |||
| #endif /* DUAL_CORE */ | |||
| /** | |||
| * @brief Checks whether interrupt has occurred or not for semaphores specified by a mask. | |||
| * @param __SEM_MASK__: semaphores Mask | |||
| * @retval semaphores Mask : Semaphores where an interrupt occurred. | |||
| * @retval semaphores Mask : Semaphores where an interrupt occurred. | |||
| */ | |||
| #if defined(DUAL_CORE) | |||
| #define __HAL_HSEM_GET_IT(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ | |||
| ((__SEM_MASK__) & HSEM->C1MISR) : \ | |||
| ((__SEM_MASK__) & HSEM->C2MISR1)) | |||
| #else | |||
| #define __HAL_HSEM_GET_IT(__SEM_MASK__) ((__SEM_MASK__) & HSEM->MISR) | |||
| #endif /* DUAL_CORE */ | |||
| /** | |||
| * @brief Get the semaphores release status flags. | |||
| * @param __SEM_MASK__: semaphores Mask | |||
| * @retval semaphores Mask : Semaphores where Release flags rise. | |||
| */ | |||
| #if defined(DUAL_CORE) | |||
| #define __HAL_HSEM_GET_FLAG(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ | |||
| (__SEM_MASK__) & HSEM->C1ISR : \ | |||
| (__SEM_MASK__) & HSEM->C2ISR) | |||
| #else | |||
| #define __HAL_HSEM_GET_FLAG(__SEM_MASK__) ((__SEM_MASK__) & HSEM->ISR) | |||
| #endif /* DUAL_CORE */ | |||
| /** | |||
| * @brief Clears the HSEM Interrupt flags. | |||
| * @param __SEM_MASK__: semaphores Mask | |||
| * @retval None. | |||
| */ | |||
| #if defined(DUAL_CORE) | |||
| #define __HAL_HSEM_CLEAR_FLAG(__SEM_MASK__) ((((SCB->CPUID & 0x000000F0) >> 4 )== 0x7) ? \ | |||
| (HSEM->C1ICR |= (__SEM_MASK__)) : \ | |||
| (HSEM->C2ICR |= (__SEM_MASK__))) | |||
| #else | |||
| #define __HAL_HSEM_CLEAR_FLAG(__SEM_MASK__) (HSEM->ICR |= (__SEM_MASK__)) | |||
| #endif /* DUAL_CORE */ | |||
| /** | |||
| * @} | |||
| @@ -132,7 +121,6 @@ | |||
| * @{ | |||
| */ | |||
| /** @addtogroup HSEM_Exported_Functions_Group1 Take and Release functions | |||
| * @brief HSEM Take and Release functions | |||
| * @{ | |||
| @@ -147,7 +135,7 @@ uint32_t HAL_HSEM_IsSemTaken(uint32_t SemID); | |||
| /* HSEM Release **************************************************************/ | |||
| void HAL_HSEM_Release(uint32_t SemID, uint32_t ProcessID); | |||
| /* HSEM Release All************************************************************/ | |||
| void HAL_HSEM_ReleaseAll(uint32_t Key, uint32_t MasterID); | |||
| void HAL_HSEM_ReleaseAll(uint32_t Key, uint32_t CoreID); | |||
| /** | |||
| * @} | |||
| @@ -165,7 +153,6 @@ uint32_t HAL_HSEM_GetClearKey(void); | |||
| * @} | |||
| */ | |||
| /** @addtogroup HSEM_Exported_Functions_Group3 | |||
| * @brief HSEM Notification functions | |||
| * @{ | |||
| @@ -179,39 +166,10 @@ void HAL_HSEM_FreeCallback(uint32_t SemMask); | |||
| /* HSEM IRQ Handler **********************************************************/ | |||
| void HAL_HSEM_IRQHandler(void); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /** @defgroup HSEM_Private_Types HSEM Private Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /** @defgroup HSEM_Private_Variables HSEM Private Variables | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup HSEM_Private_Constants HSEM Private Constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -227,7 +185,14 @@ void HAL_HSEM_IRQHandler(void); | |||
| #define IS_HSEM_KEY(__KEY__) ((__KEY__) <= HSEM_CLEAR_KEY_MAX ) | |||
| #define IS_HSEM_MASTERID(__MASTERID__) (((__MASTERID__) == HSEM_CM7_MASTERID)) | |||
| #if defined(DUAL_CORE) | |||
| #define IS_HSEM_COREID(__COREID__) (((__COREID__) == HSEM_CPU1_COREID) || \ | |||
| ((__COREID__) == HSEM_CPU2_COREID)) | |||
| #else | |||
| #define IS_HSEM_COREID(__COREID__) ((__COREID__) == HSEM_CPU1_COREID) | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -244,6 +209,6 @@ void HAL_HSEM_IRQHandler(void); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_HSEM_H */ | |||
| #endif /* STM32H7xx_HAL_HSEM_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_i2c.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of I2C HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_I2C_H | |||
| #define __STM32H7xx_HAL_I2C_H | |||
| #ifndef STM32H7xx_HAL_I2C_H | |||
| #define STM32H7xx_HAL_I2C_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -90,7 +72,7 @@ typedef struct | |||
| uint32_t NoStretchMode; /*!< Specifies if nostretch mode is selected. | |||
| This parameter can be a value of @ref I2C_NOSTRETCH_MODE */ | |||
| }I2C_InitTypeDef; | |||
| } I2C_InitTypeDef; | |||
| /** | |||
| * @} | |||
| @@ -98,9 +80,31 @@ typedef struct | |||
| /** @defgroup HAL_state_structure_definition HAL state structure definition | |||
| * @brief HAL State structure definition | |||
| * @note HAL I2C State value coding follow below described bitmap :\n | |||
| * b7-b6 Error information\n | |||
| * 00 : No Error\n | |||
| * 01 : Abort (Abort user request on going)\n | |||
| * 10 : Timeout\n | |||
| * 11 : Error\n | |||
| * b5 Peripheral initialization status\n | |||
| * 0 : Reset (peripheral not initialized)\n | |||
| * 1 : Init done (peripheral initialized and ready to use. HAL I2C Init function called)\n | |||
| * b4 (not used)\n | |||
| * x : Should be set to 0\n | |||
| * b3\n | |||
| * 0 : Ready or Busy (No Listen mode ongoing)\n | |||
| * 1 : Listen (peripheral in Address Listen Mode)\n | |||
| * b2 Intrinsic process state\n | |||
| * 0 : Ready\n | |||
| * 1 : Busy (peripheral busy with some configuration or internal operations)\n | |||
| * b1 Rx state\n | |||
| * 0 : Ready (no Rx operation ongoing)\n | |||
| * 1 : Busy (Rx operation ongoing)\n | |||
| * b0 Tx state\n | |||
| * 0 : Ready (no Tx operation ongoing)\n | |||
| * 1 : Busy (Tx operation ongoing) | |||
| * @{ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_I2C_STATE_RESET = 0x00U, /*!< Peripheral is not yet Initialized */ | |||
| @@ -110,14 +114,14 @@ typedef enum | |||
| HAL_I2C_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing */ | |||
| HAL_I2C_STATE_LISTEN = 0x28U, /*!< Address Listen Mode is ongoing */ | |||
| HAL_I2C_STATE_BUSY_TX_LISTEN = 0x29U, /*!< Address Listen Mode and Data Transmission | |||
| process is ongoing */ | |||
| process is ongoing */ | |||
| HAL_I2C_STATE_BUSY_RX_LISTEN = 0x2AU, /*!< Address Listen Mode and Data Reception | |||
| process is ongoing */ | |||
| process is ongoing */ | |||
| HAL_I2C_STATE_ABORT = 0x60U, /*!< Abort user request ongoing */ | |||
| HAL_I2C_STATE_TIMEOUT = 0xA0U, /*!< Timeout state */ | |||
| HAL_I2C_STATE_ERROR = 0xE0U /*!< Error */ | |||
| }HAL_I2C_StateTypeDef; | |||
| } HAL_I2C_StateTypeDef; | |||
| /** | |||
| * @} | |||
| @@ -125,6 +129,20 @@ typedef enum | |||
| /** @defgroup HAL_mode_structure_definition HAL mode structure definition | |||
| * @brief HAL Mode structure definition | |||
| * @note HAL I2C Mode value coding follow below described bitmap :\n | |||
| * b7 (not used)\n | |||
| * x : Should be set to 0\n | |||
| * b6\n | |||
| * 0 : None\n | |||
| * 1 : Memory (HAL I2C communication is in Memory Mode)\n | |||
| * b5\n | |||
| * 0 : None\n | |||
| * 1 : Slave (HAL I2C communication is in Slave Mode)\n | |||
| * b4\n | |||
| * 0 : None\n | |||
| * 1 : Master (HAL I2C communication is in Master Mode)\n | |||
| * b3-b2-b1-b0 (not used)\n | |||
| * xxxx : Should be set to 0000 | |||
| * @{ | |||
| */ | |||
| typedef enum | |||
| @@ -134,7 +152,7 @@ typedef enum | |||
| HAL_I2C_MODE_SLAVE = 0x20U, /*!< I2C communication is in Slave Mode */ | |||
| HAL_I2C_MODE_MEM = 0x40U /*!< I2C communication is in Memory Mode */ | |||
| }HAL_I2C_ModeTypeDef; | |||
| } HAL_I2C_ModeTypeDef; | |||
| /** | |||
| * @} | |||
| @@ -152,6 +170,11 @@ typedef enum | |||
| #define HAL_I2C_ERROR_DMA (0x00000010U) /*!< DMA transfer error */ | |||
| #define HAL_I2C_ERROR_TIMEOUT (0x00000020U) /*!< Timeout error */ | |||
| #define HAL_I2C_ERROR_SIZE (0x00000040U) /*!< Size Management error */ | |||
| #define HAL_I2C_ERROR_DMA_PARAM (0x00000080U) /*!< DMA Parameter Error */ | |||
| #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1) | |||
| #define HAL_I2C_ERROR_INVALID_CALLBACK (0x00000100U) /*!< Invalid Callback error */ | |||
| #endif /* USE_HAL_I2C_REGISTER_CALLBACKS */ | |||
| #define HAL_I2C_ERROR_INVALID_PARAM (0x00000200U) /*!< Invalid Parameters error */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -177,7 +200,7 @@ typedef struct __I2C_HandleTypeDef | |||
| __IO uint32_t PreviousState; /*!< I2C communication Previous state */ | |||
| HAL_StatusTypeDef (*XferISR)(struct __I2C_HandleTypeDef *hi2c, uint32_t ITFlags, uint32_t ITSources); /*!< I2C transfer IRQ handler function pointer */ | |||
| HAL_StatusTypeDef(*XferISR)(struct __I2C_HandleTypeDef *hi2c, uint32_t ITFlags, uint32_t ITSources); /*!< I2C transfer IRQ handler function pointer */ | |||
| DMA_HandleTypeDef *hdmatx; /*!< I2C Tx DMA handle parameters */ | |||
| @@ -192,7 +215,54 @@ typedef struct __I2C_HandleTypeDef | |||
| __IO uint32_t ErrorCode; /*!< I2C Error code */ | |||
| __IO uint32_t AddrEventCount; /*!< I2C Address Event counter */ | |||
| }I2C_HandleTypeDef; | |||
| #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1) | |||
| void (* MasterTxCpltCallback)(struct __I2C_HandleTypeDef *hi2c); /*!< I2C Master Tx Transfer completed callback */ | |||
| void (* MasterRxCpltCallback)(struct __I2C_HandleTypeDef *hi2c); /*!< I2C Master Rx Transfer completed callback */ | |||
| void (* SlaveTxCpltCallback)(struct __I2C_HandleTypeDef *hi2c); /*!< I2C Slave Tx Transfer completed callback */ | |||
| void (* SlaveRxCpltCallback)(struct __I2C_HandleTypeDef *hi2c); /*!< I2C Slave Rx Transfer completed callback */ | |||
| void (* ListenCpltCallback)(struct __I2C_HandleTypeDef *hi2c); /*!< I2C Listen Complete callback */ | |||
| void (* MemTxCpltCallback)(struct __I2C_HandleTypeDef *hi2c); /*!< I2C Memory Tx Transfer completed callback */ | |||
| void (* MemRxCpltCallback)(struct __I2C_HandleTypeDef *hi2c); /*!< I2C Memory Rx Transfer completed callback */ | |||
| void (* ErrorCallback)(struct __I2C_HandleTypeDef *hi2c); /*!< I2C Error callback */ | |||
| void (* AbortCpltCallback)(struct __I2C_HandleTypeDef *hi2c); /*!< I2C Abort callback */ | |||
| void (* AddrCallback)(struct __I2C_HandleTypeDef *hi2c, uint8_t TransferDirection, uint16_t AddrMatchCode); /*!< I2C Slave Address Match callback */ | |||
| void (* MspInitCallback)(struct __I2C_HandleTypeDef *hi2c); /*!< I2C Msp Init callback */ | |||
| void (* MspDeInitCallback)(struct __I2C_HandleTypeDef *hi2c); /*!< I2C Msp DeInit callback */ | |||
| #endif /* USE_HAL_I2C_REGISTER_CALLBACKS */ | |||
| } I2C_HandleTypeDef; | |||
| #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL I2C Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_I2C_MASTER_TX_COMPLETE_CB_ID = 0x00U, /*!< I2C Master Tx Transfer completed callback ID */ | |||
| HAL_I2C_MASTER_RX_COMPLETE_CB_ID = 0x01U, /*!< I2C Master Rx Transfer completed callback ID */ | |||
| HAL_I2C_SLAVE_TX_COMPLETE_CB_ID = 0x02U, /*!< I2C Slave Tx Transfer completed callback ID */ | |||
| HAL_I2C_SLAVE_RX_COMPLETE_CB_ID = 0x03U, /*!< I2C Slave Rx Transfer completed callback ID */ | |||
| HAL_I2C_LISTEN_COMPLETE_CB_ID = 0x04U, /*!< I2C Listen Complete callback ID */ | |||
| HAL_I2C_MEM_TX_COMPLETE_CB_ID = 0x05U, /*!< I2C Memory Tx Transfer callback ID */ | |||
| HAL_I2C_MEM_RX_COMPLETE_CB_ID = 0x06U, /*!< I2C Memory Rx Transfer completed callback ID */ | |||
| HAL_I2C_ERROR_CB_ID = 0x07U, /*!< I2C Error callback ID */ | |||
| HAL_I2C_ABORT_CB_ID = 0x08U, /*!< I2C Abort callback ID */ | |||
| HAL_I2C_MSPINIT_CB_ID = 0x09U, /*!< I2C Msp Init callback ID */ | |||
| HAL_I2C_MSPDEINIT_CB_ID = 0x0AU /*!< I2C Msp DeInit callback ID */ | |||
| } HAL_I2C_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL I2C Callback pointer definition | |||
| */ | |||
| typedef void (*pI2C_CallbackTypeDef)(I2C_HandleTypeDef *hi2c); /*!< pointer to an I2C callback function */ | |||
| typedef void (*pI2C_AddrCallbackTypeDef)(I2C_HandleTypeDef *hi2c, uint8_t TransferDirection, uint16_t AddrMatchCode); /*!< pointer to an I2C Address Match callback function */ | |||
| #endif /* USE_HAL_I2C_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -209,12 +279,18 @@ typedef struct __I2C_HandleTypeDef | |||
| /** @defgroup I2C_XFEROPTIONS I2C Sequential Transfer Options | |||
| * @{ | |||
| */ | |||
| #define I2C_NO_OPTION_FRAME (0xFFFF0000U) | |||
| #define I2C_FIRST_FRAME ((uint32_t)I2C_SOFTEND_MODE) | |||
| #define I2C_FIRST_AND_NEXT_FRAME ((uint32_t)(I2C_RELOAD_MODE | I2C_SOFTEND_MODE)) | |||
| #define I2C_NEXT_FRAME ((uint32_t)(I2C_RELOAD_MODE | I2C_SOFTEND_MODE)) | |||
| #define I2C_FIRST_AND_LAST_FRAME ((uint32_t)I2C_AUTOEND_MODE) | |||
| #define I2C_LAST_FRAME ((uint32_t)I2C_AUTOEND_MODE) | |||
| #define I2C_LAST_FRAME_NO_STOP ((uint32_t)I2C_SOFTEND_MODE) | |||
| /* List of XferOptions in usage of : | |||
| * 1- Restart condition in all use cases (direction change or not) | |||
| */ | |||
| #define I2C_OTHER_FRAME (0x000000AAU) | |||
| #define I2C_OTHER_AND_LAST_FRAME (0x0000AA00U) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -279,7 +355,7 @@ typedef struct __I2C_HandleTypeDef | |||
| * @} | |||
| */ | |||
| /** @defgroup I2C_XferDirection I2C Transfer Direction | |||
| /** @defgroup I2C_XFERDIRECTION I2C Transfer Direction Master Point of View | |||
| * @{ | |||
| */ | |||
| #define I2C_DIRECTION_TRANSMIT (0x00000000U) | |||
| @@ -363,7 +439,15 @@ typedef struct __I2C_HandleTypeDef | |||
| * @param __HANDLE__ specifies the I2C Handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_I2C_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->State = HAL_I2C_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_I2C_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_I2C_STATE_RESET) | |||
| #endif | |||
| /** @brief Enable the specified I2C interrupt. | |||
| * @param __HANDLE__ specifies the I2C Handle. | |||
| @@ -436,6 +520,7 @@ typedef struct __I2C_HandleTypeDef | |||
| * | |||
| * @retval The new state of __FLAG__ (SET or RESET). | |||
| */ | |||
| #define I2C_FLAG_MASK (0x0001FFFFU) | |||
| #define __HAL_I2C_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) == (__FLAG__)) ? SET : RESET) | |||
| /** @brief Clear the I2C pending flags which are cleared by writing 1 in a specific bit. | |||
| @@ -471,7 +556,7 @@ typedef struct __I2C_HandleTypeDef | |||
| #define __HAL_I2C_DISABLE(__HANDLE__) (CLEAR_BIT((__HANDLE__)->Instance->CR1, I2C_CR1_PE)) | |||
| /** @brief Generate a Non-Acknowledge I2C peripheral in Slave mode. | |||
| * @param __HANDLE__: specifies the I2C Handle. | |||
| * @param __HANDLE__ specifies the I2C Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_I2C_GENERATE_NACK(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR2, I2C_CR2_NACK)) | |||
| @@ -492,9 +577,18 @@ typedef struct __I2C_HandleTypeDef | |||
| */ | |||
| /* Initialization and de-initialization functions******************************/ | |||
| HAL_StatusTypeDef HAL_I2C_Init(I2C_HandleTypeDef *hi2c); | |||
| HAL_StatusTypeDef HAL_I2C_DeInit (I2C_HandleTypeDef *hi2c); | |||
| HAL_StatusTypeDef HAL_I2C_DeInit(I2C_HandleTypeDef *hi2c); | |||
| void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c); | |||
| void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c); | |||
| /* Callbacks Register/UnRegister functions ***********************************/ | |||
| #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1) | |||
| HAL_StatusTypeDef HAL_I2C_RegisterCallback(I2C_HandleTypeDef *hi2c, HAL_I2C_CallbackIDTypeDef CallbackID, pI2C_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_I2C_UnRegisterCallback(I2C_HandleTypeDef *hi2c, HAL_I2C_CallbackIDTypeDef CallbackID); | |||
| HAL_StatusTypeDef HAL_I2C_RegisterAddrCallback(I2C_HandleTypeDef *hi2c, pI2C_AddrCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_I2C_UnRegisterAddrCallback(I2C_HandleTypeDef *hi2c); | |||
| #endif /* USE_HAL_I2C_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -503,7 +597,7 @@ void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c); | |||
| * @{ | |||
| */ | |||
| /* IO operation functions ****************************************************/ | |||
| /******* Blocking mode: Polling */ | |||
| /******* Blocking mode: Polling */ | |||
| HAL_StatusTypeDef HAL_I2C_Master_Transmit(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_I2C_Master_Receive(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_I2C_Slave_Transmit(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t Timeout); | |||
| @@ -512,7 +606,7 @@ HAL_StatusTypeDef HAL_I2C_Mem_Write(I2C_HandleTypeDef *hi2c, uint16_t DevAddress | |||
| HAL_StatusTypeDef HAL_I2C_Mem_Read(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_I2C_IsDeviceReady(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint32_t Trials, uint32_t Timeout); | |||
| /******* Non-Blocking mode: Interrupt */ | |||
| /******* Non-Blocking mode: Interrupt */ | |||
| HAL_StatusTypeDef HAL_I2C_Master_Transmit_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_I2C_Master_Receive_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_I2C_Slave_Transmit_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size); | |||
| @@ -520,21 +614,26 @@ HAL_StatusTypeDef HAL_I2C_Slave_Receive_IT(I2C_HandleTypeDef *hi2c, uint8_t *pDa | |||
| HAL_StatusTypeDef HAL_I2C_Mem_Write_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_I2C_Mem_Read_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions); | |||
| HAL_StatusTypeDef HAL_I2C_Master_Sequential_Receive_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions); | |||
| HAL_StatusTypeDef HAL_I2C_Slave_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions); | |||
| HAL_StatusTypeDef HAL_I2C_Slave_Sequential_Receive_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions); | |||
| HAL_StatusTypeDef HAL_I2C_Master_Seq_Transmit_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions); | |||
| HAL_StatusTypeDef HAL_I2C_Master_Seq_Receive_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions); | |||
| HAL_StatusTypeDef HAL_I2C_Slave_Seq_Transmit_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions); | |||
| HAL_StatusTypeDef HAL_I2C_Slave_Seq_Receive_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions); | |||
| HAL_StatusTypeDef HAL_I2C_EnableListen_IT(I2C_HandleTypeDef *hi2c); | |||
| HAL_StatusTypeDef HAL_I2C_DisableListen_IT(I2C_HandleTypeDef *hi2c); | |||
| HAL_StatusTypeDef HAL_I2C_Master_Abort_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress); | |||
| /******* Non-Blocking mode: DMA */ | |||
| /******* Non-Blocking mode: DMA */ | |||
| HAL_StatusTypeDef HAL_I2C_Master_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_I2C_Master_Receive_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_I2C_Slave_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_I2C_Slave_Receive_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_I2C_Mem_Write_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_I2C_Mem_Read_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_I2C_Master_Seq_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions); | |||
| HAL_StatusTypeDef HAL_I2C_Master_Seq_Receive_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t XferOptions); | |||
| HAL_StatusTypeDef HAL_I2C_Slave_Seq_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions); | |||
| HAL_StatusTypeDef HAL_I2C_Slave_Seq_Receive_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size, uint32_t XferOptions); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -626,15 +725,20 @@ uint32_t HAL_I2C_GetError(I2C_HandleTypeDef *hi2c); | |||
| ((REQUEST) == I2C_FIRST_AND_NEXT_FRAME) || \ | |||
| ((REQUEST) == I2C_NEXT_FRAME) || \ | |||
| ((REQUEST) == I2C_FIRST_AND_LAST_FRAME) || \ | |||
| ((REQUEST) == I2C_LAST_FRAME)) | |||
| ((REQUEST) == I2C_LAST_FRAME) || \ | |||
| ((REQUEST) == I2C_LAST_FRAME_NO_STOP) || \ | |||
| IS_I2C_TRANSFER_OTHER_OPTIONS_REQUEST(REQUEST)) | |||
| #define IS_I2C_TRANSFER_OTHER_OPTIONS_REQUEST(REQUEST) (((REQUEST) == I2C_OTHER_FRAME) || \ | |||
| ((REQUEST) == I2C_OTHER_AND_LAST_FRAME)) | |||
| #define I2C_RESET_CR2(__HANDLE__) ((__HANDLE__)->Instance->CR2 &= (uint32_t)~((uint32_t)(I2C_CR2_SADD | I2C_CR2_HEAD10R | I2C_CR2_NBYTES | I2C_CR2_RELOAD | I2C_CR2_RD_WRN))) | |||
| #define I2C_GET_ADDR_MATCH(__HANDLE__) (((__HANDLE__)->Instance->ISR & I2C_ISR_ADDCODE) >> 16U) | |||
| #define I2C_GET_DIR(__HANDLE__) (((__HANDLE__)->Instance->ISR & I2C_ISR_DIR) >> 16U) | |||
| #define I2C_GET_ADDR_MATCH(__HANDLE__) ((uint16_t)(((__HANDLE__)->Instance->ISR & I2C_ISR_ADDCODE) >> 16U)) | |||
| #define I2C_GET_DIR(__HANDLE__) ((uint8_t)(((__HANDLE__)->Instance->ISR & I2C_ISR_DIR) >> 16U)) | |||
| #define I2C_GET_STOP_MODE(__HANDLE__) ((__HANDLE__)->Instance->CR2 & I2C_CR2_AUTOEND) | |||
| #define I2C_GET_OWN_ADDRESS1(__HANDLE__) ((__HANDLE__)->Instance->OAR1 & I2C_OAR1_OA1) | |||
| #define I2C_GET_OWN_ADDRESS2(__HANDLE__) ((__HANDLE__)->Instance->OAR2 & I2C_OAR2_OA2) | |||
| #define I2C_GET_OWN_ADDRESS1(__HANDLE__) ((uint16_t)((__HANDLE__)->Instance->OAR1 & I2C_OAR1_OA1)) | |||
| #define I2C_GET_OWN_ADDRESS2(__HANDLE__) ((uint16_t)((__HANDLE__)->Instance->OAR2 & I2C_OAR2_OA2)) | |||
| #define IS_I2C_OWN_ADDRESS1(ADDRESS1) ((ADDRESS1) <= 0x000003FFU) | |||
| #define IS_I2C_OWN_ADDRESS2(ADDRESS2) ((ADDRESS2) <= (uint16_t)0x00FFU) | |||
| @@ -644,6 +748,9 @@ uint32_t HAL_I2C_GetError(I2C_HandleTypeDef *hi2c); | |||
| #define I2C_GENERATE_START(__ADDMODE__,__ADDRESS__) (((__ADDMODE__) == I2C_ADDRESSINGMODE_7BIT) ? (uint32_t)((((uint32_t)(__ADDRESS__) & (I2C_CR2_SADD)) | (I2C_CR2_START) | (I2C_CR2_AUTOEND)) & (~I2C_CR2_RD_WRN)) : \ | |||
| (uint32_t)((((uint32_t)(__ADDRESS__) & (I2C_CR2_SADD)) | (I2C_CR2_ADD10) | (I2C_CR2_START)) & (~I2C_CR2_RD_WRN))) | |||
| #define I2C_CHECK_FLAG(__ISR__, __FLAG__) ((((__ISR__) & ((__FLAG__) & I2C_FLAG_MASK)) == ((__FLAG__) & I2C_FLAG_MASK)) ? SET : RESET) | |||
| #define I2C_CHECK_IT_SOURCE(__CR1__, __IT__) ((((__CR1__) & (__IT__)) == (__IT__)) ? SET : RESET) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -670,6 +777,6 @@ uint32_t HAL_I2C_GetError(I2C_HandleTypeDef *hi2c); | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_I2C_H */ | |||
| #endif /* STM32H7xx_HAL_I2C_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_i2c_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of I2C HAL Extension module. | |||
| * @brief Header file of I2C HAL Extended module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_I2C_EX_H | |||
| #define __STM32H7xx_HAL_I2C_EX_H | |||
| #ifndef STM32H7xx_HAL_I2C_EX_H | |||
| #define STM32H7xx_HAL_I2C_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -50,7 +32,7 @@ | |||
| * @{ | |||
| */ | |||
| /** @addtogroup I2CEx I2CEx | |||
| /** @addtogroup I2CEx | |||
| * @{ | |||
| */ | |||
| @@ -64,8 +46,8 @@ | |||
| /** @defgroup I2CEx_Analog_Filter I2C Extended Analog Filter | |||
| * @{ | |||
| */ | |||
| #define I2C_ANALOGFILTER_ENABLE ((uint32_t)0x00000000U) | |||
| #define I2C_ANALOGFILTER_DISABLE I2C_CR1_ANFOFF | |||
| #define I2C_ANALOGFILTER_ENABLE 0x00000000U | |||
| #define I2C_ANALOGFILTER_DISABLE I2C_CR1_ANFOFF | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -73,15 +55,14 @@ | |||
| /** @defgroup I2CEx_FastModePlus I2C Extended Fast Mode Plus | |||
| * @{ | |||
| */ | |||
| #define I2C_FASTMODEPLUS_PB6 SYSCFG_PMCR_I2C_PB6_FMP | |||
| #define I2C_FASTMODEPLUS_PB7 SYSCFG_PMCR_I2C_PB7_FMP | |||
| #define I2C_FASTMODEPLUS_PB8 SYSCFG_PMCR_I2C_PB8_FMP | |||
| #define I2C_FASTMODEPLUS_PB9 SYSCFG_PMCR_I2C_PB9_FMP | |||
| #define I2C_FASTMODEPLUS_I2C1 SYSCFG_PMCR_I2C1_FMP | |||
| #define I2C_FASTMODEPLUS_I2C2 SYSCFG_PMCR_I2C2_FMP | |||
| #define I2C_FASTMODEPLUS_I2C3 SYSCFG_PMCR_I2C3_FMP | |||
| #define I2C_FASTMODEPLUS_I2C4 SYSCFG_PMCR_I2C4_FMP | |||
| #define I2C_FASTMODEPLUS_PB6 SYSCFG_PMCR_I2C_PB6_FMP /*!< Enable Fast Mode Plus on PB6 */ | |||
| #define I2C_FASTMODEPLUS_PB7 SYSCFG_PMCR_I2C_PB7_FMP /*!< Enable Fast Mode Plus on PB7 */ | |||
| #define I2C_FASTMODEPLUS_PB8 SYSCFG_PMCR_I2C_PB8_FMP /*!< Enable Fast Mode Plus on PB8 */ | |||
| #define I2C_FASTMODEPLUS_PB9 SYSCFG_PMCR_I2C_PB9_FMP /*!< Enable Fast Mode Plus on PB9 */ | |||
| #define I2C_FASTMODEPLUS_I2C1 SYSCFG_PMCR_I2C1_FMP /*!< Enable Fast Mode Plus on I2C1 pins */ | |||
| #define I2C_FASTMODEPLUS_I2C2 SYSCFG_PMCR_I2C2_FMP /*!< Enable Fast Mode Plus on I2C2 pins */ | |||
| #define I2C_FASTMODEPLUS_I2C3 SYSCFG_PMCR_I2C3_FMP /*!< Enable Fast Mode Plus on I2C3 pins */ | |||
| #define I2C_FASTMODEPLUS_I2C4 SYSCFG_PMCR_I2C4_FMP /*!< Enable Fast Mode Plus on I2C4 pins */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -128,7 +109,7 @@ void HAL_I2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus); | |||
| #define IS_I2C_DIGITAL_FILTER(FILTER) ((FILTER) <= 0x0000000FU) | |||
| #if defined(SYSCFG_PMCR_I2C1_FMP) && defined(SYSCFG_PMCR_I2C2_FMP) && defined(SYSCFG_PMCR_I2C3_FMP) && defined(SYSCFG_PMCR_I2C4_FMP) | |||
| #if (defined(SYSCFG_PMCR_I2C1_FMP) && defined(SYSCFG_PMCR_I2C2_FMP) && defined(SYSCFG_PMCR_I2C3_FMP) && defined(SYSCFG_PMCR_I2C4_FMP)) | |||
| #define IS_I2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & I2C_FASTMODEPLUS_PB6) == I2C_FASTMODEPLUS_PB6) || \ | |||
| (((__CONFIG__) & I2C_FASTMODEPLUS_PB7) == I2C_FASTMODEPLUS_PB7) || \ | |||
| (((__CONFIG__) & I2C_FASTMODEPLUS_PB8) == I2C_FASTMODEPLUS_PB8) || \ | |||
| @@ -159,6 +140,9 @@ void HAL_I2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus); | |||
| (((__CONFIG__) & I2C_FASTMODEPLUS_PB9) == I2C_FASTMODEPLUS_PB9) || \ | |||
| (((__CONFIG__) & I2C_FASTMODEPLUS_I2C1) == I2C_FASTMODEPLUS_I2C1)) | |||
| #endif /* SYSCFG_PMCR_I2C1_FMP && SYSCFG_PMCR_I2C2_FMP && SYSCFG_PMCR_I2C3_FMP && SYSCFG_PMCR_I2C4_FMP */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -192,7 +176,6 @@ void HAL_I2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_I2C_EX_H */ | |||
| #endif /* STM32H7xx_HAL_I2C_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_i2s.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of I2S HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_I2S_H | |||
| #define __STM32H7xx_HAL_I2S_H | |||
| #ifndef STM32H7xx_HAL_I2S_H | |||
| #define STM32H7xx_HAL_I2S_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -64,99 +46,128 @@ | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t Mode; /*!< Specifies the I2S operating mode. | |||
| This parameter can be a value of @ref I2S_Mode */ | |||
| uint32_t Standard; /*!< Specifies the standard used for the I2S communication. | |||
| This parameter can be a value of @ref I2S_Standard */ | |||
| uint32_t DataFormat; /*!< Specifies the data format for the I2S communication. | |||
| This parameter can be a value of @ref I2S_Data_Format */ | |||
| uint32_t Mode; /*!< Specifies the I2S operating mode. | |||
| This parameter can be a value of @ref I2S_Mode */ | |||
| uint32_t MCLKOutput; /*!< Specifies whether the I2S MCLK output is enabled or not. | |||
| This parameter can be a value of @ref I2S_MCLK_Output */ | |||
| uint32_t Standard; /*!< Specifies the standard used for the I2S communication. | |||
| This parameter can be a value of @ref I2S_Standard */ | |||
| uint32_t AudioFreq; /*!< Specifies the frequency selected for the I2S communication. | |||
| This parameter can be a value of @ref I2S_Audio_Frequency */ | |||
| uint32_t DataFormat; /*!< Specifies the data format for the I2S communication. | |||
| This parameter can be a value of @ref I2S_Data_Format */ | |||
| uint32_t CPOL; /*!< Specifies the idle state of the I2S clock. | |||
| This parameter can be a value of @ref I2S_Clock_Polarity */ | |||
| uint32_t MCLKOutput; /*!< Specifies whether the I2S MCLK output is enabled or not. | |||
| This parameter can be a value of @ref I2S_MCLK_Output */ | |||
| uint32_t FirstBit; /*!< Specifies whether data transfers start from MSB or LSB bit. | |||
| This parameter can be a value of @ref I2S_MSB_LSB_transmission */ | |||
| uint32_t AudioFreq; /*!< Specifies the frequency selected for the I2S communication. | |||
| This parameter can be a value of @ref I2S_Audio_Frequency */ | |||
| uint32_t WSInversion; /*!< Control the Word Select Inversion. | |||
| This parameter can be a value of @ref I2S_WSInversion */ | |||
| uint32_t CPOL; /*!< Specifies the idle state of the I2S clock. | |||
| This parameter can be a value of @ref I2S_Clock_Polarity */ | |||
| uint32_t IOSwap; /*!< Invert MISO/MOSI alternate functions | |||
| This parameter can be a value of @ref I2S_IO_Swap */ | |||
| uint32_t FirstBit; /*!< Specifies whether data transfers start from MSB or LSB bit. | |||
| This parameter can be a value of @ref I2S_MSB_LSB_transmission */ | |||
| uint32_t Data24BitAlignment; /*!< Specifies the Data Padding for 24 bits data lenght | |||
| This parameter can be a value of @ref I2S_Data_24Bit_Alignment */ | |||
| uint32_t WSInversion; /*!< Control the Word Select Inversion. | |||
| This parameter can be a value of @ref I2S_WSInversion */ | |||
| uint32_t FifoThreshold; /*!< Specifies the FIFO threshold level. | |||
| This parameter can be a value of @ref I2S_Fifo_Threshold */ | |||
| uint32_t Data24BitAlignment; /*!< Specifies the Data Padding for 24 bits data length | |||
| This parameter can be a value of @ref I2S_Data_24Bit_Alignment */ | |||
| uint32_t MasterKeepIOState; /*!< Control of Alternate function GPIOs state | |||
| This parameter can be a value of @ref I2S_Master_Keep_IO_State */ | |||
| uint32_t MasterKeepIOState; /*!< Control of Alternate function GPIOs state | |||
| This parameter can be a value of @ref SPI_Master_Keep_IO_State */ | |||
| uint32_t SlaveExtendFREDetection; /*!< Control the channel length in SLAVE. | |||
| This parameter can be a value of @ref I2S_SlaveExtendFREDetection */ | |||
| }I2S_InitTypeDef; | |||
| } I2S_InitTypeDef; | |||
| /** | |||
| * @brief HAL State structures definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_I2S_STATE_RESET = 0x00U, /*!< I2S not yet initialized or disabled */ | |||
| HAL_I2S_STATE_READY = 0x01U, /*!< I2S initialized and ready for use */ | |||
| HAL_I2S_STATE_BUSY = 0x02U, /*!< I2S internal process is ongoing */ | |||
| HAL_I2S_STATE_BUSY_TX = 0x03U, /*!< Data Transmission process is ongoing */ | |||
| HAL_I2S_STATE_BUSY_RX = 0x04U, /*!< Data Reception process is ongoing */ | |||
| HAL_I2S_STATE_BUSY_TX_RX = 0x05U, /*!< Data Transmission and Reception process is ongoing */ | |||
| HAL_I2S_STATE_TIMEOUT = 0x06U, /*!< I2S timeout state */ | |||
| HAL_I2S_STATE_ERROR = 0x07U /*!< I2S error state */ | |||
| }HAL_I2S_StateTypeDef; | |||
| HAL_I2S_STATE_RESET = 0x00UL, /*!< I2S not yet initialized or disabled */ | |||
| HAL_I2S_STATE_READY = 0x01UL, /*!< I2S initialized and ready for use */ | |||
| HAL_I2S_STATE_BUSY = 0x02UL, /*!< I2S internal process is ongoing */ | |||
| HAL_I2S_STATE_BUSY_TX = 0x03UL, /*!< Data Transmission process is ongoing */ | |||
| HAL_I2S_STATE_BUSY_RX = 0x04UL, /*!< Data Reception process is ongoing */ | |||
| HAL_I2S_STATE_TIMEOUT = 0x06UL, /*!< I2S timeout state */ | |||
| HAL_I2S_STATE_ERROR = 0x07UL /*!< I2S error state */ | |||
| } HAL_I2S_StateTypeDef; | |||
| /** | |||
| * @brief I2S handle Structure definition | |||
| */ | |||
| typedef struct __I2S_HandleTypeDef | |||
| { | |||
| SPI_TypeDef *Instance; /*!< I2S registers base address */ | |||
| SPI_TypeDef *Instance; /*!< I2S registers base address */ | |||
| I2S_InitTypeDef Init; /*!< I2S communication parameters */ | |||
| uint16_t *pTxBuffPtr; /*!< Pointer to I2S Tx transfer buffer */ | |||
| __IO uint16_t TxXferSize; /*!< I2S Tx transfer size */ | |||
| __IO uint16_t TxXferCount; /*!< I2S Tx transfer Counter */ | |||
| uint16_t *pRxBuffPtr; /*!< Pointer to I2S Rx transfer buffer */ | |||
| __IO uint16_t RxXferSize; /*!< I2S Rx transfer size */ | |||
| I2S_InitTypeDef Init; /*!< I2S communication parameters */ | |||
| __IO uint16_t RxXferCount; /*!< I2S 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) */ | |||
| uint16_t *pTxBuffPtr; /*!< Pointer to I2S Tx transfer buffer */ | |||
| void (*RxISR)(struct __I2S_HandleTypeDef *hi2s); /*!< function pointer on Rx ISR */ | |||
| __IO uint16_t TxXferSize; /*!< I2S Tx transfer size */ | |||
| void (*TxISR)(struct __I2S_HandleTypeDef *hi2s); /*!< function pointer on Tx ISR */ | |||
| __IO uint16_t TxXferCount; /*!< I2S Tx transfer Counter */ | |||
| DMA_HandleTypeDef *hdmatx; /*!< I2S Tx DMA handle parameters */ | |||
| uint16_t *pRxBuffPtr; /*!< Pointer to I2S Rx transfer buffer */ | |||
| DMA_HandleTypeDef *hdmarx; /*!< I2S Rx DMA handle parameters */ | |||
| __IO uint16_t RxXferSize; /*!< I2S Rx transfer size */ | |||
| __IO HAL_LockTypeDef Lock; /*!< I2S locking object */ | |||
| __IO uint16_t RxXferCount; /*!< I2S Rx transfer counter */ | |||
| __IO HAL_I2S_StateTypeDef State; /*!< I2S communication state */ | |||
| void (*RxISR)(struct __I2S_HandleTypeDef *hi2s); /*!< function pointer on Rx ISR */ | |||
| __IO uint32_t ErrorCode; /*!< I2S Error code | |||
| This parameter can be a value of @ref I2S_Error */ | |||
| void (*TxISR)(struct __I2S_HandleTypeDef *hi2s); /*!< function pointer on Tx ISR */ | |||
| #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U) | |||
| void (* TxCpltCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Tx Completed callback */ | |||
| void (* RxCpltCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Rx Completed callback */ | |||
| void (* TxHalfCpltCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Tx Half Completed callback */ | |||
| void (* RxHalfCpltCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Rx Half Completed callback */ | |||
| void (* ErrorCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Error callback */ | |||
| void (* MspInitCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Msp Init callback */ | |||
| void (* MspDeInitCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Msp DeInit callback */ | |||
| DMA_HandleTypeDef *hdmatx; /*!< I2S Tx DMA handle parameters */ | |||
| #endif /* USE_HAL_I2S_REGISTER_CALLBACKS */ | |||
| } I2S_HandleTypeDef; | |||
| DMA_HandleTypeDef *hdmarx; /*!< I2S Rx DMA handle parameters */ | |||
| #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1UL) | |||
| /** | |||
| __IO HAL_LockTypeDef Lock; /*!< I2S locking object */ | |||
| * @brief HAL I2S Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_I2S_TX_COMPLETE_CB_ID = 0x00UL, /*!< I2S Tx Completed callback ID */ | |||
| HAL_I2S_RX_COMPLETE_CB_ID = 0x01UL, /*!< I2S Rx Completed callback ID */ | |||
| HAL_I2S_TX_HALF_COMPLETE_CB_ID = 0x03UL, /*!< I2S Tx Half Completed callback ID */ | |||
| HAL_I2S_RX_HALF_COMPLETE_CB_ID = 0x04UL, /*!< I2S Rx Half Completed callback ID */ | |||
| HAL_I2S_ERROR_CB_ID = 0x06UL, /*!< I2S Error callback ID */ | |||
| HAL_I2S_MSPINIT_CB_ID = 0x07UL, /*!< I2S Msp Init callback ID */ | |||
| HAL_I2S_MSPDEINIT_CB_ID = 0x08UL /*!< I2S Msp DeInit callback ID */ | |||
| __IO HAL_I2S_StateTypeDef State; /*!< I2S communication state */ | |||
| } HAL_I2S_CallbackIDTypeDef; | |||
| __IO uint32_t ErrorCode; /*!< I2S Error code */ | |||
| /** | |||
| * @brief HAL I2S Callback pointer definition | |||
| */ | |||
| typedef void (*pI2S_CallbackTypeDef)(I2S_HandleTypeDef *hi2s); /*!< pointer to an I2S callback function */ | |||
| }I2S_HandleTypeDef; | |||
| #endif /* USE_HAL_I2S_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -165,33 +176,32 @@ typedef struct __I2S_HandleTypeDef | |||
| /** @defgroup I2S_Exported_Constants I2S Exported Constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @defgroup I2S_Error_Defintion I2S Error Defintion | |||
| * @brief I2S Error Code | |||
| /** @defgroup I2S_Error I2S Error | |||
| * @{ | |||
| */ | |||
| #define HAL_I2S_ERROR_NONE (0x00000000U) /*!< No error */ | |||
| #define HAL_I2S_ERROR_UDR (0x00000001U) /*!< I2S Underrun error */ | |||
| #define HAL_I2S_ERROR_OVR (0x00000002U) /*!< I2S Overrun error */ | |||
| #define HAL_I2S_ERROR_FRE (0x00000004U) /*!< I2S Frame format error */ | |||
| #define HAL_I2S_ERROR_DMA (0x00000008U) /*!< DMA transfer error */ | |||
| #define HAL_I2S_ERROR_DMA (0x00000008U) /*!< DMA transfer error */ | |||
| #define HAL_I2S_ERROR_TIMEOUT (0x00000010U) /*!< Timeout error */ | |||
| #define HAL_I2S_ERROR_PRESCALER (0x00000020U) /*!< Prescaler error */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #define HAL_I2S_ERROR_NONE (0x00000000UL) /*!< No error */ | |||
| #define HAL_I2S_ERROR_TIMEOUT (0x00000001UL) /*!< Timeout error */ | |||
| #define HAL_I2S_ERROR_OVR (0x00000002UL) /*!< OVR error */ | |||
| #define HAL_I2S_ERROR_UDR (0x00000004UL) /*!< UDR error */ | |||
| #define HAL_I2S_ERROR_DMA (0x00000008UL) /*!< DMA transfer error */ | |||
| #define HAL_I2S_ERROR_PRESCALER (0x00000010UL) /*!< Prescaler Calculation error */ | |||
| #define HAL_I2S_ERROR_FRE (0x00000020UL) /*!< FRE error */ | |||
| #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1UL) | |||
| #define HAL_I2S_ERROR_INVALID_CALLBACK (0x00000040UL) /*!< Invalid Callback error */ | |||
| #endif /* USE_HAL_I2S_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup I2S_Mode I2S Mode | |||
| * @{ | |||
| */ | |||
| #define I2S_MODE_SLAVE_TX (0x00000000U) | |||
| #define I2S_MODE_SLAVE_RX (0x00000002U) | |||
| #define I2S_MODE_MASTER_TX (0x00000004U) | |||
| #define I2S_MODE_MASTER_RX (0x00000006U) | |||
| #define I2S_MODE_SLAVE_FD (0x00000008U) | |||
| #define I2S_MODE_MASTER_FD (0x0000000AU) | |||
| #define I2S_MODE_SLAVE_TX (0x00000000UL) | |||
| #define I2S_MODE_SLAVE_RX (SPI_I2SCFGR_I2SCFG_0) | |||
| #define I2S_MODE_MASTER_TX (SPI_I2SCFGR_I2SCFG_1) | |||
| #define I2S_MODE_MASTER_RX (SPI_I2SCFGR_I2SCFG_0 | SPI_I2SCFGR_I2SCFG_1) | |||
| #define I2S_MODE_SLAVE_FULLDUPLEX (SPI_I2SCFGR_I2SCFG_2) | |||
| #define I2S_MODE_MASTER_FULLDUPLEX (SPI_I2SCFGR_I2SCFG_2 | SPI_I2SCFGR_I2SCFG_0) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -199,11 +209,11 @@ typedef struct __I2S_HandleTypeDef | |||
| /** @defgroup I2S_Standard I2S Standard | |||
| * @{ | |||
| */ | |||
| #define I2S_STANDARD_PHILIPS (0x00000000U) | |||
| #define I2S_STANDARD_MSB (0x00000010U) | |||
| #define I2S_STANDARD_LSB (0x00000020U) | |||
| #define I2S_STANDARD_PCM_SHORT (0x00000030U) | |||
| #define I2S_STANDARD_PCM_LONG (0x000000B0U) | |||
| #define I2S_STANDARD_PHILIPS (0x00000000UL) | |||
| #define I2S_STANDARD_MSB (SPI_I2SCFGR_I2SSTD_0) | |||
| #define I2S_STANDARD_LSB (SPI_I2SCFGR_I2SSTD_1) | |||
| #define I2S_STANDARD_PCM_SHORT (SPI_I2SCFGR_I2SSTD_0 | SPI_I2SCFGR_I2SSTD_1) | |||
| #define I2S_STANDARD_PCM_LONG (SPI_I2SCFGR_I2SSTD_0 | SPI_I2SCFGR_I2SSTD_1 | SPI_I2SCFGR_PCMSYNC) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -211,10 +221,10 @@ typedef struct __I2S_HandleTypeDef | |||
| /** @defgroup I2S_Data_Format I2S Data Format | |||
| * @{ | |||
| */ | |||
| #define I2S_DATAFORMAT_16B (0x00000000U) | |||
| #define I2S_DATAFORMAT_16B_EXTENDED (0x00000400U) | |||
| #define I2S_DATAFORMAT_24B (0x00000500U) | |||
| #define I2S_DATAFORMAT_32B (0x00000600U) | |||
| #define I2S_DATAFORMAT_16B (0x00000000UL) | |||
| #define I2S_DATAFORMAT_16B_EXTENDED (SPI_I2SCFGR_CHLEN) | |||
| #define I2S_DATAFORMAT_24B (SPI_I2SCFGR_DATLEN_0) | |||
| #define I2S_DATAFORMAT_32B (SPI_I2SCFGR_DATLEN_1) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -222,8 +232,8 @@ typedef struct __I2S_HandleTypeDef | |||
| /** @defgroup I2S_MCLK_Output I2S MCLK Output | |||
| * @{ | |||
| */ | |||
| #define I2S_MCLKOUTPUT_ENABLE SPI_I2SCFGR_MCKOE | |||
| #define I2S_MCLKOUTPUT_DISABLE (0x00000000U) | |||
| #define I2S_MCLKOUTPUT_ENABLE (SPI_I2SCFGR_MCKOE) | |||
| #define I2S_MCLKOUTPUT_DISABLE (0x00000000UL) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -231,34 +241,34 @@ typedef struct __I2S_HandleTypeDef | |||
| /** @defgroup I2S_Audio_Frequency I2S Audio Frequency | |||
| * @{ | |||
| */ | |||
| #define I2S_AUDIOFREQ_192K (192000U) | |||
| #define I2S_AUDIOFREQ_96K (96000U) | |||
| #define I2S_AUDIOFREQ_48K (48000U) | |||
| #define I2S_AUDIOFREQ_44K (44100U) | |||
| #define I2S_AUDIOFREQ_32K (32000U) | |||
| #define I2S_AUDIOFREQ_22K (22050U) | |||
| #define I2S_AUDIOFREQ_16K (16000U) | |||
| #define I2S_AUDIOFREQ_11K (11025U) | |||
| #define I2S_AUDIOFREQ_8K (8000U) | |||
| #define I2S_AUDIOFREQ_DEFAULT (2U) | |||
| #define I2S_AUDIOFREQ_192K (192000UL) | |||
| #define I2S_AUDIOFREQ_96K (96000UL) | |||
| #define I2S_AUDIOFREQ_48K (48000UL) | |||
| #define I2S_AUDIOFREQ_44K (44100UL) | |||
| #define I2S_AUDIOFREQ_32K (32000UL) | |||
| #define I2S_AUDIOFREQ_22K (22050UL) | |||
| #define I2S_AUDIOFREQ_16K (16000UL) | |||
| #define I2S_AUDIOFREQ_11K (11025UL) | |||
| #define I2S_AUDIOFREQ_8K (8000UL) | |||
| #define I2S_AUDIOFREQ_DEFAULT (2UL) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup I2S_Clock_Polarity I2S Clock Polarity | |||
| /** @defgroup I2S_FullDuplex_Mode I2S FullDuplex Mode | |||
| * @{ | |||
| */ | |||
| #define I2S_CPOL_LOW (0x00000000U) | |||
| #define I2S_CPOL_HIGH SPI_I2SCFGR_CKPOL | |||
| #define I2S_CPOL_LOW (0x00000000UL) | |||
| #define I2S_CPOL_HIGH (SPI_I2SCFGR_CKPOL) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup I2S_MSB_LSB_transmission I2S MSB LSB Transmission | |||
| /** @defgroup I2S_MSB_LSB_Transmission I2S MSB LSB Transmission | |||
| * @{ | |||
| */ | |||
| #define I2S_FIRSTBIT_MSB (0x00000000U) | |||
| #define I2S_FIRSTBIT_LSB SPI_CFG2_LSBFRST | |||
| #define I2S_FIRSTBIT_MSB (0x00000000UL) | |||
| #define I2S_FIRSTBIT_LSB SPI_CFG2_LSBFRST | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -266,17 +276,8 @@ typedef struct __I2S_HandleTypeDef | |||
| /** @defgroup I2S_WSInversion I2S Word Select Inversion | |||
| * @{ | |||
| */ | |||
| #define I2S_WS_INVERSION_DISABLE (0x00000000U) | |||
| #define I2S_WS_INVERSION_ENABLE SPI_I2SCFGR_WSINV | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup I2S_IO_Swap Control I2S IO Swap | |||
| * @{ | |||
| */ | |||
| #define I2S_IO_SWAP_DISABLE (0x00000000U) | |||
| #define I2S_IO_SWAP_ENABLE SPI_CFG2_IOSWP | |||
| #define I2S_WS_INVERSION_DISABLE (0x00000000UL) | |||
| #define I2S_WS_INVERSION_ENABLE SPI_I2SCFGR_WSINV | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -284,23 +285,8 @@ typedef struct __I2S_HandleTypeDef | |||
| /** @defgroup I2S_Data_24Bit_Alignment Data Padding 24Bit | |||
| * @{ | |||
| */ | |||
| #define I2S_DATA_24BIT_ALIGNMENT_RIGHT (0x00000000U) | |||
| #define I2S_DATA_24BIT_ALIGNMENT_LEFT SPI_I2SCFGR_DATFMT | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup I2S_Fifo_Threshold I2S Fifo Threshold | |||
| * @{ | |||
| */ | |||
| #define I2S_FIFO_THRESHOLD_01DATA (0x00000000U) | |||
| #define I2S_FIFO_THRESHOLD_02DATA (0x00000020U) | |||
| #define I2S_FIFO_THRESHOLD_03DATA (0x00000040U) | |||
| #define I2S_FIFO_THRESHOLD_04DATA (0x00000060U) | |||
| #define I2S_FIFO_THRESHOLD_05DATA (0x00000080U) | |||
| #define I2S_FIFO_THRESHOLD_06DATA (0x000000A0U) | |||
| #define I2S_FIFO_THRESHOLD_07DATA (0x000000C0U) | |||
| #define I2S_FIFO_THRESHOLD_08DATA (0x000000E0U) | |||
| #define I2S_DATA_24BIT_ALIGNMENT_RIGHT (0x00000000UL) | |||
| #define I2S_DATA_24BIT_ALIGNMENT_LEFT SPI_I2SCFGR_DATFMT | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -308,168 +294,189 @@ typedef struct __I2S_HandleTypeDef | |||
| /** @defgroup I2S_Master_Keep_IO_State Keep IO State | |||
| * @{ | |||
| */ | |||
| #define I2S_MASTER_KEEP_IO_STATE_DISABLE (0x00000000U) | |||
| #define I2S_MASTER_KEEP_IO_STATE_ENABLE SPI_CFG2_AFCNTR | |||
| #define I2S_MASTER_KEEP_IO_STATE_DISABLE (0x00000000U) | |||
| #define I2S_MASTER_KEEP_IO_STATE_ENABLE SPI_CFG2_AFCNTR | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup I2S_SlaveExtendFREDetection Slave Extend FRE Detection | |||
| /** @defgroup I2S_Interrupts_Definition I2S Interrupts Definition | |||
| * @{ | |||
| */ | |||
| #define I2S_SLAVE_EXTEND_FRE_DETECTION_DISABLE (0x00000000U) | |||
| #define I2S_SLAVE_EXTEND_FRE_DETECTION_ENABLE SPI_I2SCFGR_FIXCH | |||
| #define I2S_IT_RXP SPI_IER_RXPIE | |||
| #define I2S_IT_TXP SPI_IER_TXPIE | |||
| #define I2S_IT_UDR SPI_IER_UDRIE | |||
| #define I2S_IT_OVR SPI_IER_OVRIE | |||
| #define I2S_IT_FRE SPI_IER_TIFREIE | |||
| #define I2S_IT_ERR (SPI_IER_UDRIE | SPI_IER_OVRIE | SPI_IER_TIFREIE) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup I2S_Interrupt_definition I2S Interrupt definition | |||
| /** @defgroup I2S_Flags_Definition I2S Flags Definition | |||
| * @{ | |||
| */ | |||
| #define I2S_IT_TXE SPI_IER_TXPIE | |||
| #define I2S_IT_RXNE SPI_IER_RXPIE | |||
| #define I2S_IT_ERR (SPI_IER_OVRIE | SPI_IER_UDRIE | SPI_IER_TIFREIE) | |||
| #define I2S_FLAG_RXP SPI_SR_RXP /* I2S status flag : Rx-Packet available flag */ | |||
| #define I2S_FLAG_TXP SPI_SR_TXP /* I2S status flag : Tx-Packet space available flag */ | |||
| #define I2S_FLAG_UDR SPI_SR_UDR /* I2S Error flag : Underrun flag */ | |||
| #define I2S_FLAG_OVR SPI_SR_OVR /* I2S Error flag : Overrun flag */ | |||
| #define I2S_FLAG_FRE SPI_SR_TIFRE /* I2S Error flag : TI mode frame format error flag */ | |||
| #define I2S_FLAG_MASK (SPI_SR_RXP | SPI_SR_TXP | SPI_SR_UDR | SPI_SR_OVR | SPI_SR_TIFRE) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup I2S_Flag_definition I2S Flag definition | |||
| * @{ | |||
| */ | |||
| #define I2S_FLAG_TXE SPI_SR_TXP /* I2S status flag: Tx buffer empty flag */ | |||
| #define I2S_FLAG_RXNE SPI_SR_RXP /* I2S status flag: Rx buffer not empty flag */ | |||
| #define I2S_FLAG_UDR SPI_SR_UDR /* I2S Error flag: Underrun flag */ | |||
| #define I2S_FLAG_RXWNE SPI_SR_RXWNE /* I2S RxFIFO Word Not Empty */ | |||
| #define I2S_FLAG_OVR SPI_SR_OVR /* I2S Error flag: Overrun flag */ | |||
| #define I2S_FLAG_FRE SPI_SR_TIFRE /* I2S Error flag: TI mode frame format error flag */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup I2S_Exported_Macros I2S Exported Macros | |||
| /* Exported macros -----------------------------------------------------------*/ | |||
| /** @defgroup I2S_Exported_macros I2S Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset I2S handle state | |||
| * @param __HANDLE__: specifies the I2S Handle. | |||
| * @param __HANDLE__ specifies the I2S Handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1UL) | |||
| #define __HAL_I2S_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->State = HAL_I2S_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_I2S_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_I2S_STATE_RESET) | |||
| #endif | |||
| /** @brief Enable the specified SPI peripheral (in I2S mode). | |||
| * @param __HANDLE__: specifies the I2S Handle. | |||
| * @param __HANDLE__ specifies the I2S Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_I2S_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_SPE) | |||
| #define __HAL_I2S_ENABLE(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_SPE)) | |||
| /** @brief Disable the specified SPI peripheral (in I2S mode). | |||
| * @param __HANDLE__: specifies the I2S Handle. | |||
| * @param __HANDLE__ specifies the I2S Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_I2S_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_SPE) | |||
| #define __HAL_I2S_DISABLE(__HANDLE__) (CLEAR_BIT((__HANDLE__)->Instance->CR1, SPI_CR1_SPE)) | |||
| /** @brief Enable the specified I2S interrupts. | |||
| * @param __HANDLE__: specifies the I2S Handle. | |||
| * @param __INTERRUPT__: specifies the interrupt source to enable or disable. | |||
| * @param __HANDLE__ specifies the I2S Handle. | |||
| * This parameter can be I2S where x: 1, 2 or 3 to select the I2S peripheral. | |||
| * @param __INTERRUPT__ specifies the interrupt source to enable or disable. | |||
| * This parameter can be one of the following values: | |||
| * @arg I2S_IT_TXE: Tx buffer empty interrupt enable | |||
| * @arg I2S_IT_RXNE: RX buffer not empty interrupt enable | |||
| * @arg I2S_IT_ERR: Error interrupt enable | |||
| * @arg I2S_IT_RXP : Rx-Packet available interrupt | |||
| * @arg I2S_IT_TXP : Tx-Packet space available interrupt | |||
| * @arg I2S_IT_UDR : Underrun interrupt | |||
| * @arg I2S_IT_OVR : Overrun interrupt | |||
| * @arg I2S_IT_FRE : TI mode frame format error interrupt | |||
| * @arg I2S_IT_ERR : Error interrupt enable | |||
| * @retval None | |||
| */ | |||
| #define __HAL_I2S_ENABLE_IT(__HANDLE__, __INTERRUPT__) (SET_BIT((__HANDLE__)->Instance->IER,(__INTERRUPT__))) | |||
| /** @brief Disable the specified I2S interrupts. | |||
| * @param __HANDLE__: specifies the I2S Handle. | |||
| * @param __INTERRUPT__: specifies the interrupt source to enable or disable. | |||
| * @param __HANDLE__ specifies the I2S Handle. | |||
| * This parameter can be I2S where x: 1, 2 or 3 to select the I2S peripheral. | |||
| * @param __INTERRUPT__ specifies the interrupt source to enable or disable. | |||
| * This parameter can be one of the following values: | |||
| * @arg I2S_IT_TXE: Tx buffer empty interrupt enable | |||
| * @arg I2S_IT_RXNE: RX buffer not empty interrupt enable | |||
| * @arg I2S_IT_ERR: Error interrupt enable | |||
| * @arg I2S_IT_RXP : Rx-Packet available interrupt | |||
| * @arg I2S_IT_TXP : Tx-Packet space available interrupt | |||
| * @arg I2S_IT_UDR : Underrun interrupt | |||
| * @arg I2S_IT_OVR : Overrun interrupt | |||
| * @arg I2S_IT_FRE : TI mode frame format error interrupt | |||
| * @arg I2S_IT_ERR : Error interrupt enable | |||
| * @retval None | |||
| */ | |||
| #define __HAL_I2S_DISABLE_IT(__HANDLE__, __INTERRUPT__) (CLEAR_BIT((__HANDLE__)->Instance->IER,(__INTERRUPT__))) | |||
| /** @brief Checks if the specified I2S interrupt source is enabled or disabled. | |||
| * @param __HANDLE__: specifies the I2S Handle. | |||
| * This parameter can be I2S where x: 1, 2, or 3 to select the I2S peripheral. | |||
| * @param __INTERRUPT__: specifies the I2S interrupt source to check. | |||
| /** @brief Check if the specified I2S interrupt source is enabled or disabled. | |||
| * @param __HANDLE__ specifies the I2S Handle. | |||
| * This parameter can be I2S where x: 1, 2 or 3 to select the I2S peripheral. | |||
| * @param __INTERRUPT__ specifies the I2S interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg I2S_IT_TXE: Tx buffer empty interrupt enable | |||
| * @arg I2S_IT_RXNE: RX buffer not empty interrupt enable | |||
| * @arg I2S_IT_ERR: Error interrupt enable | |||
| * @arg I2S_IT_RXP : Rx-Packet available interrupt | |||
| * @arg I2S_IT_TXP : Tx-Packet space available interrupt | |||
| * @arg I2S_IT_UDR : Underrun interrupt | |||
| * @arg I2S_IT_OVR : Overrun interrupt | |||
| * @arg I2S_IT_FRE : TI mode frame format error interrupt | |||
| * @arg I2S_IT_ERR : Error interrupt enable | |||
| * @retval The new state of __IT__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_I2S_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IER & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) | |||
| /** @brief Checks whether the specified I2S flag is set or not. | |||
| * @param __HANDLE__: specifies the I2S Handle. | |||
| * @param __FLAG__: specifies the flag to check. | |||
| /** @brief Check whether the specified I2S flag is set or not. | |||
| * @param __HANDLE__ specifies the I2S Handle. | |||
| * This parameter can be I2S where x: 1, 2 or 3 to select the I2S peripheral. | |||
| * @param __FLAG__ specifies the flag to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg I2S_FLAG_TXE : Tx buffer empty flag | |||
| * @arg I2S_FLAG_RXNE : Rx buffer not empty flag | |||
| * @arg I2S_FLAG_UDR : Underrun flag | |||
| * @arg I2S_FLAG_OVR : Overrun flag | |||
| * @arg I2S_FLAG_FRE : TI mode frame format error flag | |||
| * @arg I2S_FLAG_RXP : Rx-Packet available flag | |||
| * @arg I2S_FLAG_TXP : Tx-Packet space available flag | |||
| * @arg I2S_FLAG_UDR : Underrun flag | |||
| * @arg I2S_FLAG_OVR : Overrun flag | |||
| * @arg I2S_FLAG_FRE : TI mode frame format error flag | |||
| * @retval The new state of __FLAG__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_I2S_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__)) | |||
| /** @brief Clears the I2S UDR pending flag. | |||
| * @param __HANDLE__: specifies the I2S Handle. | |||
| /** @brief Clear the I2S OVR pending flag. | |||
| * @param __HANDLE__ specifies the I2S Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_I2S_CLEAR_UDRFLAG(__HANDLE__) SET_BIT((__HANDLE__)->Instance->IFCR , SPI_IFCR_UDRC) | |||
| #define __HAL_I2S_CLEAR_OVRFLAG(__HANDLE__) SET_BIT((__HANDLE__)->Instance->IFCR , SPI_IFCR_OVRC) | |||
| /** @brief Clears the I2S OVR pending flag. | |||
| * @param __HANDLE__: specifies the I2S Handle. | |||
| /** @brief Clear the I2S UDR pending flag. | |||
| * @param __HANDLE__ specifies the I2S Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_I2S_CLEAR_OVRFLAG(__HANDLE__) SET_BIT((__HANDLE__)->Instance->IFCR , SPI_IFCR_OVRC) | |||
| #define __HAL_I2S_CLEAR_UDRFLAG(__HANDLE__) SET_BIT((__HANDLE__)->Instance->IFCR , SPI_IFCR_UDRC) | |||
| /** @brief Clear the I2S FRE pending flag. | |||
| * @param __HANDLE__: specifies the I2S Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_I2S_CLEAR_FREFLAG(__HANDLE__) SET_BIT((__HANDLE__)->Instance->IFCR , SPI_IFCR_TIFREC) | |||
| #define __HAL_I2S_CLEAR_TIFREFLAG(__HANDLE__) SET_BIT((__HANDLE__)->Instance->IFCR , SPI_IFCR_TIFREC) | |||
| /* Include I2S HAL Extended module */ | |||
| #include "stm32h7xx_hal_i2s_ex.h" | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @defgroup I2S_Exported_Functions I2S Exported Functions | |||
| /** @addtogroup I2S_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /** @defgroup I2S_Exported_Functions_Group1 Initialization and de-initialization functions | |||
| /** @addtogroup I2S_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| /* Initialization/de-initialization functions ********************************/ | |||
| HAL_StatusTypeDef HAL_I2S_Init(I2S_HandleTypeDef *hi2s); | |||
| HAL_StatusTypeDef HAL_I2S_DeInit (I2S_HandleTypeDef *hi2s); | |||
| HAL_StatusTypeDef HAL_I2S_DeInit(I2S_HandleTypeDef *hi2s); | |||
| void HAL_I2S_MspInit(I2S_HandleTypeDef *hi2s); | |||
| void HAL_I2S_MspDeInit(I2S_HandleTypeDef *hi2s); | |||
| /* Callbacks Register/UnRegister functions ***********************************/ | |||
| #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1UL) | |||
| HAL_StatusTypeDef HAL_I2S_RegisterCallback(I2S_HandleTypeDef *hi2s, HAL_I2S_CallbackIDTypeDef CallbackID, pI2S_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_I2S_UnRegisterCallback(I2S_HandleTypeDef *hi2s, HAL_I2S_CallbackIDTypeDef CallbackID); | |||
| #endif /* USE_HAL_I2S_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup I2S_Exported_Functions_Group2 IO operation functions | |||
| /** @addtogroup I2S_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| /* I/O operation functions ***************************************************/ | |||
| /* Blocking mode: Polling */ | |||
| /* Blocking mode: Polling */ | |||
| HAL_StatusTypeDef HAL_I2S_Transmit(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_I2S_Receive(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout); | |||
| /* Non-Blocking mode: Interrupt */ | |||
| /* Non-Blocking mode: Interrupt */ | |||
| HAL_StatusTypeDef HAL_I2S_Transmit_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_I2S_Receive_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size); | |||
| void HAL_I2S_IRQHandler(I2S_HandleTypeDef *hi2s); | |||
| /* Non-Blocking mode: DMA */ | |||
| @@ -490,7 +497,7 @@ void HAL_I2S_ErrorCallback(I2S_HandleTypeDef *hi2s); | |||
| * @} | |||
| */ | |||
| /** @addtogroup I2S_Exported_Functions_Group3 Peripheral State and Errors functions | |||
| /** @addtogroup I2S_Exported_Functions_Group3 | |||
| * @{ | |||
| */ | |||
| /* Peripheral Control and State functions ************************************/ | |||
| @@ -500,98 +507,106 @@ uint32_t HAL_I2S_GetError(I2S_HandleTypeDef *hi2s); | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup I2S_Private I2S Private | |||
| * @{ | |||
| /** | |||
| * @} | |||
| */ | |||
| #define IS_I2S_MODE(MODE) (((MODE) == I2S_MODE_SLAVE_TX) || \ | |||
| ((MODE) == I2S_MODE_SLAVE_RX) || \ | |||
| ((MODE) == I2S_MODE_MASTER_TX) || \ | |||
| ((MODE) == I2S_MODE_MASTER_RX) || \ | |||
| ((MODE) == I2S_MODE_SLAVE_FD) || \ | |||
| ((MODE) == I2S_MODE_MASTER_FD)) | |||
| #define IS_I2S_FD_MODE(MODE) (((MODE) == I2S_MODE_SLAVE_FD) || \ | |||
| ((MODE) == I2S_MODE_MASTER_FD)) | |||
| #define IS_I2S_MASTER(MODE) (((MODE) == I2S_MODE_MASTER_TX) || \ | |||
| ((MODE) == I2S_MODE_MASTER_RX) || \ | |||
| ((MODE) == I2S_MODE_MASTER_FD)) | |||
| #define IS_I2S_TX_MODE(MODE) (((MODE) == I2S_MODE_SLAVE_TX) || \ | |||
| ((MODE) == I2S_MODE_MASTER_TX) || \ | |||
| ((MODE) == I2S_MODE_SLAVE_FD) || \ | |||
| ((MODE) == I2S_MODE_MASTER_FD)) | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup I2S_Private_Constants I2S Private Constants | |||
| * @{ | |||
| */ | |||
| #define IS_I2S_RX_MODE(MODE) (((MODE) == I2S_MODE_SLAVE_RX) || \ | |||
| ((MODE) == I2S_MODE_MASTER_RX) || \ | |||
| ((MODE) == I2S_MODE_SLAVE_FD) || \ | |||
| ((MODE) == I2S_MODE_MASTER_FD)) | |||
| /** | |||
| * @} | |||
| */ | |||
| #define IS_I2S_STANDARD(STANDARD) (((STANDARD) == I2S_STANDARD_PHILIPS) || \ | |||
| ((STANDARD) == I2S_STANDARD_MSB) || \ | |||
| ((STANDARD) == I2S_STANDARD_LSB) || \ | |||
| ((STANDARD) == I2S_STANDARD_PCM_SHORT) || \ | |||
| ((STANDARD) == I2S_STANDARD_PCM_LONG)) | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup I2S_Private_Macros I2S Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_I2S_DATA_FORMAT(FORMAT) (((FORMAT) == I2S_DATAFORMAT_16B) || \ | |||
| ((FORMAT) == I2S_DATAFORMAT_16B_EXTENDED) || \ | |||
| ((FORMAT) == I2S_DATAFORMAT_24B) || \ | |||
| ((FORMAT) == I2S_DATAFORMAT_32B)) | |||
| /** @brief Check whether the specified SPI flag is set or not. | |||
| * @param __SR__ copy of I2S SR register. | |||
| * @param __FLAG__ specifies the flag to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg I2S_FLAG_RXP : Rx-Packet available flag | |||
| * @arg I2S_FLAG_TXP : Tx-Packet space available flag | |||
| * @arg I2S_FLAG_UDR : Underrun flag | |||
| * @arg I2S_FLAG_OVR : Overrun flag | |||
| * @arg I2S_FLAG_FRE : TI mode frame format error flag | |||
| * @retval SET or RESET. | |||
| */ | |||
| #define I2S_CHECK_FLAG(__SR__, __FLAG__) ((((__SR__) & ((__FLAG__) & I2S_FLAG_MASK)) == ((__FLAG__) & I2S_FLAG_MASK)) ? SET : RESET) | |||
| /** @brief Check whether the specified SPI Interrupt is set or not. | |||
| * @param __IER__ copy of I2S IER register. | |||
| * @param __INTERRUPT__ specifies the SPI interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg I2S_IT_RXP : Rx-Packet available interrupt | |||
| * @arg I2S_IT_TXP : Tx-Packet space available interrupt | |||
| * @arg I2S_IT_UDR : Underrun interrupt | |||
| * @arg I2S_IT_OVR : Overrun interrupt | |||
| * @arg I2S_IT_FRE : TI mode frame format error interrupt | |||
| * @arg I2S_IT_ERR : Error interrupt enable | |||
| * @retval SET or RESET. | |||
| */ | |||
| #define I2S_CHECK_IT_SOURCE(__IER__, __INTERRUPT__) ((((__IER__) & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) | |||
| /** @brief Checks if I2S Mode parameter is in allowed range. | |||
| * @param __MODE__ specifies the I2S Mode. | |||
| * This parameter can be a value of @ref I2S_Mode | |||
| * @retval None | |||
| */ | |||
| #define IS_I2S_MODE(__MODE__) (((__MODE__) == I2S_MODE_SLAVE_TX) || \ | |||
| ((__MODE__) == I2S_MODE_SLAVE_RX) || \ | |||
| ((__MODE__) == I2S_MODE_MASTER_TX) || \ | |||
| ((__MODE__) == I2S_MODE_MASTER_RX) || \ | |||
| ((__MODE__) == I2S_MODE_SLAVE_FULLDUPLEX) || \ | |||
| ((__MODE__) == I2S_MODE_MASTER_FULLDUPLEX)) | |||
| #define IS_I2S_MCLK_OUTPUT(OUTPUT) (((OUTPUT) == I2S_MCLKOUTPUT_ENABLE) || \ | |||
| ((OUTPUT) == I2S_MCLKOUTPUT_DISABLE)) | |||
| #define IS_I2S_MASTER(__MODE__) (((__MODE__) == I2S_MODE_MASTER_TX) || \ | |||
| ((__MODE__) == I2S_MODE_MASTER_RX) || \ | |||
| ((__MODE__) == I2S_MODE_MASTER_FULLDUPLEX)) | |||
| #define IS_I2S_AUDIO_FREQ(FREQ) ((((FREQ) >= I2S_AUDIOFREQ_8K) && \ | |||
| ((FREQ) <= I2S_AUDIOFREQ_192K)) || \ | |||
| ((FREQ) == I2S_AUDIOFREQ_DEFAULT)) | |||
| #define IS_I2S_SLAVE(__MODE__) (((__MODE__) == I2S_MODE_SLAVE_TX) || \ | |||
| ((__MODE__) == I2S_MODE_SLAVE_RX) || \ | |||
| ((__MODE__) == I2S_MODE_SLAVE_FULLDUPLEX)) | |||
| #define IS_I2S_CPOL(CPOL) (((CPOL) == I2S_CPOL_LOW) || \ | |||
| ((CPOL) == I2S_CPOL_HIGH)) | |||
| #define IS_I2S_STANDARD(__STANDARD__) (((__STANDARD__) == I2S_STANDARD_PHILIPS) || \ | |||
| ((__STANDARD__) == I2S_STANDARD_MSB) || \ | |||
| ((__STANDARD__) == I2S_STANDARD_LSB) || \ | |||
| ((__STANDARD__) == I2S_STANDARD_PCM_SHORT) || \ | |||
| ((__STANDARD__) == I2S_STANDARD_PCM_LONG)) | |||
| #define IS_I2S_FIRST_BIT(FIRSTBIT) (((FIRSTBIT) == I2S_FIRSTBIT_MSB) || \ | |||
| ((FIRSTBIT) == I2S_FIRSTBIT_LSB)) | |||
| #define IS_I2S_DATA_FORMAT(__FORMAT__) (((__FORMAT__) == I2S_DATAFORMAT_16B) || \ | |||
| ((__FORMAT__) == I2S_DATAFORMAT_16B_EXTENDED) || \ | |||
| ((__FORMAT__) == I2S_DATAFORMAT_24B) || \ | |||
| ((__FORMAT__) == I2S_DATAFORMAT_32B)) | |||
| #define IS_I2S_WS_INVERSION(WSINV) (((WSINV) == I2S_WS_INVERSION_DISABLE) || \ | |||
| ((WSINV) == I2S_WS_INVERSION_ENABLE)) | |||
| #define IS_I2S_MCLK_OUTPUT(__OUTPUT__) (((__OUTPUT__) == I2S_MCLKOUTPUT_ENABLE) || \ | |||
| ((__OUTPUT__) == I2S_MCLKOUTPUT_DISABLE)) | |||
| #define IS_I2S_IO_SWAP(IOSWAP) (((IOSWAP) == I2S_IO_SWAP_DISABLE) || \ | |||
| ((IOSWAP) == I2S_IO_SWAP_ENABLE)) | |||
| #define IS_I2S_AUDIO_FREQ(__FREQ__) ((((__FREQ__) >= I2S_AUDIOFREQ_8K) && \ | |||
| ((__FREQ__) <= I2S_AUDIOFREQ_192K)) || \ | |||
| ((__FREQ__) == I2S_AUDIOFREQ_DEFAULT)) | |||
| #define IS_I2S_DATA_24BIT_ALIGNMENT(ALIGNMENT) (((ALIGNMENT) == I2S_DATA_24BIT_ALIGNMENT_RIGHT) || \ | |||
| ((ALIGNMENT) == I2S_DATA_24BIT_ALIGNMENT_LEFT)) | |||
| #define IS_I2S_CPOL(__CPOL__) (((__CPOL__) == I2S_CPOL_LOW) || \ | |||
| ((__CPOL__) == I2S_CPOL_HIGH)) | |||
| #define IS_I2S_FIFO_THRESHOLD(FTHLV) (((FTHLV) == I2S_FIFO_THRESHOLD_01DATA) || \ | |||
| ((FTHLV) == I2S_FIFO_THRESHOLD_02DATA) || \ | |||
| ((FTHLV) == I2S_FIFO_THRESHOLD_03DATA) || \ | |||
| ((FTHLV) == I2S_FIFO_THRESHOLD_04DATA) || \ | |||
| ((FTHLV) == I2S_FIFO_THRESHOLD_05DATA) || \ | |||
| ((FTHLV) == I2S_FIFO_THRESHOLD_06DATA) || \ | |||
| ((FTHLV) == I2S_FIFO_THRESHOLD_07DATA) || \ | |||
| ((FTHLV) == I2S_FIFO_THRESHOLD_08DATA)) | |||
| #define IS_I2S_FIRST_BIT(__BIT__) (((__BIT__) == I2S_FIRSTBIT_MSB) || \ | |||
| ((__BIT__) == I2S_FIRSTBIT_LSB)) | |||
| #define IS_I2S_MASTER_KEEP_IO_STATE(AFCNTR) (((AFCNTR) == I2S_MASTER_KEEP_IO_STATE_DISABLE) || \ | |||
| ((AFCNTR) == I2S_MASTER_KEEP_IO_STATE_ENABLE)) | |||
| #define IS_I2S_WS_INVERSION(__WSINV__) (((__WSINV__) == I2S_WS_INVERSION_DISABLE) || \ | |||
| ((__WSINV__) == I2S_WS_INVERSION_ENABLE)) | |||
| #define IS_I2S_SLAVE_EXTEND_FRE_DETECTION(FIXCH) (((FIXCH) == I2S_SLAVE_EXTEND_FRE_DETECTION_DISABLE) || \ | |||
| ((FIXCH) == I2S_SLAVE_EXTEND_FRE_DETECTION_ENABLE)) | |||
| #define IS_I2S_DATA_24BIT_ALIGNMENT(__ALIGNMENT__) (((__ALIGNMENT__) == I2S_DATA_24BIT_ALIGNMENT_RIGHT) || \ | |||
| ((__ALIGNMENT__) == I2S_DATA_24BIT_ALIGNMENT_LEFT)) | |||
| /** | |||
| * @} | |||
| */ | |||
| #define IS_I2S_MASTER_KEEP_IO_STATE(__AFCNTR__) (((__AFCNTR__) == I2S_MASTER_KEEP_IO_STATE_DISABLE) || \ | |||
| ((__AFCNTR__) == I2S_MASTER_KEEP_IO_STATE_ENABLE)) | |||
| /* Define the private group ***************************************************/ | |||
| /******************************************************************************/ | |||
| /** @defgroup I2S_Private I2S Private | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /******************************************************************************/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| @@ -605,13 +620,10 @@ uint32_t HAL_I2S_GetError(I2S_HandleTypeDef *hi2s); | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_I2S_H */ | |||
| #endif /* STM32H7xx_HAL_I2S_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_i2s_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of I2S HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_I2S_EX_H | |||
| #define __STM32H7xx_HAL_I2S_EX_H | |||
| #ifndef STM32H7xx_HAL_I2S_EX_H | |||
| #define STM32H7xx_HAL_I2S_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -49,6 +31,7 @@ | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| #if defined(SPI_I2S_FULLDUPLEX_SUPPORT) | |||
| /** @addtogroup I2SEx I2SEx | |||
| * @{ | |||
| */ | |||
| @@ -56,6 +39,81 @@ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /* Exported macros -----------------------------------------------------------*/ | |||
| /** @defgroup I2SEx_Exported_Macros I2S Extended Exported Macros | |||
| * @{ | |||
| */ | |||
| #define I2SxEXT(__INSTANCE__) ((__INSTANCE__) == (SPI2)? (SPI_TypeDef *)(I2S2ext_BASE): (SPI_TypeDef *)(I2S3ext_BASE)) | |||
| /** @brief Enable or disable the specified I2SExt peripheral. | |||
| * @param __HANDLE__ specifies the I2S Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_I2SEXT_ENABLE(__HANDLE__) (I2SxEXT((__HANDLE__)->Instance)->I2SCFGR |= SPI_I2SCFGR_I2SE) | |||
| #define __HAL_I2SEXT_DISABLE(__HANDLE__) (I2SxEXT((__HANDLE__)->Instance)->I2SCFGR &= ~SPI_I2SCFGR_I2SE) | |||
| /** @brief Enable or disable the specified I2SExt interrupts. | |||
| * @param __HANDLE__ specifies the I2S Handle. | |||
| * @param __INTERRUPT__ specifies the interrupt source to enable or disable. | |||
| * This parameter can be one of the following values: | |||
| * @arg I2S_IT_TXE: Tx buffer empty interrupt enable | |||
| * @arg I2S_IT_RXNE: RX buffer not empty interrupt enable | |||
| * @arg I2S_IT_ERR: Error interrupt enable | |||
| * @retval None | |||
| */ | |||
| #define __HAL_I2SEXT_ENABLE_IT(__HANDLE__, __INTERRUPT__) (I2SxEXT((__HANDLE__)->Instance)->CR2 |= (__INTERRUPT__)) | |||
| #define __HAL_I2SEXT_DISABLE_IT(__HANDLE__, __INTERRUPT__) (I2SxEXT((__HANDLE__)->Instance)->CR2 &= ~(__INTERRUPT__)) | |||
| /** @brief Checks if the specified I2SExt interrupt source is enabled or disabled. | |||
| * @param __HANDLE__ specifies the I2S Handle. | |||
| * This parameter can be I2S where x: 1, 2, or 3 to select the I2S peripheral. | |||
| * @param __INTERRUPT__ specifies the I2S interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg I2S_IT_TXE: Tx buffer empty interrupt enable | |||
| * @arg I2S_IT_RXNE: RX buffer not empty interrupt enable | |||
| * @arg I2S_IT_ERR: Error interrupt enable | |||
| * @retval The new state of __IT__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_I2SEXT_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((I2SxEXT((__HANDLE__)->Instance)->CR2 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) | |||
| /** @brief Checks whether the specified I2SExt flag is set or not. | |||
| * @param __HANDLE__ specifies the I2S Handle. | |||
| * @param __FLAG__ specifies the flag to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg I2S_FLAG_RXNE: Receive buffer not empty flag | |||
| * @arg I2S_FLAG_TXE: Transmit buffer empty flag | |||
| * @arg I2S_FLAG_UDR: Underrun flag | |||
| * @arg I2S_FLAG_OVR: Overrun flag | |||
| * @arg I2S_FLAG_FRE: Frame error flag | |||
| * @arg I2S_FLAG_CHSIDE: Channel Side flag | |||
| * @arg I2S_FLAG_BSY: Busy flag | |||
| * @retval The new state of __FLAG__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_I2SEXT_GET_FLAG(__HANDLE__, __FLAG__) (((I2SxEXT((__HANDLE__)->Instance)->SR) & (__FLAG__)) == (__FLAG__)) | |||
| /** @brief Clears the I2SExt OVR pending flag. | |||
| * @param __HANDLE__ specifies the I2S Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_I2SEXT_CLEAR_OVRFLAG(__HANDLE__) do{ \ | |||
| __IO uint32_t tmpreg_ovr = 0x00U; \ | |||
| tmpreg_ovr = I2SxEXT((__HANDLE__)->Instance)->DR;\ | |||
| tmpreg_ovr = I2SxEXT((__HANDLE__)->Instance)->SR;\ | |||
| UNUSED(tmpreg_ovr); \ | |||
| }while(0U) | |||
| /** @brief Clears the I2SExt UDR pending flag. | |||
| * @param __HANDLE__ specifies the I2S Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_I2SEXT_CLEAR_UDRFLAG(__HANDLE__) do{ \ | |||
| __IO uint32_t tmpreg_udr = 0x00U; \ | |||
| tmpreg_udr = I2SxEXT((__HANDLE__)->Instance)->SR;\ | |||
| UNUSED(tmpreg_udr); \ | |||
| }while(0U) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup I2SEx_Exported_Functions I2S Extended Exported Functions | |||
| * @{ | |||
| @@ -67,12 +125,16 @@ | |||
| /* Extended features functions *************************************************/ | |||
| /* Blocking mode: Polling */ | |||
| HAL_StatusTypeDef HAL_I2SEx_TransmitReceive(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_I2SEx_TransmitReceive(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, | |||
| uint16_t Size, uint32_t Timeout); | |||
| /* Non-Blocking mode: Interrupt */ | |||
| HAL_StatusTypeDef HAL_I2SEx_TransmitReceive_IT(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, uint16_t Size); | |||
| HAL_StatusTypeDef HAL_I2SEx_TransmitReceive_IT(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, | |||
| uint16_t Size); | |||
| /* Non-Blocking mode: DMA */ | |||
| HAL_StatusTypeDef HAL_I2SEx_TransmitReceive_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, uint16_t Size); | |||
| /* I2S Callbacks used in non blocking modes (Interrupt and DMA) */ | |||
| HAL_StatusTypeDef HAL_I2SEx_TransmitReceive_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, | |||
| uint16_t Size); | |||
| /* I2S IRQHandler and Callbacks used in non blocking modes (Interrupt and DMA) */ | |||
| void HAL_I2SEx_FullDuplex_IRQHandler(I2S_HandleTypeDef *hi2s); | |||
| void HAL_I2SEx_TxRxHalfCpltCallback(I2S_HandleTypeDef *hi2s); | |||
| void HAL_I2SEx_TxRxCpltCallback(I2S_HandleTypeDef *hi2s); | |||
| /** | |||
| @@ -93,6 +155,11 @@ void HAL_I2SEx_TxRxCpltCallback(I2S_HandleTypeDef *hi2s); | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* SPI_I2S_FULLDUPLEX_SUPPORT */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -102,6 +169,6 @@ void HAL_I2SEx_TxRxCpltCallback(I2S_HandleTypeDef *hi2s); | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_I2S_EX_H */ | |||
| #endif /* STM32H7xx_HAL_I2S_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_irda_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of IRDA HAL Extended module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_IRDA_EX_H | |||
| #define __STM32H7xx_HAL_IRDA_EX_H | |||
| #ifndef STM32H7xx_HAL_IRDA_EX_H | |||
| #define STM32H7xx_HAL_IRDA_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -50,14 +32,31 @@ | |||
| * @{ | |||
| */ | |||
| /** @addtogroup IRDAEx | |||
| /** @defgroup IRDAEx IRDAEx | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup IRDAEx_Extended_Exported_Constants IRDAEx Extended Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup IRDAEx_Word_Length IRDAEx Word Length | |||
| * @{ | |||
| */ | |||
| #define IRDA_WORDLENGTH_7B USART_CR1_M1 /*!< 7-bit long frame */ | |||
| #define IRDA_WORDLENGTH_8B 0x00000000U /*!< 8-bit long frame */ | |||
| #define IRDA_WORDLENGTH_9B USART_CR1_M0 /*!< 9-bit long frame */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macros -----------------------------------------------------------*/ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| @@ -66,8 +65,8 @@ | |||
| */ | |||
| /** @brief Report the IRDA clock source. | |||
| * @param __HANDLE__: specifies the IRDA Handle. | |||
| * @param __CLOCKSOURCE__: output variable. | |||
| * @param __HANDLE__ specifies the IRDA Handle. | |||
| * @param __CLOCKSOURCE__ output variable. | |||
| * @retval IRDA clocking source, written in __CLOCKSOURCE__. | |||
| */ | |||
| #define IRDA_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \ | |||
| @@ -79,10 +78,10 @@ | |||
| case RCC_USART1CLKSOURCE_D2PCLK2: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_D2PCLK2; \ | |||
| break; \ | |||
| case RCC_USART1CLKSOURCE_PLL2: \ | |||
| case RCC_USART1CLKSOURCE_PLL2: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PLL2Q; \ | |||
| break; \ | |||
| case RCC_USART1CLKSOURCE_PLL3: \ | |||
| case RCC_USART1CLKSOURCE_PLL3: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PLL3Q; \ | |||
| break; \ | |||
| case RCC_USART1CLKSOURCE_HSI: \ | |||
| @@ -94,6 +93,9 @@ | |||
| case RCC_USART1CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| default: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| else if((__HANDLE__)->Instance == USART2) \ | |||
| @@ -103,10 +105,10 @@ | |||
| case RCC_USART2CLKSOURCE_D2PCLK1: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_D2PCLK1; \ | |||
| break; \ | |||
| case RCC_USART2CLKSOURCE_PLL2: \ | |||
| case RCC_USART2CLKSOURCE_PLL2: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PLL2Q; \ | |||
| break; \ | |||
| case RCC_USART2CLKSOURCE_PLL3: \ | |||
| case RCC_USART2CLKSOURCE_PLL3: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PLL3Q; \ | |||
| break; \ | |||
| case RCC_USART2CLKSOURCE_HSI: \ | |||
| @@ -118,6 +120,9 @@ | |||
| case RCC_USART2CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| default: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| else if((__HANDLE__)->Instance == USART3) \ | |||
| @@ -127,10 +132,10 @@ | |||
| case RCC_USART3CLKSOURCE_D2PCLK1: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_D2PCLK1; \ | |||
| break; \ | |||
| case RCC_USART3CLKSOURCE_PLL2: \ | |||
| case RCC_USART3CLKSOURCE_PLL2: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PLL2Q; \ | |||
| break; \ | |||
| case RCC_USART3CLKSOURCE_PLL3: \ | |||
| case RCC_USART3CLKSOURCE_PLL3: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PLL3Q; \ | |||
| break; \ | |||
| case RCC_USART3CLKSOURCE_HSI: \ | |||
| @@ -142,6 +147,9 @@ | |||
| case RCC_USART3CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| default: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| else if((__HANDLE__)->Instance == UART4) \ | |||
| @@ -151,10 +159,10 @@ | |||
| case RCC_UART4CLKSOURCE_D2PCLK1: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_D2PCLK1; \ | |||
| break; \ | |||
| case RCC_UART4CLKSOURCE_PLL2: \ | |||
| case RCC_UART4CLKSOURCE_PLL2: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PLL2Q; \ | |||
| break; \ | |||
| case RCC_UART4CLKSOURCE_PLL3: \ | |||
| case RCC_UART4CLKSOURCE_PLL3: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PLL3Q; \ | |||
| break; \ | |||
| case RCC_UART4CLKSOURCE_HSI: \ | |||
| @@ -166,6 +174,9 @@ | |||
| case RCC_UART4CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| default: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| else if ((__HANDLE__)->Instance == UART5) \ | |||
| @@ -175,10 +186,10 @@ | |||
| case RCC_UART5CLKSOURCE_D2PCLK1: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_D2PCLK1; \ | |||
| break; \ | |||
| case RCC_UART5CLKSOURCE_PLL2: \ | |||
| case RCC_UART5CLKSOURCE_PLL2: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PLL2Q; \ | |||
| break; \ | |||
| case RCC_UART5CLKSOURCE_PLL3: \ | |||
| case RCC_UART5CLKSOURCE_PLL3: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PLL3Q; \ | |||
| break; \ | |||
| case RCC_UART5CLKSOURCE_HSI: \ | |||
| @@ -190,6 +201,9 @@ | |||
| case RCC_UART5CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| default: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| else if((__HANDLE__)->Instance == USART6) \ | |||
| @@ -199,10 +213,10 @@ | |||
| case RCC_USART6CLKSOURCE_D2PCLK2: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_D2PCLK2; \ | |||
| break; \ | |||
| case RCC_USART6CLKSOURCE_PLL2: \ | |||
| case RCC_USART6CLKSOURCE_PLL2: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PLL2Q; \ | |||
| break; \ | |||
| case RCC_USART6CLKSOURCE_PLL3: \ | |||
| case RCC_USART6CLKSOURCE_PLL3: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PLL3Q; \ | |||
| break; \ | |||
| case RCC_USART6CLKSOURCE_HSI: \ | |||
| @@ -214,6 +228,9 @@ | |||
| case RCC_USART6CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| default: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| else if((__HANDLE__)->Instance == UART7) \ | |||
| @@ -223,10 +240,10 @@ | |||
| case RCC_UART7CLKSOURCE_D2PCLK1: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_D2PCLK1; \ | |||
| break; \ | |||
| case RCC_UART7CLKSOURCE_PLL2: \ | |||
| case RCC_UART7CLKSOURCE_PLL2: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PLL2Q; \ | |||
| break; \ | |||
| case RCC_UART7CLKSOURCE_PLL3: \ | |||
| case RCC_UART7CLKSOURCE_PLL3: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PLL3Q; \ | |||
| break; \ | |||
| case RCC_UART7CLKSOURCE_HSI: \ | |||
| @@ -238,19 +255,22 @@ | |||
| case RCC_UART7CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| default: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| else if((__HANDLE__)->Instance == UART8) \ | |||
| else if((__HANDLE__)->Instance == UART8) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_UART8_SOURCE()) \ | |||
| { \ | |||
| case RCC_UART8CLKSOURCE_D2PCLK1: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_D2PCLK1; \ | |||
| break; \ | |||
| case RCC_UART8CLKSOURCE_PLL2: \ | |||
| case RCC_UART8CLKSOURCE_PLL2: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PLL2Q; \ | |||
| break; \ | |||
| case RCC_UART8CLKSOURCE_PLL3: \ | |||
| case RCC_UART8CLKSOURCE_PLL3: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PLL3Q; \ | |||
| break; \ | |||
| case RCC_UART8CLKSOURCE_HSI: \ | |||
| @@ -262,10 +282,70 @@ | |||
| case RCC_UART8CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| default: \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| } while(0) | |||
| else \ | |||
| { \ | |||
| (__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \ | |||
| } \ | |||
| } while(0U) | |||
| /** @brief Compute the mask to apply to retrieve the received data | |||
| * according to the word length and to the parity bits activation. | |||
| * @param __HANDLE__ specifies the IRDA Handle. | |||
| * @retval None, the mask to apply to the associated UART RDR register is stored in (__HANDLE__)->Mask field. | |||
| */ | |||
| #define IRDA_MASK_COMPUTATION(__HANDLE__) \ | |||
| do { \ | |||
| if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_9B) \ | |||
| { \ | |||
| if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x01FFU ; \ | |||
| } \ | |||
| else \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x00FFU ; \ | |||
| } \ | |||
| } \ | |||
| else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_8B) \ | |||
| { \ | |||
| if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x00FFU ; \ | |||
| } \ | |||
| else \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x007FU ; \ | |||
| } \ | |||
| } \ | |||
| else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_7B) \ | |||
| { \ | |||
| if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x007FU ; \ | |||
| } \ | |||
| else \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x003FU ; \ | |||
| } \ | |||
| } \ | |||
| else \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x0000U; \ | |||
| } \ | |||
| } while(0U) | |||
| /** @brief Ensure that IRDA frame length is valid. | |||
| * @param __LENGTH__ IRDA frame length. | |||
| * @retval SET (__LENGTH__ is valid) or RESET (__LENGTH__ is invalid) | |||
| */ | |||
| #define IS_IRDA_WORD_LENGTH(__LENGTH__) (((__LENGTH__) == IRDA_WORDLENGTH_7B) || \ | |||
| ((__LENGTH__) == IRDA_WORDLENGTH_8B) || \ | |||
| ((__LENGTH__) == IRDA_WORDLENGTH_9B)) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -284,6 +364,6 @@ | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_IRDA_EX_H */ | |||
| #endif /* STM32H7xx_HAL_IRDA_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_iwdg.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of IWDG HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_IWDG_H | |||
| #define __STM32H7xx_HAL_IWDG_H | |||
| #ifndef STM32H7xx_HAL_IWDG_H | |||
| #define STM32H7xx_HAL_IWDG_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -50,7 +32,7 @@ | |||
| * @{ | |||
| */ | |||
| /** @addtogroup IWDG IWDG | |||
| /** @defgroup IWDG IWDG | |||
| * @{ | |||
| */ | |||
| @@ -83,8 +65,8 @@ typedef struct | |||
| IWDG_TypeDef *Instance; /*!< Register base address */ | |||
| IWDG_InitTypeDef Init; /*!< IWDG required parameters */ | |||
| } IWDG_HandleTypeDef; | |||
| }IWDG_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| @@ -98,13 +80,14 @@ typedef struct | |||
| /** @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 */ | |||
| #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 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -117,6 +100,7 @@ typedef struct | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -128,15 +112,15 @@ typedef struct | |||
| /** | |||
| * @brief Enable the IWDG peripheral. | |||
| * @param __HANDLE__: IWDG handle | |||
| * @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 & IWDG_WINR registers disabled). | |||
| * @param __HANDLE__: IWDG handle | |||
| * (write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers disabled). | |||
| * @param __HANDLE__ IWDG handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_IWDG_RELOAD_COUNTER(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_RELOAD) | |||
| @@ -196,21 +180,21 @@ HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg); | |||
| /** | |||
| * @brief Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers. | |||
| * @param __HANDLE__: IWDG handle | |||
| * @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, IWDG_RLR and IWDG_WINR registers. | |||
| * @param __HANDLE__: IWDG handle | |||
| * @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 | |||
| * @param __PRESCALER__ IWDG prescaler value | |||
| * @retval None | |||
| */ | |||
| #define IS_IWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == IWDG_PRESCALER_4) || \ | |||
| @@ -223,18 +207,19 @@ HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg); | |||
| /** | |||
| * @brief Check IWDG reload value. | |||
| * @param __RELOAD__: IWDG reload value | |||
| * @param __RELOAD__ IWDG reload value | |||
| * @retval None | |||
| */ | |||
| #define IS_IWDG_RELOAD(__RELOAD__) ((__RELOAD__) <= IWDG_RLR_RL) | |||
| /** | |||
| * @brief Check IWDG window value. | |||
| * @param __WINDOW__: IWDG window value | |||
| * @param __WINDOW__ IWDG window value | |||
| * @retval None | |||
| */ | |||
| #define IS_IWDG_WINDOW(__WINDOW__) ((__WINDOW__) <= IWDG_WINR_WIN) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -252,6 +237,6 @@ HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_IWDG_H */ | |||
| #endif /* STM32H7xx_HAL_IWDG_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,50 +2,33 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_jpeg.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of JPEG HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_JPEG_H | |||
| #define __STM32H7xx_HAL_JPEG_H | |||
| #ifndef STM32H7xx_HAL_JPEG_H | |||
| #define STM32H7xx_HAL_JPEG_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_hal_def.h" | |||
| #include "stm32h7xx_hal_mdma.h" | |||
| #if defined (JPEG) | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| @@ -66,19 +49,19 @@ | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint8_t ColorSpace; /*!< Image Color space : gray-scale, YCBCR, RGB or CMYK | |||
| uint32_t ColorSpace; /*!< Image Color space : gray-scale, YCBCR, RGB or CMYK | |||
| This parameter can be a value of @ref JPEG_ColorSpace */ | |||
| uint8_t ChromaSubsampling; /*!< Chroma Subsampling in case of YCBCR or CMYK color space, 0-> 4:4:4 , 1-> 4:2:2, 2 -> 4:1:1, 3 -> 4:2:0 | |||
| uint32_t ChromaSubsampling; /*!< Chroma Subsampling in case of YCBCR or CMYK color space, 0-> 4:4:4 , 1-> 4:2:2, 2 -> 4:1:1, 3 -> 4:2:0 | |||
| This parameter can be a value of @ref JPEG_ChromaSubsampling */ | |||
| uint32_t ImageHeight; /*!< Image height : number of lines */ | |||
| uint32_t ImageHeight; /*!< Image height : number of lines */ | |||
| uint32_t ImageWidth; /*!< Image width : number of pixels per line */ | |||
| uint32_t ImageWidth; /*!< Image width : number of pixels per line */ | |||
| uint8_t ImageQuality; /*!< Quality of the JPEG encoding : from 1 to 100 */ | |||
| uint32_t ImageQuality; /*!< Quality of the JPEG encoding : from 1 to 100 */ | |||
| }JPEG_ConfTypeDef; | |||
| } JPEG_ConfTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -96,7 +79,7 @@ typedef enum | |||
| HAL_JPEG_STATE_BUSY_DECODING = 0x04U, /*!< JPEG decoding processing is ongoing */ | |||
| HAL_JPEG_STATE_TIMEOUT = 0x05U, /*!< JPEG timeout state */ | |||
| HAL_JPEG_STATE_ERROR = 0x06U /*!< JPEG error state */ | |||
| }HAL_JPEG_STATETypeDef; | |||
| } HAL_JPEG_STATETypeDef; | |||
| /** | |||
| * @} | |||
| @@ -107,7 +90,11 @@ typedef enum | |||
| * @brief JPEG handle Structure definition | |||
| * @{ | |||
| */ | |||
| #if (USE_HAL_JPEG_REGISTER_CALLBACKS == 1) | |||
| typedef struct __JPEG_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* (USE_HAL_JPEG_REGISTER_CALLBACKS) */ | |||
| { | |||
| JPEG_TypeDef *Instance; /*!< JPEG peripheral register base address */ | |||
| @@ -147,12 +134,70 @@ typedef struct | |||
| __IO uint32_t Context; /*!< JPEG Internal context */ | |||
| }JPEG_HandleTypeDef; | |||
| #if (USE_HAL_JPEG_REGISTER_CALLBACKS == 1) | |||
| void (*InfoReadyCallback)(struct __JPEG_HandleTypeDef *hjpeg, | |||
| JPEG_ConfTypeDef *pInfo); /*!< JPEG Info ready callback */ | |||
| void (*EncodeCpltCallback)(struct __JPEG_HandleTypeDef | |||
| *hjpeg); /*!< JPEG Encode complete callback */ | |||
| void (*DecodeCpltCallback)(struct __JPEG_HandleTypeDef | |||
| *hjpeg); /*!< JPEG Decode complete callback */ | |||
| void (*ErrorCallback)(struct __JPEG_HandleTypeDef | |||
| *hjpeg); /*!< JPEG Error callback */ | |||
| void (*GetDataCallback)(struct __JPEG_HandleTypeDef *hjpeg, | |||
| uint32_t NbDecodedData); /*!< JPEG Get Data callback */ | |||
| void (*DataReadyCallback)(struct __JPEG_HandleTypeDef *hjpeg, uint8_t *pDataOut, | |||
| uint32_t OutDataLength); /*!< JPEG Data ready callback */ | |||
| void (* MspInitCallback)(struct __JPEG_HandleTypeDef *hjpeg); /*!< JPEG Msp Init callback */ | |||
| void (* MspDeInitCallback)(struct __JPEG_HandleTypeDef | |||
| *hjpeg); /*!< JPEG Msp DeInit callback */ | |||
| #endif /* (USE_HAL_JPEG_REGISTER_CALLBACKS) */ | |||
| } JPEG_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| #if (USE_HAL_JPEG_REGISTER_CALLBACKS == 1) | |||
| /** @defgroup HAL_JPEG_Callback_ID_enumeration_definition HAL JPEG Callback ID enumeration definition | |||
| * @brief HAL JPEG Callback ID enumeration definition | |||
| * @{ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_JPEG_ENCODE_CPLT_CB_ID = 0x01U, /*!< JPEG Encode Complete callback ID */ | |||
| HAL_JPEG_DECODE_CPLT_CB_ID = 0x02U, /*!< JPEG Decode Complete callback ID */ | |||
| HAL_JPEG_ERROR_CB_ID = 0x03U, /*!< JPEG Error callback ID */ | |||
| HAL_JPEG_MSPINIT_CB_ID = 0x04U, /*!< JPEG MspInit callback ID */ | |||
| HAL_JPEG_MSPDEINIT_CB_ID = 0x05U /*!< JPEG MspDeInit callback ID */ | |||
| } HAL_JPEG_CallbackIDTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_JPEG_Callback_pointer_definition HAL JPEG Callback pointer definition | |||
| * @brief HAL JPEG Callback pointer definition | |||
| * @{ | |||
| */ | |||
| typedef void (*pJPEG_CallbackTypeDef)(JPEG_HandleTypeDef *hjpeg); /*!< pointer to a common JPEG callback function */ | |||
| typedef void (*pJPEG_InfoReadyCallbackTypeDef)(JPEG_HandleTypeDef *hjpeg, | |||
| JPEG_ConfTypeDef *pInfo); /*!< pointer to an Info ready JPEG callback function */ | |||
| typedef void (*pJPEG_GetDataCallbackTypeDef)(JPEG_HandleTypeDef *hjpeg, | |||
| uint32_t NbDecodedData); /*!< pointer to a Get data JPEG callback function */ | |||
| typedef void (*pJPEG_DataReadyCallbackTypeDef)(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataOut, | |||
| uint32_t OutDataLength); /*!< pointer to a Data ready JPEG callback function */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* USE_HAL_JPEG_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -173,7 +218,9 @@ typedef struct | |||
| #define HAL_JPEG_ERROR_QUANT_TABLE ((uint32_t)0x00000002U) /*!< Quantization Table programming error */ | |||
| #define HAL_JPEG_ERROR_DMA ((uint32_t)0x00000004U) /*!< DMA transfer error */ | |||
| #define HAL_JPEG_ERROR_TIMEOUT ((uint32_t)0x00000008U) /*!< Timeout error */ | |||
| #if (USE_HAL_JPEG_REGISTER_CALLBACKS == 1) | |||
| #define HAL_JPEG_ERROR_INVALID_CALLBACK ((uint32_t)0x00000010U) /*!< Invalid Callback error */ | |||
| #endif /* USE_HAL_JPEG_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -277,22 +324,30 @@ typedef struct | |||
| */ | |||
| /** @brief Reset JPEG handle state | |||
| * @param __HANDLE__: specifies the JPEG handle. | |||
| * @param __HANDLE__ specifies the JPEG handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_JPEG_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_JPEG_RESET_HANDLE_STATE(__HANDLE__) do{\ | |||
| (__HANDLE__)->State = HAL_JPEG_STATE_RESET;\ | |||
| (__HANDLE__)->MspInitCallback = NULL;\ | |||
| (__HANDLE__)->MspDeInitCallback = NULL;\ | |||
| }while(0) | |||
| #else | |||
| #define __HAL_JPEG_RESET_HANDLE_STATE(__HANDLE__) ( (__HANDLE__)->State = HAL_JPEG_STATE_RESET) | |||
| #endif /* USE_HAL_JPEG_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @brief Enable the JPEG peripheral. | |||
| * @param __HANDLE__: specifies the JPEG handle. | |||
| * @param __HANDLE__ specifies the JPEG handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_JPEG_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= JPEG_CR_JCEN) | |||
| /** | |||
| * @brief Disable the JPEG peripheral. | |||
| * @param __HANDLE__: specifies the JPEG handle. | |||
| * @param __HANDLE__ specifies the JPEG handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_JPEG_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~JPEG_CR_JCEN) | |||
| @@ -300,8 +355,8 @@ typedef struct | |||
| /** | |||
| * @brief Check the specified JPEG status flag. | |||
| * @param __HANDLE__: specifies the JPEG handle. | |||
| * @param __FLAG__ : specifies the flag to check | |||
| * @param __HANDLE__ specifies the JPEG handle. | |||
| * @param __FLAG__ specifies the flag to check | |||
| * This parameter can be one of the following values: | |||
| * @arg JPEG_FLAG_IFTF : The input FIFO is not full and is bellow its threshold flag | |||
| * @arg JPEG_FLAG_IFNFF : The input FIFO Not Full Flag, a data can be written | |||
| @@ -313,20 +368,20 @@ typedef struct | |||
| * and the internal registers have been updated | |||
| * @arg JPEG_FLAG_COF : JPEG Codec operation on going flag | |||
| * | |||
| * @retval : __HAL_JPEG_GET_FLAG : returns The new state of __FLAG__ (TRUE or FALSE) | |||
| * @retval __HAL_JPEG_GET_FLAG : returns The new state of __FLAG__ (TRUE or FALSE) | |||
| */ | |||
| #define __HAL_JPEG_GET_FLAG(__HANDLE__,__FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__))) | |||
| /** | |||
| * @brief Clear the specified JPEG status flag. | |||
| * @param __HANDLE__: specifies the JPEG handle. | |||
| * @param __FLAG__ : specifies the flag to clear | |||
| * @param __HANDLE__ specifies the JPEG handle. | |||
| * @param __FLAG__ specifies the flag to clear | |||
| * This parameter can be one of the following values: | |||
| * @arg JPEG_FLAG_EOCF : JPEG Codec core has finished the encoding or the decoding process | |||
| * and than last data has been sent to the output FIFO | |||
| * @arg JPEG_FLAG_HPDF : JPEG Codec has finished the parsing of the headers | |||
| * @retval : None | |||
| * @retval None | |||
| */ | |||
| #define __HAL_JPEG_CLEAR_FLAG(__HANDLE__,__FLAG__) (((__HANDLE__)->Instance->CFR |= ((__FLAG__) & (JPEG_FLAG_EOCF | JPEG_FLAG_HPDF)))) | |||
| @@ -334,8 +389,8 @@ typedef struct | |||
| /** | |||
| * @brief Enable Interrupt. | |||
| * @param __HANDLE__: specifies the JPEG handle. | |||
| * @param __INTERRUPT__ : specifies the interrupt to enable | |||
| * @param __HANDLE__ specifies the JPEG handle. | |||
| * @param __INTERRUPT__ specifies the interrupt to enable | |||
| * This parameter can be one of the following values: | |||
| * @arg JPEG_IT_IFT : Input FIFO Threshold Interrupt | |||
| * @arg JPEG_IT_IFNF : Input FIFO Not Full Interrupt | |||
| @@ -344,14 +399,14 @@ typedef struct | |||
| * @arg JPEG_IT_EOC : End of Conversion Interrupt | |||
| * @arg JPEG_IT_HPD : Header Parsing Done Interrupt | |||
| * | |||
| * @retval : No retrun | |||
| * @retval No retrun | |||
| */ | |||
| #define __HAL_JPEG_ENABLE_IT(__HANDLE__,__INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__) ) | |||
| /** | |||
| * @brief Disable Interrupt. | |||
| * @param __HANDLE__: specifies the JPEG handle. | |||
| * @param __INTERRUPT__ : specifies the interrupt to disable | |||
| * @param __HANDLE__ specifies the JPEG handle. | |||
| * @param __INTERRUPT__ specifies the interrupt to disable | |||
| * This parameter can be one of the following values: | |||
| * @arg JPEG_IT_IFT : Input FIFO Threshold Interrupt | |||
| * @arg JPEG_IT_IFNF : Input FIFO Not Full Interrupt | |||
| @@ -360,17 +415,17 @@ typedef struct | |||
| * @arg JPEG_IT_EOC : End of Conversion Interrupt | |||
| * @arg JPEG_IT_HPD : Header Parsing Done Interrupt | |||
| * | |||
| * @note : To disable an IT we must use MODIFY_REG macro to avoid writing "1" to the FIFO flush bits | |||
| * @note To disable an IT we must use MODIFY_REG macro to avoid writing "1" to the FIFO flush bits | |||
| * located in the same IT enable register (CR register). | |||
| * @retval : No retrun | |||
| * @retval No retrun | |||
| */ | |||
| #define __HAL_JPEG_DISABLE_IT(__HANDLE__,__INTERRUPT__) MODIFY_REG((__HANDLE__)->Instance->CR, (__INTERRUPT__), 0) | |||
| #define __HAL_JPEG_DISABLE_IT(__HANDLE__,__INTERRUPT__) MODIFY_REG((__HANDLE__)->Instance->CR, (__INTERRUPT__), 0UL) | |||
| /** | |||
| * @brief Get Interrupt state. | |||
| * @param __HANDLE__: specifies the JPEG handle. | |||
| * @param __INTERRUPT__ : specifies the interrupt to check | |||
| * @param __HANDLE__ specifies the JPEG handle. | |||
| * @param __INTERRUPT__ specifies the interrupt to check | |||
| * This parameter can be one of the following values: | |||
| * @arg JPEG_IT_IFT : Input FIFO Threshold Interrupt | |||
| * @arg JPEG_IT_IFNF : Input FIFO Not Full Interrupt | |||
| @@ -379,7 +434,7 @@ typedef struct | |||
| * @arg JPEG_IT_EOC : End of Conversion Interrupt | |||
| * @arg JPEG_IT_HPD : Header Parsing Done Interrupt | |||
| * | |||
| * @retval : returns The new state of __INTERRUPT__ (Enabled or disabled) | |||
| * @retval returns The new state of __INTERRUPT__ (Enabled or disabled) | |||
| */ | |||
| #define __HAL_JPEG_GET_IT_SOURCE(__HANDLE__,__INTERRUPT__) ((__HANDLE__)->Instance->CR & (__INTERRUPT__)) | |||
| @@ -401,6 +456,24 @@ HAL_StatusTypeDef HAL_JPEG_DeInit(JPEG_HandleTypeDef *hjpeg); | |||
| void HAL_JPEG_MspInit(JPEG_HandleTypeDef *hjpeg); | |||
| void HAL_JPEG_MspDeInit(JPEG_HandleTypeDef *hjpeg); | |||
| #if (USE_HAL_JPEG_REGISTER_CALLBACKS == 1) | |||
| HAL_StatusTypeDef HAL_JPEG_RegisterCallback(JPEG_HandleTypeDef *hjpeg, HAL_JPEG_CallbackIDTypeDef CallbackID, | |||
| pJPEG_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_JPEG_UnRegisterCallback(JPEG_HandleTypeDef *hjpeg, HAL_JPEG_CallbackIDTypeDef CallbackID); | |||
| HAL_StatusTypeDef HAL_JPEG_RegisterInfoReadyCallback(JPEG_HandleTypeDef *hjpeg, | |||
| pJPEG_InfoReadyCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_JPEG_UnRegisterInfoReadyCallback(JPEG_HandleTypeDef *hjpeg); | |||
| HAL_StatusTypeDef HAL_JPEG_RegisterGetDataCallback(JPEG_HandleTypeDef *hjpeg, pJPEG_GetDataCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_JPEG_UnRegisterGetDataCallback(JPEG_HandleTypeDef *hjpeg); | |||
| HAL_StatusTypeDef HAL_JPEG_RegisterDataReadyCallback(JPEG_HandleTypeDef *hjpeg, | |||
| pJPEG_DataReadyCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_JPEG_UnRegisterDataReadyCallback(JPEG_HandleTypeDef *hjpeg); | |||
| #endif /* USE_HAL_JPEG_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -413,7 +486,8 @@ HAL_StatusTypeDef HAL_JPEG_ConfigEncoding(JPEG_HandleTypeDef *hjpeg, JPEG_ConfTy | |||
| HAL_StatusTypeDef HAL_JPEG_GetInfo(JPEG_HandleTypeDef *hjpeg, JPEG_ConfTypeDef *pInfo); | |||
| HAL_StatusTypeDef HAL_JPEG_EnableHeaderParsing(JPEG_HandleTypeDef *hjpeg); | |||
| HAL_StatusTypeDef HAL_JPEG_DisableHeaderParsing(JPEG_HandleTypeDef *hjpeg); | |||
| HAL_StatusTypeDef HAL_JPEG_SetUserQuantTables(JPEG_HandleTypeDef *hjpeg, uint8_t *QTable0, uint8_t *QTable1, uint8_t *QTable2, uint8_t *QTable3); | |||
| HAL_StatusTypeDef HAL_JPEG_SetUserQuantTables(JPEG_HandleTypeDef *hjpeg, uint8_t *QTable0, uint8_t *QTable1, | |||
| uint8_t *QTable2, uint8_t *QTable3); | |||
| /** | |||
| * @} | |||
| @@ -423,12 +497,18 @@ HAL_StatusTypeDef HAL_JPEG_SetUserQuantTables(JPEG_HandleTypeDef *hjpeg, uint8_t | |||
| * @{ | |||
| */ | |||
| /* JPEG processing functions **************************************/ | |||
| HAL_StatusTypeDef HAL_JPEG_Encode(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataInMCU, uint32_t InDataLength, uint8_t *pDataOut, uint32_t OutDataLength, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_JPEG_Decode(JPEG_HandleTypeDef *hjpeg ,uint8_t *pDataIn ,uint32_t InDataLength ,uint8_t *pDataOutMCU ,uint32_t OutDataLength, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_JPEG_Encode_IT(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataInMCU, uint32_t InDataLength, uint8_t *pDataOut, uint32_t OutDataLength); | |||
| HAL_StatusTypeDef HAL_JPEG_Decode_IT(JPEG_HandleTypeDef *hjpeg ,uint8_t *pDataIn ,uint32_t InDataLength ,uint8_t *pDataOutMCU ,uint32_t OutDataLength); | |||
| HAL_StatusTypeDef HAL_JPEG_Encode_DMA(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataInMCU, uint32_t InDataLength, uint8_t *pDataOut, uint32_t OutDataLength); | |||
| HAL_StatusTypeDef HAL_JPEG_Decode_DMA(JPEG_HandleTypeDef *hjpeg ,uint8_t *pDataIn ,uint32_t InDataLength ,uint8_t *pDataOutMCU ,uint32_t OutDataLength); | |||
| HAL_StatusTypeDef HAL_JPEG_Encode(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataInMCU, uint32_t InDataLength, | |||
| uint8_t *pDataOut, uint32_t OutDataLength, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_JPEG_Decode(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataIn, uint32_t InDataLength, | |||
| uint8_t *pDataOutMCU, uint32_t OutDataLength, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_JPEG_Encode_IT(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataInMCU, uint32_t InDataLength, | |||
| uint8_t *pDataOut, uint32_t OutDataLength); | |||
| HAL_StatusTypeDef HAL_JPEG_Decode_IT(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataIn, uint32_t InDataLength, | |||
| uint8_t *pDataOutMCU, uint32_t OutDataLength); | |||
| HAL_StatusTypeDef HAL_JPEG_Encode_DMA(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataInMCU, uint32_t InDataLength, | |||
| uint8_t *pDataOut, uint32_t OutDataLength); | |||
| HAL_StatusTypeDef HAL_JPEG_Decode_DMA(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataIn, uint32_t InDataLength, | |||
| uint8_t *pDataOutMCU, uint32_t OutDataLength); | |||
| HAL_StatusTypeDef HAL_JPEG_Pause(JPEG_HandleTypeDef *hjpeg, uint32_t XferSelection); | |||
| HAL_StatusTypeDef HAL_JPEG_Resume(JPEG_HandleTypeDef *hjpeg, uint32_t XferSelection); | |||
| void HAL_JPEG_ConfigInputBuffer(JPEG_HandleTypeDef *hjpeg, uint8_t *pNewInputBuffer, uint32_t InDataLength); | |||
| @@ -443,12 +523,12 @@ HAL_StatusTypeDef HAL_JPEG_Abort(JPEG_HandleTypeDef *hjpeg); | |||
| * @{ | |||
| */ | |||
| /* JPEG Decode/Encode callback functions ********************************************************/ | |||
| void HAL_JPEG_InfoReadyCallback(JPEG_HandleTypeDef *hjpeg,JPEG_ConfTypeDef *pInfo); | |||
| void HAL_JPEG_InfoReadyCallback(JPEG_HandleTypeDef *hjpeg, JPEG_ConfTypeDef *pInfo); | |||
| void HAL_JPEG_EncodeCpltCallback(JPEG_HandleTypeDef *hjpeg); | |||
| void HAL_JPEG_DecodeCpltCallback(JPEG_HandleTypeDef *hjpeg); | |||
| void HAL_JPEG_ErrorCallback(JPEG_HandleTypeDef *hjpeg); | |||
| void HAL_JPEG_GetDataCallback(JPEG_HandleTypeDef *hjpeg, uint32_t NbDecodedData); | |||
| void HAL_JPEG_DataReadyCallback (JPEG_HandleTypeDef *hjpeg, uint8_t *pDataOut, uint32_t OutDataLength); | |||
| void HAL_JPEG_DataReadyCallback(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataOut, uint32_t OutDataLength); | |||
| /** | |||
| * @} | |||
| @@ -469,7 +549,7 @@ void HAL_JPEG_IRQHandler(JPEG_HandleTypeDef *hjpeg); | |||
| */ | |||
| /* Peripheral State and Error functions ************************************************/ | |||
| HAL_JPEG_STATETypeDef HAL_JPEG_GetState(JPEG_HandleTypeDef *hjpeg); | |||
| uint32_t HAL_JPEG_GetError(JPEG_HandleTypeDef *hjpeg); | |||
| uint32_t HAL_JPEG_GetError(JPEG_HandleTypeDef *hjpeg); | |||
| /** | |||
| * @} | |||
| @@ -563,10 +643,13 @@ uint32_t HAL_JPEG_GetError(JPEG_HandleTypeDef *hjpeg); | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* JPEG */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_JPEG_H */ | |||
| #endif /* STM32H7xx_HAL_JPEG_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,26 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_lptim.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of LPTIM HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * | |||
| ****************************************************************************** | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_LPTIM_H | |||
| #define __STM32H7xx_HAL_LPTIM_H | |||
| #ifndef STM32H7xx_HAL_LPTIM_H | |||
| #define STM32H7xx_HAL_LPTIM_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -50,6 +31,8 @@ | |||
| * @{ | |||
| */ | |||
| #if defined (LPTIM1) || defined (LPTIM2) || defined (LPTIM3) || defined (LPTIM4) || defined (LPTIM5) | |||
| /** @addtogroup LPTIM | |||
| * @{ | |||
| */ | |||
| @@ -70,7 +53,7 @@ typedef struct | |||
| uint32_t Prescaler; /*!< Specifies the counter clock Prescaler. | |||
| This parameter can be a value of @ref LPTIM_Clock_Prescaler */ | |||
| }LPTIM_ClockConfigTypeDef; | |||
| } LPTIM_ClockConfigTypeDef; | |||
| /** | |||
| * @brief LPTIM Clock configuration definition | |||
| @@ -88,7 +71,7 @@ typedef struct | |||
| 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; | |||
| } LPTIM_ULPClockConfigTypeDef; | |||
| /** | |||
| * @brief LPTIM Trigger configuration definition | |||
| @@ -105,7 +88,7 @@ typedef struct | |||
| 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; | |||
| } LPTIM_TriggerConfigTypeDef; | |||
| /** | |||
| * @brief LPTIM Initialization Structure definition | |||
| @@ -121,7 +104,7 @@ typedef struct | |||
| 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 | |||
| uint32_t UpdateMode; /*!< Specifies whether the update of the autoreload 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 */ | |||
| @@ -136,38 +119,75 @@ typedef struct | |||
| Note: This parameter is used only for encoder feature so is used only | |||
| for LPTIM1 instance. | |||
| This parameter can be a value of @ref LPTIM_Input2_Source */ | |||
| }LPTIM_InitTypeDef; | |||
| } LPTIM_InitTypeDef; | |||
| /** | |||
| * @brief HAL LPTIM State structure definition | |||
| */ | |||
| typedef enum __HAL_LPTIM_StateTypeDef | |||
| typedef enum | |||
| { | |||
| 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; | |||
| HAL_LPTIM_STATE_ERROR = 0x04U /*!< Internal Process is ongoing */ | |||
| } HAL_LPTIM_StateTypeDef; | |||
| /** | |||
| * @brief LPTIM handle Structure definition | |||
| */ | |||
| #if (USE_HAL_LPTIM_REGISTER_CALLBACKS == 1) | |||
| typedef struct __LPTIM_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_LPTIM_REGISTER_CALLBACKS */ | |||
| { | |||
| LPTIM_TypeDef *Instance; /*!< Register base address */ | |||
| LPTIM_TypeDef *Instance; /*!< Register base address */ | |||
| LPTIM_InitTypeDef Init; /*!< LPTIM required parameters */ | |||
| LPTIM_InitTypeDef Init; /*!< LPTIM required parameters */ | |||
| HAL_StatusTypeDef Status; /*!< LPTIM peripheral status */ | |||
| HAL_StatusTypeDef Status; /*!< LPTIM peripheral status */ | |||
| HAL_LockTypeDef Lock; /*!< LPTIM locking object */ | |||
| HAL_LockTypeDef Lock; /*!< LPTIM locking object */ | |||
| __IO HAL_LPTIM_StateTypeDef State; /*!< LPTIM peripheral state */ | |||
| __IO HAL_LPTIM_StateTypeDef State; /*!< LPTIM peripheral state */ | |||
| }LPTIM_HandleTypeDef; | |||
| #if (USE_HAL_LPTIM_REGISTER_CALLBACKS == 1) | |||
| void (* MspInitCallback)(struct __LPTIM_HandleTypeDef *hlptim); /*!< LPTIM Base Msp Init Callback */ | |||
| void (* MspDeInitCallback)(struct __LPTIM_HandleTypeDef *hlptim); /*!< LPTIM Base Msp DeInit Callback */ | |||
| void (* CompareMatchCallback)(struct __LPTIM_HandleTypeDef *hlptim); /*!< Compare match Callback */ | |||
| void (* AutoReloadMatchCallback)(struct __LPTIM_HandleTypeDef *hlptim); /*!< Auto-reload match Callback */ | |||
| void (* TriggerCallback)(struct __LPTIM_HandleTypeDef *hlptim); /*!< External trigger event detection Callback */ | |||
| void (* CompareWriteCallback)(struct __LPTIM_HandleTypeDef *hlptim); /*!< Compare register write complete Callback */ | |||
| void (* AutoReloadWriteCallback)(struct __LPTIM_HandleTypeDef *hlptim); /*!< Auto-reload register write complete Callback */ | |||
| void (* DirectionUpCallback)(struct __LPTIM_HandleTypeDef *hlptim); /*!< Up-counting direction change Callback */ | |||
| void (* DirectionDownCallback)(struct __LPTIM_HandleTypeDef *hlptim); /*!< Down-counting direction change Callback */ | |||
| #endif /* USE_HAL_LPTIM_REGISTER_CALLBACKS */ | |||
| } LPTIM_HandleTypeDef; | |||
| #if (USE_HAL_LPTIM_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL LPTIM Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_LPTIM_MSPINIT_CB_ID = 0x00U, /*!< LPTIM Base Msp Init Callback ID */ | |||
| HAL_LPTIM_MSPDEINIT_CB_ID = 0x01U, /*!< LPTIM Base Msp DeInit Callback ID */ | |||
| HAL_LPTIM_COMPARE_MATCH_CB_ID = 0x02U, /*!< Compare match Callback ID */ | |||
| HAL_LPTIM_AUTORELOAD_MATCH_CB_ID = 0x03U, /*!< Auto-reload match Callback ID */ | |||
| HAL_LPTIM_TRIGGER_CB_ID = 0x04U, /*!< External trigger event detection Callback ID */ | |||
| HAL_LPTIM_COMPARE_WRITE_CB_ID = 0x05U, /*!< Compare register write complete Callback ID */ | |||
| HAL_LPTIM_AUTORELOAD_WRITE_CB_ID = 0x06U, /*!< Auto-reload register write complete Callback ID */ | |||
| HAL_LPTIM_DIRECTION_UP_CB_ID = 0x07U, /*!< Up-counting direction change Callback ID */ | |||
| HAL_LPTIM_DIRECTION_DOWN_CB_ID = 0x08U, /*!< Down-counting direction change Callback ID */ | |||
| } HAL_LPTIM_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL TIM Callback pointer definition | |||
| */ | |||
| typedef void (*pLPTIM_CallbackTypeDef)(LPTIM_HandleTypeDef *hlptim); /*!< pointer to the LPTIM callback function */ | |||
| #endif /* USE_HAL_LPTIM_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -180,7 +200,7 @@ typedef struct | |||
| /** @defgroup LPTIM_Clock_Source LPTIM Clock Source | |||
| * @{ | |||
| */ | |||
| #define LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC ((uint32_t)0x00U) | |||
| #define LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC 0x00000000U | |||
| #define LPTIM_CLOCKSOURCE_ULPTIM LPTIM_CFGR_CKSEL | |||
| /** | |||
| * @} | |||
| @@ -189,14 +209,14 @@ typedef struct | |||
| /** @defgroup LPTIM_Clock_Prescaler LPTIM Clock Prescaler | |||
| * @{ | |||
| */ | |||
| #define LPTIM_PRESCALER_DIV1 ((uint32_t)0x000000U) | |||
| #define LPTIM_PRESCALER_DIV1 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_DIV8 (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) | |||
| #define LPTIM_PRESCALER_DIV32 (LPTIM_CFGR_PRESC_0 | LPTIM_CFGR_PRESC_2) | |||
| #define LPTIM_PRESCALER_DIV64 (LPTIM_CFGR_PRESC_1 | LPTIM_CFGR_PRESC_2) | |||
| #define LPTIM_PRESCALER_DIV128 LPTIM_CFGR_PRESC | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -205,8 +225,8 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| #define LPTIM_OUTPUTPOLARITY_HIGH ((uint32_t)0x00000000U) | |||
| #define LPTIM_OUTPUTPOLARITY_LOW (LPTIM_CFGR_WAVPOL) | |||
| #define LPTIM_OUTPUTPOLARITY_HIGH 0x00000000U | |||
| #define LPTIM_OUTPUTPOLARITY_LOW LPTIM_CFGR_WAVPOL | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -214,7 +234,7 @@ typedef struct | |||
| /** @defgroup LPTIM_Clock_Sample_Time LPTIM Clock Sample Time | |||
| * @{ | |||
| */ | |||
| #define LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION ((uint32_t)0x00000000U) | |||
| #define LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION 0x00000000U | |||
| #define LPTIM_CLOCKSAMPLETIME_2TRANSITIONS LPTIM_CFGR_CKFLT_0 | |||
| #define LPTIM_CLOCKSAMPLETIME_4TRANSITIONS LPTIM_CFGR_CKFLT_1 | |||
| #define LPTIM_CLOCKSAMPLETIME_8TRANSITIONS LPTIM_CFGR_CKFLT | |||
| @@ -225,8 +245,7 @@ typedef struct | |||
| /** @defgroup LPTIM_Clock_Polarity LPTIM Clock Polarity | |||
| * @{ | |||
| */ | |||
| #define LPTIM_CLOCKPOLARITY_RISING ((uint32_t)0x00000000U) | |||
| #define LPTIM_CLOCKPOLARITY_RISING 0x00000000U | |||
| #define LPTIM_CLOCKPOLARITY_FALLING LPTIM_CFGR_CKPOL_0 | |||
| #define LPTIM_CLOCKPOLARITY_RISING_FALLING LPTIM_CFGR_CKPOL_1 | |||
| /** | |||
| @@ -236,14 +255,14 @@ typedef struct | |||
| /** @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_SOFTWARE 0x0000FFFFU | |||
| #define LPTIM_TRIGSOURCE_0 0x00000000U | |||
| #define LPTIM_TRIGSOURCE_1 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_3 (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) | |||
| #define LPTIM_TRIGSOURCE_6 ((uint32_t)LPTIM_CFGR_TRIGSEL_1 | LPTIM_CFGR_TRIGSEL_2) | |||
| #define LPTIM_TRIGSOURCE_5 (LPTIM_CFGR_TRIGSEL_0 | LPTIM_CFGR_TRIGSEL_2) | |||
| #define LPTIM_TRIGSOURCE_6 (LPTIM_CFGR_TRIGSEL_1 | LPTIM_CFGR_TRIGSEL_2) | |||
| #define LPTIM_TRIGSOURCE_7 LPTIM_CFGR_TRIGSEL | |||
| /** | |||
| * @} | |||
| @@ -262,7 +281,7 @@ typedef struct | |||
| /** @defgroup LPTIM_Trigger_Sample_Time LPTIM Trigger Sample Time | |||
| * @{ | |||
| */ | |||
| #define LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION ((uint32_t)0x00000000) | |||
| #define LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION 0x00000000U | |||
| #define LPTIM_TRIGSAMPLETIME_2TRANSITIONS LPTIM_CFGR_TRGFLT_0 | |||
| #define LPTIM_TRIGSAMPLETIME_4TRANSITIONS LPTIM_CFGR_TRGFLT_1 | |||
| #define LPTIM_TRIGSAMPLETIME_8TRANSITIONS LPTIM_CFGR_TRGFLT | |||
| @@ -274,7 +293,7 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| #define LPTIM_UPDATE_IMMEDIATE ((uint32_t)0x00000000U) | |||
| #define LPTIM_UPDATE_IMMEDIATE 0x00000000U | |||
| #define LPTIM_UPDATE_ENDOFPERIOD LPTIM_CFGR_PRELOAD | |||
| /** | |||
| * @} | |||
| @@ -284,7 +303,7 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| #define LPTIM_COUNTERSOURCE_INTERNAL ((uint32_t)0x00000000U) | |||
| #define LPTIM_COUNTERSOURCE_INTERNAL 0x00000000U | |||
| #define LPTIM_COUNTERSOURCE_EXTERNAL LPTIM_CFGR_COUNTMODE | |||
| /** | |||
| * @} | |||
| @@ -294,12 +313,13 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| #define LPTIM_INPUT1SOURCE_GPIO ((uint32_t)0x00000000U) /*!< For LPTIM1, LPTIM2 and LPTIM3 */ | |||
| #define LPTIM_INPUT1SOURCE_COMP1 LPTIM_CFGR2_IN1_SEL0 /*!< For LPTIM1 and LPTIM2 */ | |||
| #define LPTIM_INPUT1SOURCE_COMP2 LPTIM_CFGR2_IN1_SEL1 /*!< For LPTIM2 and LPTIM2 */ | |||
| #define LPTIM_INPUT1SOURCE_COMP1_COMP2 (LPTIM_CFGR2_IN1_SEL0|LPTIM_CFGR2_IN1_SEL1) /*!< For LPTIM2 */ | |||
| #define LPTIM_INPUT1SOURCE_SAI1_FSA LPTIM_CFGR2_IN1_SEL0 /*!< For LPTIM3 */ | |||
| #define LPTIM_INPUT1SOURCE_SAI1_FSB LPTIM_CFGR2_IN1_SEL1 /*!< For LPTIM3 */ | |||
| #define LPTIM_INPUT1SOURCE_GPIO 0x00000000U /*!< For LPTIM1 and LPTIM2 */ | |||
| #define LPTIM_INPUT1SOURCE_COMP1 LPTIM_CFGR2_IN1SEL_0 /*!< For LPTIM1 and LPTIM2 */ | |||
| #define LPTIM_INPUT1SOURCE_COMP2 LPTIM_CFGR2_IN1SEL_1 /*!< For LPTIM2 */ | |||
| #define LPTIM_INPUT1SOURCE_COMP1_COMP2 (LPTIM_CFGR2_IN1SEL_1 | LPTIM_CFGR2_IN1SEL_0) /*!< For LPTIM2 */ | |||
| #define LPTIM_INPUT1SOURCE_NOT_CONNECTED 0x00000000U /*!< For LPTIM3 */ | |||
| #define LPTIM_INPUT1SOURCE_SAI1_FSA LPTIM_CFGR2_IN1SEL_0 /*!< For LPTIM3 */ | |||
| #define LPTIM_INPUT1SOURCE_SAI1_FSB LPTIM_CFGR2_IN1SEL_1 /*!< For LPTIM3 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -308,8 +328,8 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| #define LPTIM_INPUT2SOURCE_GPIO ((uint32_t)0x00000000U) /*!< For LPTIM1 and LPTIM2 */ | |||
| #define LPTIM_INPUT2SOURCE_COMP2 LPTIM_CFGR2_IN2_SEL0 /*!< For LPTIM1 and LPTIM2 */ | |||
| #define LPTIM_INPUT2SOURCE_GPIO 0x00000000U /*!< For LPTIM1 */ | |||
| #define LPTIM_INPUT2SOURCE_COMP2 LPTIM_CFGR2_IN2SEL_0 /*!< For LPTIM1 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -332,7 +352,6 @@ typedef struct | |||
| /** @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 | |||
| @@ -353,73 +372,84 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| /** @brief Reset LPTIM handle state | |||
| * @param __HANDLE__: LPTIM handle | |||
| /** @brief Reset LPTIM handle state. | |||
| * @param __HANDLE__ LPTIM handle | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_LPTIM_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_LPTIM_RESET_HANDLE_STATE(__HANDLE__) do { \ | |||
| (__HANDLE__)->State = HAL_LPTIM_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_LPTIM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_LPTIM_STATE_RESET) | |||
| #endif /* USE_HAL_LPTIM_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @brief Enable the LPTIM peripheral. | |||
| * @param __HANDLE__: LPTIM handle | |||
| * @param __HANDLE__ LPTIM handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LPTIM_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (LPTIM_CR_ENABLE)) | |||
| #define __HAL_LPTIM_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (LPTIM_CR_ENABLE)) | |||
| /** | |||
| * @brief Disable the LPTIM peripheral. | |||
| * @param __HANDLE__: LPTIM handle | |||
| * @param __HANDLE__ LPTIM handle | |||
| * @note The following sequence is required to solve LPTIM disable HW limitation. | |||
| * Please check Errata Sheet ES0335 for more details under "MCU may remain | |||
| * stuck in LPTIM interrupt when entering Stop mode" section. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LPTIM_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(LPTIM_CR_ENABLE)) | |||
| #define __HAL_LPTIM_DISABLE(__HANDLE__) LPTIM_Disable(__HANDLE__) | |||
| /** | |||
| * @brief Start the LPTIM peripheral in Continuous mode. | |||
| * @param __HANDLE__: LPTIM handle | |||
| * @param __HANDLE__ LPTIM handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LPTIM_START_CONTINUOUS(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_CNTSTRT) | |||
| /** | |||
| * @brief Start the LPTIM peripheral in single mode. | |||
| * @param __HANDLE__: LPTIM handle | |||
| * @param __HANDLE__ LPTIM handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LPTIM_START_SINGLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_SNGSTRT) | |||
| /** | |||
| * @brief Reset the LPTIM Counter register in synchronous mode. | |||
| * @param __HANDLE__: LPTIM handle | |||
| * @param __HANDLE__ LPTIM handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LPTIM_RESET_COUNTER(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_COUNTRST) | |||
| /** | |||
| * @brief Reset after read of the LPTIM Counter register in asynchronous mode. | |||
| * @param __HANDLE__: LPTIM handle | |||
| * @param __HANDLE__ LPTIM handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LPTIM_RESET_COUNTER_AFTERREAD(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_RSTARE) | |||
| /** | |||
| * @brief Write the passed parameter in the Autoreload register. | |||
| * @param __HANDLE__: LPTIM handle | |||
| * @param __VALUE__ : Autoreload value | |||
| * @param __HANDLE__ LPTIM handle | |||
| * @param __VALUE__ Autoreload value | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LPTIM_AUTORELOAD_SET(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->ARR = (__VALUE__)) | |||
| /** | |||
| * @brief Write the passed parameter in the Compare register. | |||
| * @param __HANDLE__: LPTIM handle | |||
| * @param __VALUE__ : Compare value | |||
| * @param __HANDLE__ LPTIM handle | |||
| * @param __VALUE__ Compare value | |||
| * @retval None | |||
| */ | |||
| #define __HAL_LPTIM_COMPARE_SET(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->CMP = (__VALUE__)) | |||
| /** | |||
| * @brief Check whether the specified LPTIM flag is set or not. | |||
| * @param __HANDLE__: LPTIM handle | |||
| * @param __FLAG__ : LPTIM flag to check | |||
| * @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. | |||
| @@ -434,8 +464,8 @@ typedef struct | |||
| /** | |||
| * @brief Clear the specified LPTIM flag. | |||
| * @param __HANDLE__: LPTIM handle. | |||
| * @param __FLAG__ : LPTIM flag to clear. | |||
| * @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. | |||
| @@ -450,8 +480,8 @@ typedef struct | |||
| /** | |||
| * @brief Enable the specified LPTIM interrupt. | |||
| * @param __HANDLE__ : LPTIM handle. | |||
| * @param __INTERRUPT__ : LPTIM interrupt to set. | |||
| * @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. | |||
| @@ -464,10 +494,10 @@ typedef struct | |||
| */ | |||
| #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. | |||
| * @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. | |||
| @@ -480,10 +510,10 @@ typedef struct | |||
| */ | |||
| #define __HAL_LPTIM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= (~(__INTERRUPT__))) | |||
| /** | |||
| * @brief Check whether the specified LPTIM interrupt is set or not. | |||
| * @param __HANDLE__ : LPTIM handle. | |||
| * @param __INTERRUPT__ : LPTIM interrupt to check. | |||
| /** | |||
| * @brief Check whether the specified LPTIM interrupt source is enabled 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. | |||
| @@ -500,109 +530,7 @@ typedef struct | |||
| /** | |||
| * @} | |||
| */ | |||
| /* End of exported macros ----------------------------------------------------*/ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup LPTIM_Private_Constants LPTIM Private Constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* End of 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) || \ | |||
| ((__TRIG__) == LPTIM_TRIGSOURCE_6) || \ | |||
| ((__TRIG__) == LPTIM_TRIGSOURCE_7)) | |||
| #define IS_LPTIM_EXT_TRG_POLARITY(__POLARITY__) (((__POLARITY__) == LPTIM_ACTIVEEDGE_RISING ) || \ | |||
| ((__POLARITY__) == LPTIM_ACTIVEEDGE_FALLING ) || \ | |||
| ((__POLARITY__) == 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__) <= 0x0000FFFF) | |||
| #define IS_LPTIM_COMPARE(__COMPARE__) ((__COMPARE__) <= 0x0000FFFF) | |||
| #define IS_LPTIM_PERIOD(__PERIOD__) ((__PERIOD__) <= 0x0000FFFF) | |||
| #define IS_LPTIM_PULSE(__PULSE__) ((__PULSE__) <= 0x0000FFFF) | |||
| #define IS_LPTIM_INPUT1_SOURCE(__INSTANCE__, __SOURCE__) \ | |||
| ((((__INSTANCE__) == LPTIM1) && \ | |||
| (((__SOURCE__) == LPTIM_INPUT1SOURCE_GPIO) || \ | |||
| ((__SOURCE__) == LPTIM_INPUT1SOURCE_COMP1))) \ | |||
| || \ | |||
| (((__INSTANCE__) == LPTIM2) && \ | |||
| (((__SOURCE__) == LPTIM_INPUT1SOURCE_GPIO) || \ | |||
| ((__SOURCE__) == LPTIM_INPUT1SOURCE_COMP1) || \ | |||
| ((__SOURCE__) == LPTIM_INPUT1SOURCE_COMP2) || \ | |||
| ((__SOURCE__) == LPTIM_INPUT1SOURCE_COMP1_COMP2))) \ | |||
| || \ | |||
| (((__INSTANCE__) == LPTIM3) && \ | |||
| (((__SOURCE__) == LPTIM_INPUT1SOURCE_GPIO) || \ | |||
| ((__SOURCE__) == LPTIM_INPUT1SOURCE_SAI1_FSA) || \ | |||
| ((__SOURCE__) == LPTIM_INPUT1SOURCE_SAI1_FSB)))) | |||
| #define IS_LPTIM_INPUT2_SOURCE(__INSTANCE__, __SOURCE__) \ | |||
| (((__INSTANCE__) == LPTIM1) && \ | |||
| (((__SOURCE__) == LPTIM_INPUT2SOURCE_GPIO) || \ | |||
| ((__SOURCE__) == LPTIM_INPUT2SOURCE_COMP2)) \ | |||
| || \ | |||
| ((__INSTANCE__) == LPTIM2) && \ | |||
| (((__SOURCE__) == LPTIM_INPUT2SOURCE_GPIO) || \ | |||
| ((__SOURCE__) == LPTIM_INPUT2SOURCE_COMP2))) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @defgroup LPTIM_Exported_Functions LPTIM Exported Functions | |||
| * @{ | |||
| @@ -682,9 +610,133 @@ void HAL_LPTIM_AutoReloadWriteCallback(LPTIM_HandleTypeDef *hlptim); | |||
| void HAL_LPTIM_DirectionUpCallback(LPTIM_HandleTypeDef *hlptim); | |||
| void HAL_LPTIM_DirectionDownCallback(LPTIM_HandleTypeDef *hlptim); | |||
| /* Callbacks Register/UnRegister functions ***********************************/ | |||
| #if (USE_HAL_LPTIM_REGISTER_CALLBACKS == 1) | |||
| HAL_StatusTypeDef HAL_LPTIM_RegisterCallback(LPTIM_HandleTypeDef *lphtim, HAL_LPTIM_CallbackIDTypeDef CallbackID, pLPTIM_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_LPTIM_UnRegisterCallback(LPTIM_HandleTypeDef *lphtim, HAL_LPTIM_CallbackIDTypeDef CallbackID); | |||
| #endif /* USE_HAL_LPTIM_REGISTER_CALLBACKS */ | |||
| /* 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) || \ | |||
| ((__TRIG__) == LPTIM_TRIGSOURCE_6) || \ | |||
| ((__TRIG__) == LPTIM_TRIGSOURCE_7)) | |||
| #define IS_LPTIM_EXT_TRG_POLARITY(__POLARITY__) (((__POLARITY__) == LPTIM_ACTIVEEDGE_RISING ) || \ | |||
| ((__POLARITY__) == LPTIM_ACTIVEEDGE_FALLING ) || \ | |||
| ((__POLARITY__) == 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__) <= 0x0000FFFFUL) | |||
| #define IS_LPTIM_COMPARE(__COMPARE__) ((__COMPARE__) <= 0x0000FFFFUL) | |||
| #define IS_LPTIM_PERIOD(__PERIOD__) ((__PERIOD__) <= 0x0000FFFFUL) | |||
| #define IS_LPTIM_PULSE(__PULSE__) ((__PULSE__) <= 0x0000FFFFUL) | |||
| #define IS_LPTIM_INPUT1_SOURCE(__INSTANCE__, __SOURCE__) \ | |||
| ((((__INSTANCE__) == LPTIM1) && \ | |||
| (((__SOURCE__) == LPTIM_INPUT1SOURCE_GPIO) || \ | |||
| ((__SOURCE__) == LPTIM_INPUT1SOURCE_COMP1))) \ | |||
| || \ | |||
| (((__INSTANCE__) == LPTIM2) && \ | |||
| (((__SOURCE__) == LPTIM_INPUT1SOURCE_GPIO) || \ | |||
| ((__SOURCE__) == LPTIM_INPUT1SOURCE_COMP1) || \ | |||
| ((__SOURCE__) == LPTIM_INPUT1SOURCE_COMP2) || \ | |||
| ((__SOURCE__) == LPTIM_INPUT1SOURCE_COMP1_COMP2))) \ | |||
| || \ | |||
| (((__INSTANCE__) == LPTIM3) && \ | |||
| (((__SOURCE__) == LPTIM_INPUT1SOURCE_NOT_CONNECTED) || \ | |||
| ((__SOURCE__) == LPTIM_INPUT1SOURCE_SAI1_FSA) || \ | |||
| ((__SOURCE__) == LPTIM_INPUT1SOURCE_SAI1_FSB)))) | |||
| #define IS_LPTIM_INPUT2_SOURCE(__INSTANCE__, __SOURCE__) \ | |||
| ((((__INSTANCE__) == LPTIM1) || \ | |||
| ((__INSTANCE__) == LPTIM2)) && \ | |||
| (((__SOURCE__) == LPTIM_INPUT2SOURCE_GPIO) || \ | |||
| ((__SOURCE__) == LPTIM_INPUT2SOURCE_COMP2))) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -693,20 +745,24 @@ HAL_LPTIM_StateTypeDef HAL_LPTIM_GetState(LPTIM_HandleTypeDef *hlptim); | |||
| /** @defgroup LPTIM_Private_Functions LPTIM Private Functions | |||
| * @{ | |||
| */ | |||
| void LPTIM_Disable(LPTIM_HandleTypeDef *lptim); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* LPTIM1 || LPTIM2 || LPTIM3 || LPTIM4 || LPTIM5 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_LPTIM_H */ | |||
| #endif /* STM32H7xx_HAL_LPTIM_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,56 +2,39 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_ltdc.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of LTDC HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_LTDC_H | |||
| #define __STM32H7xx_HAL_LTDC_H | |||
| #ifndef STM32H7xx_HAL_LTDC_H | |||
| #define STM32H7xx_HAL_LTDC_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_hal_def.h" | |||
| #if defined (LTDC) | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup LTDC LTDC | |||
| /** @defgroup LTDC LTDC | |||
| * @brief LTDC HAL module driver | |||
| * @{ | |||
| */ | |||
| @@ -167,7 +150,7 @@ typedef struct | |||
| } LTDC_LayerCfgTypeDef; | |||
| /** | |||
| * @brief HAL LTDC State enumeration definition | |||
| * @brief HAL LTDC State structures definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| @@ -176,12 +159,16 @@ typedef enum | |||
| 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; | |||
| } HAL_LTDC_StateTypeDef; | |||
| /** | |||
| * @brief LTDC handle Structure definition | |||
| */ | |||
| #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) | |||
| typedef struct __LTDC_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ | |||
| { | |||
| LTDC_TypeDef *Instance; /*!< LTDC Register base address */ | |||
| @@ -195,7 +182,41 @@ typedef struct | |||
| __IO uint32_t ErrorCode; /*!< LTDC Error code */ | |||
| #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) | |||
| void (* LineEventCallback)(struct __LTDC_HandleTypeDef *hltdc); /*!< LTDC Line Event Callback */ | |||
| void (* ReloadEventCallback)(struct __LTDC_HandleTypeDef *hltdc); /*!< LTDC Reload Event Callback */ | |||
| void (* ErrorCallback)(struct __LTDC_HandleTypeDef *hltdc); /*!< LTDC Error Callback */ | |||
| void (* MspInitCallback)(struct __LTDC_HandleTypeDef *hltdc); /*!< LTDC Msp Init callback */ | |||
| void (* MspDeInitCallback)(struct __LTDC_HandleTypeDef *hltdc); /*!< LTDC Msp DeInit callback */ | |||
| #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ | |||
| } LTDC_HandleTypeDef; | |||
| #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL LTDC Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_LTDC_MSPINIT_CB_ID = 0x00U, /*!< LTDC MspInit callback ID */ | |||
| HAL_LTDC_MSPDEINIT_CB_ID = 0x01U, /*!< LTDC MspDeInit callback ID */ | |||
| HAL_LTDC_LINE_EVENT_CB_ID = 0x02U, /*!< LTDC Line Event Callback ID */ | |||
| HAL_LTDC_RELOAD_EVENT_CB_ID = 0x03U, /*!< LTDC Reload Callback ID */ | |||
| HAL_LTDC_ERROR_CB_ID = 0x04U /*!< LTDC Error Callback ID */ | |||
| } HAL_LTDC_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL LTDC Callback pointer definition | |||
| */ | |||
| typedef void (*pLTDC_CallbackTypeDef)(LTDC_HandleTypeDef *hltdc); /*!< pointer to an LTDC callback function */ | |||
| #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -208,10 +229,13 @@ typedef struct | |||
| /** @defgroup LTDC_Error_Code LTDC Error Code | |||
| * @{ | |||
| */ | |||
| #define HAL_LTDC_ERROR_NONE (0x00000000U) /*!< LTDC No error */ | |||
| #define HAL_LTDC_ERROR_TE (0x00000001U) /*!< LTDC Transfer error */ | |||
| #define HAL_LTDC_ERROR_FU (0x00000002U) /*!< LTDC FIFO Underrun */ | |||
| #define HAL_LTDC_ERROR_TIMEOUT (0x00000020U) /*!< LTDC Timeout error */ | |||
| #define HAL_LTDC_ERROR_NONE 0x00000000U /*!< LTDC No error */ | |||
| #define HAL_LTDC_ERROR_TE 0x00000001U /*!< LTDC Transfer error */ | |||
| #define HAL_LTDC_ERROR_FU 0x00000002U /*!< LTDC FIFO Underrun */ | |||
| #define HAL_LTDC_ERROR_TIMEOUT 0x00000020U /*!< LTDC Timeout error */ | |||
| #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) | |||
| #define HAL_LTDC_ERROR_INVALID_CALLBACK 0x00000040U /*!< LTDC Invalid Callback error */ | |||
| #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -219,18 +243,17 @@ typedef struct | |||
| /** @defgroup LTDC_Layer LTDC Layer | |||
| * @{ | |||
| */ | |||
| #define LTDC_LAYER_1 (0x00000000U) /*!< LTDC Layer 1 */ | |||
| #define LTDC_LAYER_2 (0x00000001U) /*!< LTDC Layer 2 */ | |||
| #define LTDC_LAYER_1 0x00000000U /*!< LTDC Layer 1 */ | |||
| #define LTDC_LAYER_2 0x00000001U /*!< LTDC Layer 2 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup LTDC_HS_POLARITY LTDC HS POLARITY | |||
| * @{ | |||
| */ | |||
| #define LTDC_HSPOLARITY_AL (0x00000000U) /*!< Horizontal Synchronization is active low. */ | |||
| #define LTDC_HSPOLARITY_AH LTDC_GCR_HSPOL /*!< Horizontal Synchronization is active high. */ | |||
| #define LTDC_HSPOLARITY_AL 0x00000000U /*!< Horizontal Synchronization is active low. */ | |||
| #define LTDC_HSPOLARITY_AH LTDC_GCR_HSPOL /*!< Horizontal Synchronization is active high. */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -238,8 +261,8 @@ typedef struct | |||
| /** @defgroup LTDC_VS_POLARITY LTDC VS POLARITY | |||
| * @{ | |||
| */ | |||
| #define LTDC_VSPOLARITY_AL (0x00000000U) /*!< Vertical Synchronization is active low. */ | |||
| #define LTDC_VSPOLARITY_AH LTDC_GCR_VSPOL /*!< Vertical Synchronization is active high. */ | |||
| #define LTDC_VSPOLARITY_AL 0x00000000U /*!< Vertical Synchronization is active low. */ | |||
| #define LTDC_VSPOLARITY_AH LTDC_GCR_VSPOL /*!< Vertical Synchronization is active high. */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -247,8 +270,8 @@ typedef struct | |||
| /** @defgroup LTDC_DE_POLARITY LTDC DE POLARITY | |||
| * @{ | |||
| */ | |||
| #define LTDC_DEPOLARITY_AL (0x00000000U) /*!< Data Enable, is active low. */ | |||
| #define LTDC_DEPOLARITY_AH LTDC_GCR_DEPOL /*!< Data Enable, is active high. */ | |||
| #define LTDC_DEPOLARITY_AL 0x00000000U /*!< Data Enable, is active low. */ | |||
| #define LTDC_DEPOLARITY_AH LTDC_GCR_DEPOL /*!< Data Enable, is active high. */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -256,8 +279,8 @@ typedef struct | |||
| /** @defgroup LTDC_PC_POLARITY LTDC PC POLARITY | |||
| * @{ | |||
| */ | |||
| #define LTDC_PCPOLARITY_IPC (0x00000000U) /*!< input pixel clock. */ | |||
| #define LTDC_PCPOLARITY_IIPC LTDC_GCR_PCPOL /*!< inverted input pixel clock. */ | |||
| #define LTDC_PCPOLARITY_IPC 0x00000000U /*!< input pixel clock. */ | |||
| #define LTDC_PCPOLARITY_IIPC LTDC_GCR_PCPOL /*!< inverted input pixel clock. */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -265,8 +288,8 @@ typedef struct | |||
| /** @defgroup LTDC_SYNC LTDC SYNC | |||
| * @{ | |||
| */ | |||
| #define LTDC_HORIZONTALSYNC (LTDC_SSCR_HSW >> 16) /*!< Horizontal synchronization width. */ | |||
| #define LTDC_VERTICALSYNC LTDC_SSCR_VSH /*!< Vertical synchronization height. */ | |||
| #define LTDC_HORIZONTALSYNC (LTDC_SSCR_HSW >> 16U) /*!< Horizontal synchronization width. */ | |||
| #define LTDC_VERTICALSYNC LTDC_SSCR_VSH /*!< Vertical synchronization height. */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -274,7 +297,7 @@ typedef struct | |||
| /** @defgroup LTDC_BACK_COLOR LTDC BACK COLOR | |||
| * @{ | |||
| */ | |||
| #define LTDC_COLOR (0x000000FFU) /*!< Color mask */ | |||
| #define LTDC_COLOR 0x000000FFU /*!< Color mask */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -282,8 +305,8 @@ typedef struct | |||
| /** @defgroup LTDC_BlendingFactor1 LTDC Blending Factor1 | |||
| * @{ | |||
| */ | |||
| #define LTDC_BLENDING_FACTOR1_CA (0x00000400U) /*!< Blending factor : Cte Alpha */ | |||
| #define LTDC_BLENDING_FACTOR1_PAxCA (0x00000600U) /*!< Blending factor : Cte Alpha x Pixel Alpha*/ | |||
| #define LTDC_BLENDING_FACTOR1_CA 0x00000400U /*!< Blending factor : Cte Alpha */ | |||
| #define LTDC_BLENDING_FACTOR1_PAxCA 0x00000600U /*!< Blending factor : Cte Alpha x Pixel Alpha*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -291,8 +314,8 @@ typedef struct | |||
| /** @defgroup LTDC_BlendingFactor2 LTDC Blending Factor2 | |||
| * @{ | |||
| */ | |||
| #define LTDC_BLENDING_FACTOR2_CA (0x00000005U) /*!< Blending factor : Cte Alpha */ | |||
| #define LTDC_BLENDING_FACTOR2_PAxCA (0x00000007U) /*!< Blending factor : Cte Alpha x Pixel Alpha*/ | |||
| #define LTDC_BLENDING_FACTOR2_CA 0x00000005U /*!< Blending factor : Cte Alpha */ | |||
| #define LTDC_BLENDING_FACTOR2_PAxCA 0x00000007U /*!< Blending factor : Cte Alpha x Pixel Alpha*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -300,14 +323,14 @@ typedef struct | |||
| /** @defgroup LTDC_Pixelformat LTDC Pixel format | |||
| * @{ | |||
| */ | |||
| #define LTDC_PIXEL_FORMAT_ARGB8888 (0x00000000U) /*!< ARGB8888 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_RGB888 (0x00000001U) /*!< RGB888 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_RGB565 (0x00000002U) /*!< RGB565 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_ARGB1555 (0x00000003U) /*!< ARGB1555 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_ARGB4444 (0x00000004U) /*!< ARGB4444 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_L8 (0x00000005U) /*!< L8 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_AL44 (0x00000006U) /*!< AL44 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_AL88 (0x00000007U) /*!< AL88 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_ARGB8888 0x00000000U /*!< ARGB8888 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_RGB888 0x00000001U /*!< RGB888 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_RGB565 0x00000002U /*!< RGB565 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_ARGB1555 0x00000003U /*!< ARGB1555 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_ARGB4444 0x00000004U /*!< ARGB4444 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_L8 0x00000005U /*!< L8 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_AL44 0x00000006U /*!< AL44 LTDC pixel format */ | |||
| #define LTDC_PIXEL_FORMAT_AL88 0x00000007U /*!< AL88 LTDC pixel format */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -315,7 +338,7 @@ typedef struct | |||
| /** @defgroup LTDC_Alpha LTDC Alpha | |||
| * @{ | |||
| */ | |||
| #define LTDC_ALPHA LTDC_LxCACR_CONSTA /*!< LTDC Cte Alpha mask */ | |||
| #define LTDC_ALPHA LTDC_LxCACR_CONSTA /*!< LTDC Constant Alpha mask */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -323,11 +346,11 @@ typedef struct | |||
| /** @defgroup LTDC_LAYER_Config LTDC LAYER Config | |||
| * @{ | |||
| */ | |||
| #define LTDC_STOPPOSITION (LTDC_LxWHPCR_WHSPPOS >> 16) /*!< LTDC Layer stop position */ | |||
| #define LTDC_STARTPOSITION LTDC_LxWHPCR_WHSTPOS /*!< LTDC Layer start position */ | |||
| #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 */ | |||
| #define LTDC_COLOR_FRAME_BUFFER LTDC_LxCFBLR_CFBLL /*!< LTDC Layer Line length */ | |||
| #define LTDC_LINE_NUMBER LTDC_LxCFBLNR_CFBLNBR /*!< LTDC Layer Line number */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -335,10 +358,10 @@ typedef struct | |||
| /** @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 | |||
| #define LTDC_IT_LI LTDC_IER_LIE /*!< LTDC Line Interrupt */ | |||
| #define LTDC_IT_FU LTDC_IER_FUIE /*!< LTDC FIFO Underrun Interrupt */ | |||
| #define LTDC_IT_TE LTDC_IER_TERRIE /*!< LTDC Transfer Error Interrupt */ | |||
| #define LTDC_IT_RR LTDC_IER_RRIE /*!< LTDC Register Reload Interrupt */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -346,10 +369,10 @@ typedef struct | |||
| /** @defgroup LTDC_Flags LTDC Flags | |||
| * @{ | |||
| */ | |||
| #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 | |||
| #define LTDC_FLAG_LI LTDC_ISR_LIF /*!< LTDC Line Interrupt Flag */ | |||
| #define LTDC_FLAG_FU LTDC_ISR_FUIF /*!< LTDC FIFO Underrun interrupt Flag */ | |||
| #define LTDC_FLAG_TE LTDC_ISR_TERRIF /*!< LTDC Transfer Error interrupt Flag */ | |||
| #define LTDC_FLAG_RR LTDC_ISR_RRIF /*!< LTDC Register Reload interrupt Flag */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -357,8 +380,8 @@ typedef struct | |||
| /** @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 */ | |||
| #define LTDC_RELOAD_IMMEDIATE LTDC_SRCR_IMR /*!< Immediate Reload */ | |||
| #define LTDC_RELOAD_VERTICAL_BLANKING LTDC_SRCR_VBR /*!< Vertical Blanking Reload */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -376,18 +399,26 @@ typedef struct | |||
| * @param __HANDLE__ LTDC handle | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_LTDC_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->State = HAL_LTDC_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_LTDC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_LTDC_STATE_RESET) | |||
| #endif /*USE_HAL_LTDC_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @brief Enable the LTDC. | |||
| * @param __HANDLE__: LTDC handle | |||
| * @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 | |||
| * @param __HANDLE__ LTDC handle | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_LTDC_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->GCR &= ~(LTDC_GCR_LTDCEN)) | |||
| @@ -427,8 +458,8 @@ typedef struct | |||
| /* Interrupt & Flag management */ | |||
| /** | |||
| * @brief Get the LTDC pending flags. | |||
| * @param __HANDLE__: LTDC handle | |||
| * @param __FLAG__: Get the specified flag. | |||
| * @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 | |||
| @@ -440,8 +471,8 @@ typedef struct | |||
| /** | |||
| * @brief Clears the LTDC pending flags. | |||
| * @param __HANDLE__: LTDC handle | |||
| * @param __FLAG__: specifies the flag to clear. | |||
| * @param __HANDLE__ LTDC handle | |||
| * @param __FLAG__ Specify 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 | |||
| @@ -453,8 +484,8 @@ typedef struct | |||
| /** | |||
| * @brief Enables the specified LTDC interrupts. | |||
| * @param __HANDLE__: LTDC handle | |||
| * @param __INTERRUPT__: specifies the LTDC interrupt sources to be enabled. | |||
| * @param __HANDLE__ LTDC handle | |||
| * @param __INTERRUPT__ Specify 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 | |||
| @@ -466,8 +497,8 @@ typedef struct | |||
| /** | |||
| * @brief Disables the specified LTDC interrupts. | |||
| * @param __HANDLE__: LTDC handle | |||
| * @param __INTERRUPT__: specifies the LTDC interrupt sources to be disabled. | |||
| * @param __HANDLE__ LTDC handle | |||
| * @param __INTERRUPT__ Specify 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 | |||
| @@ -478,9 +509,9 @@ typedef struct | |||
| #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. | |||
| * @brief Check whether the specified LTDC interrupt has occurred or not. | |||
| * @param __HANDLE__ LTDC handle | |||
| * @param __INTERRUPT__ Specify 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 | |||
| @@ -493,12 +524,9 @@ typedef struct | |||
| * @} | |||
| */ | |||
| #if defined(DSI) | |||
| /* Include LTDC HAL Extension module */ | |||
| #include "stm32h7xx_hal_ltdc_ex.h" | |||
| #endif /*DSI*/ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup LTDC_Exported_Functions | |||
| * @{ | |||
| @@ -509,11 +537,18 @@ typedef struct | |||
| /* 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_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); | |||
| /* Callbacks Register/UnRegister functions ***********************************/ | |||
| #if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1) | |||
| HAL_StatusTypeDef HAL_LTDC_RegisterCallback(LTDC_HandleTypeDef *hltdc, HAL_LTDC_CallbackIDTypeDef CallbackID, pLTDC_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_LTDC_UnRegisterCallback(LTDC_HandleTypeDef *hltdc, HAL_LTDC_CallbackIDTypeDef CallbackID); | |||
| #endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -575,41 +610,18 @@ uint32_t HAL_LTDC_GetError(LTDC_HandleTypeDef *hltdc); | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /** @defgroup LTDC_Private_Types LTDC Private Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* 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)) + 0x84 + (0x80*(__LAYER__))))) | |||
| #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)) | |||
| @@ -628,14 +640,12 @@ uint32_t HAL_LTDC_GetError(LTDC_HandleTypeDef *hltdc); | |||
| #define IS_LTDC_REDVALUE(__BRED__) ((__BRED__) <= LTDC_COLOR) | |||
| #define IS_LTDC_BLENDING_FACTOR1(__BLENDING_FACTOR1__) (((__BLENDING_FACTOR1__) == LTDC_BLENDING_FACTOR1_CA) || \ | |||
| ((__BLENDING_FACTOR1__) == LTDC_BLENDING_FACTOR1_PAxCA)) | |||
| #define IS_LTDC_BLENDING_FACTOR2(__BLENDING_FACTOR2__) (((__BLENDING_FACTOR2__) == LTDC_BLENDING_FACTOR2_CA) || \ | |||
| ((__BLENDING_FACTOR2__) == LTDC_BLENDING_FACTOR2_PAxCA)) | |||
| #define IS_LTDC_BLENDING_FACTOR2(__BLENDING_FACTOR1__) (((__BLENDING_FACTOR1__) == LTDC_BLENDING_FACTOR2_CA) || \ | |||
| ((__BLENDING_FACTOR1__) == LTDC_BLENDING_FACTOR2_PAxCA)) | |||
| #define IS_LTDC_PIXEL_FORMAT(__PIXEL_FORMAT__) (((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_ARGB8888) || ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_RGB888) || \ | |||
| ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_RGB565) || ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_ARGB1555) || \ | |||
| ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_ARGB4444) || ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_L8) || \ | |||
| ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_AL44) || ((__PIXEL_FORMAT__) == 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) | |||
| @@ -667,10 +677,12 @@ uint32_t HAL_LTDC_GetError(LTDC_HandleTypeDef *hltdc); | |||
| * @} | |||
| */ | |||
| #endif /* LTDC */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_LTDC_H */ | |||
| #endif /* STM32H7xx_HAL_LTDC_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,86 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_ltdc_ex.h | |||
| * @author MCD Application Team | |||
| * @brief Header file of LTDC HAL Extension module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</center></h2> | |||
| * | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef STM32H7xx_HAL_LTDC_EX_H | |||
| #define STM32H7xx_HAL_LTDC_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_hal_def.h" | |||
| #if defined (LTDC) && defined (DSI) | |||
| #include "stm32h7xx_hal_dsi.h" | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup LTDCEx | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup LTDCEx_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup LTDCEx_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_LTDCEx_StructInitFromVideoConfig(LTDC_HandleTypeDef *hltdc, DSI_VidCfgTypeDef *VidCfg); | |||
| HAL_StatusTypeDef HAL_LTDCEx_StructInitFromAdaptedCommandConfig(LTDC_HandleTypeDef *hltdc, DSI_CmdCfgTypeDef *CmdCfg); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* LTDC && DSI */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* STM32H7xx_HAL_LTDC_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_mdios.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of MDIOS HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_MDIOS_H | |||
| #define __STM32H7xx_HAL_MDIOS_H | |||
| #ifndef STM32H7xx_HAL_MDIOS_H | |||
| #define STM32H7xx_HAL_MDIOS_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -96,21 +78,63 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| #if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1) | |||
| typedef struct __MDIOS_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif | |||
| { | |||
| MDIOS_TypeDef *Instance; /*!< Register base address */ | |||
| MDIOS_InitTypeDef Init; /*!< MDIOS Init Structure */ | |||
| __IO HAL_MDIOS_StateTypeDef State; /*!< MDIOS communication state */ | |||
| __IO HAL_MDIOS_StateTypeDef State; /*!< MDIOS communication state | |||
| This parameter can be a value of of @ref HAL_MDIOS_StateTypeDef */ | |||
| __IO uint32_t ErrorCode; /*!< Holds the global Error code of the MDIOS HAL status machine | |||
| This parameter can be a value of of @ref MDIOS_Error_Code */ | |||
| HAL_LockTypeDef Lock; /*!< MDIOS Lock */ | |||
| #if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1) | |||
| void (* WriteCpltCallback) ( struct __MDIOS_HandleTypeDef * hmdios); /*!< MDIOS Write Complete Callback */ | |||
| void (* ReadCpltCallback) ( struct __MDIOS_HandleTypeDef * hmdios); /*!< MDIOS Read Complete Callback */ | |||
| void (* ErrorCallback) ( struct __MDIOS_HandleTypeDef * hmdios); /*!< MDIOS Error Callback */ | |||
| void (* WakeUpCallback) ( struct __MDIOS_HandleTypeDef * hmdios); /*!< MDIOS Wake UP Callback */ | |||
| void (* MspInitCallback) ( struct __MDIOS_HandleTypeDef * hmdios); /*!< MDIOS Msp Init callback */ | |||
| void (* MspDeInitCallback) ( struct __MDIOS_HandleTypeDef * hmdios); /*!< MDIOS Msp DeInit callback */ | |||
| #endif /* USE_HAL_MDIOS_REGISTER_CALLBACKS */ | |||
| }MDIOS_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| #if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL MDIOS Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_MDIOS_MSPINIT_CB_ID = 0x00U, /*!< MDIOS MspInit callback ID */ | |||
| HAL_MDIOS_MSPDEINIT_CB_ID = 0x01U, /*!< MDIOS MspDeInit callback ID */ | |||
| HAL_MDIOS_WRITE_COMPLETE_CB_ID = 0x02U, /*!< MDIOS Write Complete Callback ID */ | |||
| HAL_MDIOS_READ_COMPLETE_CB_ID = 0x03U, /*!< MDIOS Read Complete Callback ID */ | |||
| HAL_MDIOS_ERROR_CB_ID = 0x04U, /*!< MDIOS Error Callback ID */ | |||
| HAL_MDIOS_WAKEUP_CB_ID = 0x05U /*!< MDIOS Wake UP Callback ID */ | |||
| }HAL_MDIOS_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL MDIOS Callback pointer definition | |||
| */ | |||
| typedef void (*pMDIOS_CallbackTypeDef)(MDIOS_HandleTypeDef * hmdios); /*!< pointer to an MDIOS callback function */ | |||
| #endif /* USE_HAL_MDIOS_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -224,6 +248,21 @@ typedef struct | |||
| #define MDIOS_TURNAROUND_ERROR_FLAG MDIOS_SR_TERF | |||
| #define MDIOS_START_ERROR_FLAG MDIOS_SR_SERF | |||
| #define MDIOS_PREAMBLE_ERROR_FLAG MDIOS_SR_PERF | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup MDIOS_Error_Code MDIOS Error Code | |||
| * @{ | |||
| */ | |||
| #define HAL_MDIOS_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */ | |||
| #define HAL_MDIOS_ERROR_PARAM ((uint32_t)0x00000001U) /*!< Busy error */ | |||
| #define HAL_MDIOS_ERROR_BUSY ((uint32_t)0x00000002U) /*!< Parameter error */ | |||
| #define HAL_MDIOS_ERROR_TIMEOUT ((uint32_t)0x00000004U) /*!< Timeout error */ | |||
| #define HAL_MDIOS_ERROR_DATA ((uint32_t)0x00000010U) /*!< Data transfer error */ | |||
| #if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1) | |||
| #define HAL_MDIOS_ERROR_INVALID_CALLBACK ((uint32_t)0x00000020U) /*!< Invalid Callback error */ | |||
| #endif /* USE_HAL_MDIOS_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -248,7 +287,15 @@ typedef struct | |||
| * @param __HANDLE__: MDIOS handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_MDIOS_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->State = HAL_MDIOS_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_MDIOS_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_MDIOS_STATE_RESET) | |||
| #endif /*USE_HAL_MDIOS_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @brief Enable/Disable the MDIOS peripheral. | |||
| @@ -338,8 +385,19 @@ typedef struct | |||
| * @arg MDIOS_WAKEUP_EXTI_LINE | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_MDIOS_WAKEUP_EXTI_ENABLE_IT(__EXTI_LINE__) (EXTI_D1->IMR2 |= (__EXTI_LINE__)) | |||
| #define __HAL_MDIOS_WAKEUP_EXTI_ENABLE_IT(__EXTI_LINE__) (EXTI->IMR2 |= (__EXTI_LINE__)) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Enable the MDIOS WAKEUP Exti Line by Domain2. | |||
| * @param __EXTI_LINE__: specifies the MDIOS WAKEUP Exti sources to be enabled. | |||
| * This parameter can be: | |||
| * @arg MDIOS_WAKEUP_EXTI_LINE | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_MDIOS_WAKEUP_EXTID2_ENABLE_IT(__EXTI_LINE__) (EXTI->C2IMR2 |= (__EXTI_LINE__)) | |||
| #endif | |||
| /** | |||
| * @brief checks whether the specified MDIOS WAKEUP Exti interrupt flag is set or not. | |||
| * @param __EXTI_LINE__: specifies the MDIOS WAKEUP Exti sources to be cleared. | |||
| @@ -347,8 +405,18 @@ typedef struct | |||
| * @arg MDIOS_WAKEUP_EXTI_LINE | |||
| * @retval EXTI MDIOS WAKEUP Line Status. | |||
| */ | |||
| #define __HAL_MDIOS_WAKEUP_EXTI_GET_FLAG(__EXTI_LINE__) (EXTI_D1->PR2 & (__EXTI_LINE__)) | |||
| #define __HAL_MDIOS_WAKEUP_EXTI_GET_FLAG(__EXTI_LINE__) (EXTI->PR2 & (__EXTI_LINE__)) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief checks whether the specified MDIOS WAKEUP Exti interrupt flag is set or not. | |||
| * @param __EXTI_LINE__: specifies the MDIOS WAKEUP Exti sources to be cleared. | |||
| * This parameter can be: | |||
| * @arg MDIOS_WAKEUP_EXTI_LINE | |||
| * @retval EXTI MDIOS WAKEUP Line Status. | |||
| */ | |||
| #define __HAL_MDIOS_WAKEUP_EXTID2_GET_FLAG(__EXTI_LINE__) (EXTI->C2PR2 & (__EXTI_LINE__)) | |||
| #endif | |||
| /** | |||
| * @brief Clear the MDIOS WAKEUP Exti flag. | |||
| * @param __EXTI_LINE__: specifies the MDIOS WAKEUP Exti sources to be cleared. | |||
| @@ -356,13 +424,24 @@ typedef struct | |||
| * @arg MDIOS_WAKEUP_EXTI_LINE | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_MDIOS_WAKEUP_EXTI_CLEAR_FLAG(__EXTI_LINE__) (EXTI_D1->PR2 = (__EXTI_LINE__)) | |||
| #define __HAL_MDIOS_WAKEUP_EXTI_CLEAR_FLAG(__EXTI_LINE__) (EXTI->PR2 = (__EXTI_LINE__)) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Clear the MDIOS WAKEUP Exti flag. | |||
| * @param __EXTI_LINE__: specifies the MDIOS WAKEUP Exti sources to be cleared. | |||
| * This parameter can be: | |||
| * @arg MDIOS_WAKEUP_EXTI_LINE | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_MDIOS_WAKEUP_EXTID2_CLEAR_FLAG(__EXTI_LINE__) (EXTI->C2PR2 = (__EXTI_LINE__)) | |||
| #endif | |||
| /** | |||
| * @brief enable rising edge interrupt on selected EXTI line. | |||
| * @param __EXTI_LINE__: specifies the ETH WAKEUP EXTI sources to be disabled. | |||
| * @param __EXTI_LINE__: specifies the MDIOS WAKEUP EXTI sources to be disabled. | |||
| * This parameter can be: | |||
| * @arg ETH_WAKEUP_EXTI_LINE | |||
| * @arg MDIOS_WAKEUP_EXTI_LINE | |||
| * @retval None | |||
| */ | |||
| #define __HAL_MDIOS_WAKEUP_EXTI_ENABLE_RISING_EDGE(__EXTI_LINE__) (EXTI->FTSR2 &= ~(__EXTI_LINE__)); \ | |||
| @@ -370,9 +449,9 @@ typedef struct | |||
| /** | |||
| * @brief enable falling edge interrupt on selected EXTI line. | |||
| * @param __EXTI_LINE__: specifies the ETH WAKEUP EXTI sources to be disabled. | |||
| * @param __EXTI_LINE__: specifies the MDIOS WAKEUP EXTI sources to be disabled. | |||
| * This parameter can be: | |||
| * @arg ETH_WAKEUP_EXTI_LINE | |||
| * @arg MDIOS_WAKEUP_EXTI_LINE | |||
| * @retval None | |||
| */ | |||
| #define __HAL_MDIOS_WAKEUP_EXTI_ENABLE_FALLING_EDGE(__EXTI_LINE__) (EXTI->RTSR2 &= ~(__EXTI_LINE__));\ | |||
| @@ -380,9 +459,9 @@ typedef struct | |||
| /** | |||
| * @brief enable falling edge interrupt on selected EXTI line. | |||
| * @param __EXTI_LINE__: specifies the ETH WAKEUP EXTI sources to be disabled. | |||
| * @param __EXTI_LINE__: specifies the MDIOS WAKEUP EXTI sources to be disabled. | |||
| * This parameter can be: | |||
| * @arg ETH_WAKEUP_EXTI_LINE | |||
| * @arg MDIOS_WAKEUP_EXTI_LINE | |||
| * @retval None | |||
| */ | |||
| #define __HAL_MDIOS_WAKEUP_EXTI_ENABLE_RISING_FALLING_EDGE(__EXTI_LINE__) (EXTI->RTSR2 |= (__EXTI_LINE__));\ | |||
| @@ -413,6 +492,12 @@ HAL_StatusTypeDef HAL_MDIOS_Init(MDIOS_HandleTypeDef *hmdios); | |||
| HAL_StatusTypeDef HAL_MDIOS_DeInit(MDIOS_HandleTypeDef *hmdios); | |||
| void HAL_MDIOS_MspInit(MDIOS_HandleTypeDef *hmdios); | |||
| void HAL_MDIOS_MspDeInit(MDIOS_HandleTypeDef *hmdios); | |||
| /* Callbacks Register/UnRegister functions ***********************************/ | |||
| #if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1) | |||
| HAL_StatusTypeDef HAL_MDIOS_RegisterCallback(MDIOS_HandleTypeDef *hmdios, HAL_MDIOS_CallbackIDTypeDef CallbackID, pMDIOS_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_MDIOS_UnRegisterCallback(MDIOS_HandleTypeDef *hmdios, HAL_MDIOS_CallbackIDTypeDef CallbackID); | |||
| #endif /* USE_HAL_MDIOS_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -483,9 +568,9 @@ HAL_MDIOS_StateTypeDef HAL_MDIOS_GetState(MDIOS_HandleTypeDef *hmdios); | |||
| * @{ | |||
| */ | |||
| #define IS_MDIOS_PORTADDRESS(__ADDR__) ((__ADDR__) < 32) | |||
| #define IS_MDIOS_PORTADDRESS(__ADDR__) ((__ADDR__) < 32U) | |||
| #define IS_MDIOS_REGISTER(__REGISTER__) ((__REGISTER__) < 32) | |||
| #define IS_MDIOS_REGISTER(__REGISTER__) ((__REGISTER__) < 32U) | |||
| #define IS_MDIOS_PREAMBLECHECK(__PREAMBLECHECK__) (((__PREAMBLECHECK__) == MDIOS_PREAMBLE_CHECK_ENABLE) || \ | |||
| ((__PREAMBLECHECK__) == MDIOS_PREAMBLE_CHECK_DISABLE)) | |||
| @@ -517,6 +602,6 @@ HAL_MDIOS_StateTypeDef HAL_MDIOS_GetState(MDIOS_HandleTypeDef *hmdios); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_MDIOS_H */ | |||
| #endif /* STM32H7xx_HAL_MDIOS_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_mdma.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of DMA HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_MDMA_H | |||
| #define __STM32H7xx_HAL_MDMA_H | |||
| #ifndef STM32H7xx_HAL_MDMA_H | |||
| #define STM32H7xx_HAL_MDMA_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -146,7 +128,7 @@ typedef struct | |||
| __IO uint32_t CBRUR; /*!< New CBRUR register configuration for the given MDMA linked list node */ | |||
| __IO uint32_t CLAR; /*!< New CLAR register configuration for the given MDMA linked list node */ | |||
| __IO uint32_t CTBR; /*!< New CTBR register configuration for the given MDMA linked list node */ | |||
| __IO uint32_t Reserved; /*!< Reserved register*/ | |||
| __IO uint32_t Reserved; /*!< Reserved register */ | |||
| __IO uint32_t CMAR; /*!< New CMAR register configuration for the given MDMA linked list node */ | |||
| __IO uint32_t CMDR; /*!< New CMDR register configuration for the given MDMA linked list node */ | |||
| @@ -161,8 +143,8 @@ typedef struct | |||
| MDMA_InitTypeDef Init; /*!< configuration of the specified MDMA Linked List Node */ | |||
| uint32_t SrcAddress; /*!< The source memory address for the Linked list Node */ | |||
| uint32_t DstAddress; /*!< The destination memory address for the Linked list Node */ | |||
| uint32_t BlockDataLength; /*!< The length of a block transfer in bytes */ | |||
| uint32_t BlockCount; /*!< The number of a blocks to be transfer */ | |||
| uint32_t BlockDataLength; /*!< The data length of a block in bytes */ | |||
| uint32_t BlockCount; /*!< The number of blocks to be transferred */ | |||
| uint32_t PostRequestMaskAddress; /*!< specifies the address to be updated (written) with PostRequestMaskData after a request is served. | |||
| PostRequestMaskAddress and PostRequestMaskData could be used to automatically clear a peripheral flag when the request is served */ | |||
| @@ -183,7 +165,7 @@ typedef enum | |||
| HAL_MDMA_STATE_READY = 0x01U, /*!< MDMA initialized and ready for use */ | |||
| HAL_MDMA_STATE_BUSY = 0x02U, /*!< MDMA process is ongoing */ | |||
| HAL_MDMA_STATE_ERROR = 0x03U, /*!< MDMA error state */ | |||
| HAL_MDMA_STATE_ABORT = 0x04U, /*!< DMA Abort state */ | |||
| HAL_MDMA_STATE_ABORT = 0x04U, /*!< MDMA Abort state */ | |||
| }HAL_MDMA_StateTypeDef; | |||
| @@ -224,7 +206,6 @@ typedef struct __MDMA_HandleTypeDef | |||
| MDMA_InitTypeDef Init; /*!< MDMA communication parameters */ | |||
| HAL_LockTypeDef Lock; /*!< MDMA locking object */ | |||
| __IO HAL_MDMA_StateTypeDef State; /*!< MDMA transfer state */ | |||
| @@ -246,13 +227,13 @@ typedef struct __MDMA_HandleTypeDef | |||
| MDMA_LinkNodeTypeDef *FirstLinkedListNodeAddress; /*!< specifies the first node address of the transfer list | |||
| (after the initial node defined by the Init struct) | |||
| this parameter is used internally by the MDMA driver | |||
| to construct the liked list node | |||
| this parameter is used internally by the MDMA driver | |||
| to construct the linked list node | |||
| */ | |||
| MDMA_LinkNodeTypeDef *LastLinkedListNodeAddress; /*!< specifies the last node address of the transfer list | |||
| this parameter is used internally by the MDMA driver | |||
| to construct the liked list node | |||
| to construct the linked list node | |||
| */ | |||
| uint32_t LinkedListNodeCounter; /*!< Number of nodes in the MDMA linked list */ | |||
| @@ -323,14 +304,9 @@ typedef struct __MDMA_HandleTypeDef | |||
| #define MDMA_REQUEST_DMA2D_TC ((uint32_t)0x00000019U) /*!< MDMA HW request is DMA2D Transfer Complete Flag */ | |||
| #define MDMA_REQUEST_DMA2D_TW ((uint32_t)0x0000001AU) /*!< MDMA HW request is DMA2D Transfer Watermark Flag */ | |||
| #if defined(DSI) | |||
| #define MDMA_REQUEST_DSI_TEARINGE_FFECT ((uint32_t)0x0000001BU) /*!< MDMA HW request is DSI Tearing Effect Flag */ | |||
| #define MDMA_REQUEST_DSI_END_REFRESH ((uint32_t)0x0000001CU) /*!< MDMA HW request is DSI End of refresh Flag */ | |||
| #endif /* DSI */ | |||
| #define MDMA_REQUEST_SDMMC1_END_DATA ((uint32_t)0x0000001DU) /*!< MDMA HW request is SDMMC1 End of Data Flag */ | |||
| #define MDMA_REQUEST_SW ((uint32_t)0x40000000U) /*!< MDMA SW request */ | |||
| #define MDMA_REQUEST_SW ((uint32_t)0x40000000U) /*!< MDMA SW request */ | |||
| /** | |||
| * @} | |||
| @@ -439,14 +415,14 @@ typedef struct __MDMA_HandleTypeDef | |||
| */ | |||
| /** @defgroup MDMA_data_Alignment MDMA data alignment | |||
| * @brief MDMA MDMA data alignment | |||
| * @brief MDMA data alignment | |||
| * @{ | |||
| */ | |||
| #define MDMA_DATAALIGN_PACKENABLE ((uint32_t)MDMA_CTCR_PKE) /*!< The source data is packed/un-packed into the destination data size | |||
| All data are right aligned, in Little Endien mode. */ | |||
| #define MDMA_DATAALIGN_RIGHT ((uint32_t)0x00000000U) /*!< Right Aligned, padded w/ 0s (default) */ | |||
| #define MDMA_DATAALIGN_RIGHT_SIGNED ((uint32_t)MDMA_CTCR_PAM_0) /*!< Right Aligned, Sign extended , | |||
| Note : this mode is allowed only if the Source data size smaller than Destination data size */ | |||
| Note : this mode is allowed only if the Source data size is smaller than Destination data size */ | |||
| #define MDMA_DATAALIGN_LEFT ((uint32_t)MDMA_CTCR_PAM_1) /*!< Left Aligned (padded with 0s) */ | |||
| /** | |||
| @@ -534,7 +510,7 @@ typedef struct __MDMA_HandleTypeDef | |||
| #define __HAL_MDMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CCR |= MDMA_CCR_EN) | |||
| /** | |||
| * @brief Disable the specified DMA Channel. | |||
| * @brief Disable the specified MDMA Channel. | |||
| * @param __HANDLE__: MDMA handle | |||
| * @retval None | |||
| */ | |||
| @@ -570,7 +546,7 @@ typedef struct __MDMA_HandleTypeDef | |||
| #define __HAL_MDMA_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CIFCR = (__FLAG__)) | |||
| /** | |||
| * @brief Enables the specified DMA Channel interrupts. | |||
| * @brief Enables the specified MDMA Channel interrupts. | |||
| * @param __HANDLE__: MDMA handle | |||
| * @param __INTERRUPT__: specifies the DMA interrupt sources to be enabled or disabled. | |||
| * This parameter can be any combination of the following values: | |||
| @@ -586,7 +562,7 @@ typedef struct __MDMA_HandleTypeDef | |||
| /** | |||
| * @brief Disables the specified MDMA Channel interrupts. | |||
| * @param __HANDLE__: MDMA handle | |||
| * @param __INTERRUPT__: specifies the DMA interrupt sources to be enabled or disabled. | |||
| * @param __INTERRUPT__: specifies the MDMA interrupt sources to be enabled or disabled. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg MDMA_IT_TE : Transfer Error interrupt mask | |||
| * @arg MDMA_IT_CTC : Channel Transfer Complete interrupt mask | |||
| @@ -661,7 +637,7 @@ HAL_StatusTypeDef HAL_MDMA_Start (MDMA_HandleTypeDef *hmdma, uint32_t SrcAddress | |||
| HAL_StatusTypeDef HAL_MDMA_Start_IT(MDMA_HandleTypeDef *hmdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t BlockDataLength, uint32_t BlockCount); | |||
| HAL_StatusTypeDef HAL_MDMA_Abort(MDMA_HandleTypeDef *hmdma); | |||
| HAL_StatusTypeDef HAL_MDMA_Abort_IT(MDMA_HandleTypeDef *hmdma); | |||
| HAL_StatusTypeDef HAL_MDMA_PollForTransfer(MDMA_HandleTypeDef *hmdma, uint32_t CompleteLevel, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_MDMA_PollForTransfer(MDMA_HandleTypeDef *hmdma, HAL_MDMA_LevelCompleteTypeDef CompleteLevel, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_MDMA_GenerateSWRequest(MDMA_HandleTypeDef *hmdma); | |||
| void HAL_MDMA_IRQHandler(MDMA_HandleTypeDef *hmdma); | |||
| @@ -805,11 +781,11 @@ uint32_t HAL_MDMA_GetError(MDMA_HandleTypeDef *hmdma); | |||
| ((__MODE__) == MDMA_REPEAT_BLOCK_TRANSFER ) || \ | |||
| ((__MODE__) == MDMA_FULL_TRANSFER)) | |||
| #define IS_MDMA_BUFFER_TRANSFER_LENGTH(__LENGTH__) (((__LENGTH__) >= 0x00000001) && ((__LENGTH__) < 0x000000FF)) | |||
| #define IS_MDMA_BUFFER_TRANSFER_LENGTH(__LENGTH__) (((__LENGTH__) >= 0x00000001U) && ((__LENGTH__) < 0x000000FFU)) | |||
| #define IS_MDMA_BLOCK_COUNT(__COUNT__) (((__COUNT__) > 0 ) && ((__COUNT__) <= 4096)) | |||
| #define IS_MDMA_BLOCK_COUNT(__COUNT__) (((__COUNT__) > 0U ) && ((__COUNT__) <= 4096U)) | |||
| #define IS_MDMA_TRANSFER_LENGTH(SIZE) (((SIZE) > 0) && ((SIZE) <= 65536)) | |||
| #define IS_MDMA_TRANSFER_LENGTH(SIZE) (((SIZE) > 0U) && ((SIZE) <= 65536U)) | |||
| #define IS_MDMA_BLOCK_ADDR_OFFSET(__BLOCK_ADD_OFFSET__) (((__BLOCK_ADD_OFFSET__) > (-65536)) && ((__BLOCK_ADD_OFFSET__) < 65536)) | |||
| @@ -847,6 +823,6 @@ uint32_t HAL_MDMA_GetError(MDMA_HandleTypeDef *hmdma); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_MDMA_H */ | |||
| #endif /* STM32H7xx_HAL_MDMA_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_mmc.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of MMC HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_MMC_H | |||
| #define __STM32H7xx_HAL_MMC_H | |||
| #ifndef STM32H7xx_HAL_MMC_H | |||
| #define STM32H7xx_HAL_MMC_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -80,18 +62,17 @@ typedef enum | |||
| /** @defgroup MMC_Exported_Types_Group2 MMC Card State enumeration structure | |||
| * @{ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_MMC_CARD_READY = ((uint32_t)0x00000001U), /*!< Card state is ready */ | |||
| HAL_MMC_CARD_IDENTIFICATION = ((uint32_t)0x00000002U), /*!< Card is in identification state */ | |||
| HAL_MMC_CARD_STANDBY = ((uint32_t)0x00000003U), /*!< Card is in standby state */ | |||
| HAL_MMC_CARD_TRANSFER = ((uint32_t)0x00000004U), /*!< Card is in transfer state */ | |||
| HAL_MMC_CARD_SENDING = ((uint32_t)0x00000005U), /*!< Card is sending an operation */ | |||
| HAL_MMC_CARD_RECEIVING = ((uint32_t)0x00000006U), /*!< Card is receiving operation information */ | |||
| HAL_MMC_CARD_PROGRAMMING = ((uint32_t)0x00000007U), /*!< Card is in programming state */ | |||
| HAL_MMC_CARD_DISCONNECTED = ((uint32_t)0x00000008U), /*!< Card is disconnected */ | |||
| HAL_MMC_CARD_ERROR = ((uint32_t)0x000000FFU) /*!< Card response Error */ | |||
| }HAL_MMC_CardStateTypedef; | |||
| typedef uint32_t HAL_MMC_CardStateTypeDef; | |||
| #define HAL_MMC_CARD_READY 0x00000001U /*!< Card state is ready */ | |||
| #define HAL_MMC_CARD_IDENTIFICATION 0x00000002U /*!< Card is in identification state */ | |||
| #define HAL_MMC_CARD_STANDBY 0x00000003U /*!< Card is in standby state */ | |||
| #define HAL_MMC_CARD_TRANSFER 0x00000004U /*!< Card is in transfer state */ | |||
| #define HAL_MMC_CARD_SENDING 0x00000005U /*!< Card is sending an operation */ | |||
| #define HAL_MMC_CARD_RECEIVING 0x00000006U /*!< Card is receiving operation information */ | |||
| #define HAL_MMC_CARD_PROGRAMMING 0x00000007U /*!< Card is in programming state */ | |||
| #define HAL_MMC_CARD_DISCONNECTED 0x00000008U /*!< Card is disconnected */ | |||
| #define HAL_MMC_CARD_ERROR 0x000000FFU /*!< Card response Error */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -126,35 +107,53 @@ typedef struct | |||
| /** | |||
| * @brief MMC handle Structure definition | |||
| */ | |||
| #if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U) | |||
| typedef struct __MMC_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_MMC_REGISTER_CALLBACKS */ | |||
| { | |||
| MMC_TypeDef *Instance; /*!< MMC registers base address */ | |||
| MMC_TypeDef *Instance; /*!< MMC registers base address */ | |||
| MMC_InitTypeDef Init; /*!< MMC required parameters */ | |||
| MMC_InitTypeDef Init; /*!< MMC required parameters */ | |||
| HAL_LockTypeDef Lock; /*!< MMC locking object */ | |||
| uint32_t *pTxBuffPtr; /*!< Pointer to MMC Tx transfer Buffer */ | |||
| uint8_t *pTxBuffPtr; /*!< Pointer to MMC Tx transfer Buffer */ | |||
| uint32_t TxXferSize; /*!< MMC Tx Transfer size */ | |||
| uint32_t *pRxBuffPtr; /*!< Pointer to MMC Rx transfer Buffer */ | |||
| uint8_t *pRxBuffPtr; /*!< Pointer to MMC Rx transfer Buffer */ | |||
| uint32_t RxXferSize; /*!< MMC Rx Transfer size */ | |||
| __IO uint32_t Context; /*!< MMC transfer context */ | |||
| __IO HAL_MMC_StateTypeDef State; /*!< MMC card State */ | |||
| __IO HAL_MMC_StateTypeDef State; /*!< MMC card State */ | |||
| __IO uint32_t ErrorCode; /*!< MMC Card Error codes */ | |||
| HAL_MMC_CardInfoTypeDef MmcCard; /*!< MMC Card information */ | |||
| HAL_MMC_CardInfoTypeDef MmcCard; /*!< MMC Card information */ | |||
| uint32_t CSD[4]; /*!< MMC card specific data table */ | |||
| uint32_t CID[4]; /*!< MMC card identification number table */ | |||
| uint32_t Ext_CSD[128]; | |||
| #if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U) | |||
| void (* TxCpltCallback) (struct __MMC_HandleTypeDef *hmmc); | |||
| void (* RxCpltCallback) (struct __MMC_HandleTypeDef *hmmc); | |||
| void (* ErrorCallback) (struct __MMC_HandleTypeDef *hmmc); | |||
| void (* AbortCpltCallback) (struct __MMC_HandleTypeDef *hmmc); | |||
| void (* Read_DMADblBuf0CpltCallback) (struct __MMC_HandleTypeDef *hmmc); | |||
| void (* Read_DMADblBuf1CpltCallback) (struct __MMC_HandleTypeDef *hmmc); | |||
| void (* Write_DMADblBuf0CpltCallback) (struct __MMC_HandleTypeDef *hmmc); | |||
| void (* Write_DMADblBuf1CpltCallback) (struct __MMC_HandleTypeDef *hmmc); | |||
| void (* MspInitCallback) (struct __MMC_HandleTypeDef *hmmc); | |||
| void (* MspDeInitCallback) (struct __MMC_HandleTypeDef *hmmc); | |||
| #endif | |||
| }MMC_HandleTypeDef; | |||
| @@ -196,7 +195,7 @@ typedef struct | |||
| __IO uint8_t WriteBlockPaPartial; /*!< Partial blocks for write allowed */ | |||
| __IO uint8_t Reserved3; /*!< Reserved */ | |||
| __IO uint8_t ContentProtectAppli; /*!< Content protection application */ | |||
| __IO uint8_t FileFormatGrouop; /*!< File format group */ | |||
| __IO uint8_t FileFormatGroup; /*!< File format group */ | |||
| __IO uint8_t CopyFlag; /*!< Copy flag (OTP) */ | |||
| __IO uint8_t PermWrProtect; /*!< Permanent write protection */ | |||
| __IO uint8_t TempWrProtect; /*!< Temporary write protection */ | |||
| @@ -226,11 +225,41 @@ typedef struct | |||
| __IO uint8_t CID_CRC; /*!< CID CRC */ | |||
| __IO uint8_t Reserved2; /*!< Always 1 */ | |||
| }HAL_MMC_CardCIDTypedef; | |||
| }HAL_MMC_CardCIDTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| #if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U) | |||
| /** @defgroup MMC_Exported_Types_Group6 MMC Callback ID enumeration definition | |||
| * @{ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_MMC_TX_CPLT_CB_ID = 0x00U, /*!< MMC Tx Complete Callback ID */ | |||
| HAL_MMC_RX_CPLT_CB_ID = 0x01U, /*!< MMC Rx Complete Callback ID */ | |||
| HAL_MMC_ERROR_CB_ID = 0x02U, /*!< MMC Error Callback ID */ | |||
| HAL_MMC_ABORT_CB_ID = 0x03U, /*!< MMC Abort Callback ID */ | |||
| HAL_MMC_READ_DMA_DBL_BUF0_CPLT_CB_ID = 0x04U, /*!< MMC Rx DMA Double Buffer 0 Complete Callback ID */ | |||
| HAL_MMC_READ_DMA_DBL_BUF1_CPLT_CB_ID = 0x05U, /*!< MMC Rx DMA Double Buffer 1 Complete Callback ID */ | |||
| HAL_MMC_WRITE_DMA_DBL_BUF0_CPLT_CB_ID = 0x06U, /*!< MMC Tx DMA Double Buffer 0 Complete Callback ID */ | |||
| HAL_MMC_WRITE_DMA_DBL_BUF1_CPLT_CB_ID = 0x07U, /*!< MMC Tx DMA Double Buffer 1 Complete Callback ID */ | |||
| HAL_MMC_MSP_INIT_CB_ID = 0x10U, /*!< MMC MspInit Callback ID */ | |||
| HAL_MMC_MSP_DEINIT_CB_ID = 0x11U /*!< MMC MspDeInit Callback ID */ | |||
| }HAL_MMC_CallbackIDTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup MMC_Exported_Types_Group7 MMC Callback pointer definition | |||
| * @{ | |||
| */ | |||
| typedef void (*pMMC_CallbackTypeDef) (MMC_HandleTypeDef *hmmc); | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -240,7 +269,7 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| #define BLOCKSIZE ((uint32_t)512U) /*!< Block size is 512 bytes */ | |||
| #define MMC_BLOCKSIZE ((uint32_t)512U) /*!< Block size is 512 bytes */ | |||
| /** @defgroup MMC_Exported_Constansts_Group1 MMC Error status enumeration Structure definition | |||
| * @{ | |||
| @@ -282,6 +311,9 @@ typedef struct | |||
| #define HAL_MMC_ERROR_DMA SDMMC_ERROR_DMA /*!< Error while DMA transfer */ | |||
| #define HAL_MMC_ERROR_TIMEOUT SDMMC_ERROR_TIMEOUT /*!< Timeout error */ | |||
| #if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U) | |||
| #define HAL_MMC_ERROR_INVALID_CALLBACK SDMMC_ERROR_INVALID_PARAMETER /*!< Invalid callback error */ | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -335,6 +367,19 @@ typedef struct | |||
| * @brief macros to handle interrupts and specific clock configurations | |||
| * @{ | |||
| */ | |||
| /** @brief Reset MMC handle state. | |||
| * @param __HANDLE__ : MMC handle. | |||
| * @retval None | |||
| */ | |||
| #if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U) | |||
| #define __HAL_MMC_RESET_HANDLE_STATE(__HANDLE__) do { \ | |||
| (__HANDLE__)->State = HAL_MMC_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_MMC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_MMC_STATE_RESET) | |||
| #endif | |||
| /** | |||
| * @brief Enable the MMC device interrupt. | |||
| @@ -538,7 +583,7 @@ typedef struct | |||
| * @} | |||
| */ | |||
| /* Include MMC HAL Extension module */ | |||
| /* Include MMC HAL Extension module */ | |||
| #include "stm32h7xx_hal_mmc_ex.h" | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| @@ -580,6 +625,12 @@ void HAL_MMC_TxCpltCallback(MMC_HandleTypeDef *hmmc); | |||
| void HAL_MMC_RxCpltCallback(MMC_HandleTypeDef *hmmc); | |||
| void HAL_MMC_ErrorCallback(MMC_HandleTypeDef *hmmc); | |||
| void HAL_MMC_AbortCallback(MMC_HandleTypeDef *hmmc); | |||
| #if defined (USE_HAL_MMC_REGISTER_CALLBACKS) && (USE_HAL_MMC_REGISTER_CALLBACKS == 1U) | |||
| /* MMC callback registering/unregistering */ | |||
| HAL_StatusTypeDef HAL_MMC_RegisterCallback (MMC_HandleTypeDef *hmmc, HAL_MMC_CallbackIDTypeDef CallbackId, pMMC_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_MMC_UnRegisterCallback(MMC_HandleTypeDef *hmmc, HAL_MMC_CallbackIDTypeDef CallbackId); | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -595,8 +646,8 @@ HAL_StatusTypeDef HAL_MMC_ConfigWideBusOperation(MMC_HandleTypeDef *hmmc, uint32 | |||
| /** @defgroup MMC_Exported_Functions_Group4 MMC card related functions | |||
| * @{ | |||
| */ | |||
| HAL_MMC_CardStateTypedef HAL_MMC_GetCardState(MMC_HandleTypeDef *hmmc); | |||
| HAL_StatusTypeDef HAL_MMC_GetCardCID(MMC_HandleTypeDef *hmmc, HAL_MMC_CardCIDTypedef *pCID); | |||
| HAL_MMC_CardStateTypeDef HAL_MMC_GetCardState(MMC_HandleTypeDef *hmmc); | |||
| HAL_StatusTypeDef HAL_MMC_GetCardCID(MMC_HandleTypeDef *hmmc, HAL_MMC_CardCIDTypeDef *pCID); | |||
| HAL_StatusTypeDef HAL_MMC_GetCardCSD(MMC_HandleTypeDef *hmmc, HAL_MMC_CardCSDTypeDef *pCSD); | |||
| HAL_StatusTypeDef HAL_MMC_GetCardInfo(MMC_HandleTypeDef *hmmc, HAL_MMC_CardInfoTypeDef *pCardInfo); | |||
| /** | |||
| @@ -702,6 +753,6 @@ HAL_StatusTypeDef HAL_MMC_Abort_IT(MMC_HandleTypeDef *hmmc); | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_MMC_H */ | |||
| #endif /* STM32H7xx_HAL_MMC_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_mmc_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of MMC HAL extended module. | |||
| * @brief Header file of SD HAL extended module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_MMC_EX_H | |||
| #define __STM32H7xx_HAL_MMC_EX_H | |||
| #ifndef STM32H7xx_HAL_MMC_EX_H | |||
| #define STM32H7xx_HAL_MMC_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -51,7 +33,7 @@ | |||
| */ | |||
| /** @addtogroup MMCEx | |||
| * @brief MMC HAL extended module driver | |||
| * @brief SD HAL extended module driver | |||
| * @{ | |||
| */ | |||
| @@ -126,6 +108,6 @@ void HAL_MMCEx_Write_DMADoubleBuffer1CpltCallback(MMC_HandleTypeDef *hmmc); | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_MMCEx_H */ | |||
| #endif /* STM32H7xx_HAL_MMCEx_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,47 +2,29 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_nand.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of NAND HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_NAND_H | |||
| #define __STM32H7xx_HAL_NAND_H | |||
| #ifndef STM32H7xx_HAL_NAND_H | |||
| #define STM32H7xx_HAL_NAND_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_ll_fmc.h" | |||
| @@ -69,7 +51,7 @@ typedef enum | |||
| 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; | |||
| } HAL_NAND_StateTypeDef; | |||
| /** | |||
| * @brief NAND Memory electronic signature Structure definition | |||
| @@ -85,7 +67,7 @@ typedef struct | |||
| uint8_t Third_Id; | |||
| uint8_t Fourth_Id; | |||
| }NAND_IDTypeDef; | |||
| } NAND_IDTypeDef; | |||
| /** | |||
| * @brief NAND Memory address Structure definition | |||
| @@ -98,7 +80,7 @@ typedef struct | |||
| uint16_t Block; /*!< NAND memory Block address */ | |||
| }NAND_AddressTypeDef; | |||
| } NAND_AddressTypeDef; | |||
| /** | |||
| * @brief NAND Memory info Structure definition | |||
| @@ -125,12 +107,16 @@ typedef struct | |||
| Example: Toshiba THTH58BYG3S0HBAI6. | |||
| This parameter could be ENABLE or DISABLE | |||
| Please check the Read Mode sequnece in the NAND device datasheet */ | |||
| }NAND_DeviceConfigTypeDef; | |||
| } NAND_DeviceConfigTypeDef; | |||
| /** | |||
| * @brief NAND handle Structure definition | |||
| */ | |||
| #if (USE_HAL_NAND_REGISTER_CALLBACKS == 1) | |||
| typedef struct __NAND_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_NAND_REGISTER_CALLBACKS */ | |||
| { | |||
| FMC_NAND_TypeDef *Instance; /*!< Register base address */ | |||
| @@ -142,7 +128,30 @@ typedef struct | |||
| NAND_DeviceConfigTypeDef Config; /*!< NAND phusical characteristic information structure */ | |||
| }NAND_HandleTypeDef; | |||
| #if (USE_HAL_NAND_REGISTER_CALLBACKS == 1) | |||
| void (* MspInitCallback) ( struct __NAND_HandleTypeDef * hnand); /*!< NAND Msp Init callback */ | |||
| void (* MspDeInitCallback) ( struct __NAND_HandleTypeDef * hnand); /*!< NAND Msp DeInit callback */ | |||
| void (* ItCallback) ( struct __NAND_HandleTypeDef * hnand); /*!< NAND IT callback */ | |||
| #endif | |||
| } NAND_HandleTypeDef; | |||
| #if (USE_HAL_NAND_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL NAND Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_NAND_MSP_INIT_CB_ID = 0x00U, /*!< NAND MspInit Callback ID */ | |||
| HAL_NAND_MSP_DEINIT_CB_ID = 0x01U, /*!< NAND MspDeInit Callback ID */ | |||
| HAL_NAND_IT_CB_ID = 0x02U /*!< NAND IT Callback ID */ | |||
| }HAL_NAND_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL NAND Callback pointer definition | |||
| */ | |||
| typedef void (*pNAND_CallbackTypeDef)(NAND_HandleTypeDef *hnand); | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -154,10 +163,18 @@ typedef struct | |||
| */ | |||
| /** @brief Reset NAND handle state | |||
| * @param __HANDLE__: specifies the NAND handle. | |||
| * @param __HANDLE__ specifies the NAND handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_NAND_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_NAND_RESET_HANDLE_STATE(__HANDLE__) do { \ | |||
| (__HANDLE__)->State = HAL_NAND_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_NAND_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_NAND_STATE_RESET) | |||
| #endif | |||
| /** | |||
| * @} | |||
| @@ -176,6 +193,10 @@ typedef struct | |||
| 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); | |||
| HAL_StatusTypeDef HAL_NAND_ConfigDevice(NAND_HandleTypeDef *hnand, NAND_DeviceConfigTypeDef *pDeviceConfig); | |||
| HAL_StatusTypeDef HAL_NAND_Read_ID(NAND_HandleTypeDef *hnand, NAND_IDTypeDef *pNAND_ID); | |||
| void HAL_NAND_MspInit(NAND_HandleTypeDef *hnand); | |||
| void HAL_NAND_MspDeInit(NAND_HandleTypeDef *hnand); | |||
| void HAL_NAND_IRQHandler(NAND_HandleTypeDef *hnand); | |||
| @@ -191,9 +212,6 @@ void HAL_NAND_ITCallback(NAND_HandleTypeDef *hnand); | |||
| /* IO operation functions ****************************************************/ | |||
| HAL_StatusTypeDef HAL_NAND_Read_ID(NAND_HandleTypeDef *hnand, NAND_IDTypeDef *pNAND_ID); | |||
| HAL_StatusTypeDef HAL_NAND_ConfigDevice(NAND_HandleTypeDef *hnand, NAND_DeviceConfigTypeDef *pDeviceConfig); | |||
| HAL_StatusTypeDef HAL_NAND_Reset(NAND_HandleTypeDef *hnand); | |||
| HAL_StatusTypeDef HAL_NAND_Read_Page_8b(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumPageToRead); | |||
| @@ -210,6 +228,12 @@ HAL_StatusTypeDef HAL_NAND_Erase_Block(NAND_HandleTypeDef *hnand, NAND_AddressT | |||
| uint32_t HAL_NAND_Address_Inc(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress); | |||
| #if (USE_HAL_NAND_REGISTER_CALLBACKS == 1) | |||
| /* NAND callback registering/unregistering */ | |||
| HAL_StatusTypeDef HAL_NAND_RegisterCallback(NAND_HandleTypeDef *hnand, HAL_NAND_CallbackIDTypeDef CallbackId, pNAND_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_NAND_UnRegisterCallback(NAND_HandleTypeDef *hnand, HAL_NAND_CallbackIDTypeDef CallbackId); | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -249,8 +273,8 @@ uint32_t HAL_NAND_Read_Status(NAND_HandleTypeDef *hnand); | |||
| #define NAND_DEVICE ((uint32_t)0x80000000U) | |||
| #define NAND_WRITE_TIMEOUT ((uint32_t)0x01000000U) | |||
| #define CMD_AREA ((uint32_t)(1<<16)) /* A16 = CLE high */ | |||
| #define ADDR_AREA ((uint32_t)(1<<17)) /* A17 = ALE high */ | |||
| #define CMD_AREA ((uint32_t)(1UL<<16U)) /* A16 = CLE high */ | |||
| #define ADDR_AREA ((uint32_t)(1UL<<17U)) /* A17 = ALE high */ | |||
| #define NAND_CMD_AREA_A ((uint8_t)0x00U) | |||
| #define NAND_CMD_AREA_B ((uint8_t)0x01U) | |||
| @@ -284,8 +308,8 @@ uint32_t HAL_NAND_Read_Status(NAND_HandleTypeDef *hnand); | |||
| /** | |||
| * @brief NAND memory address computation. | |||
| * @param __ADDRESS__: NAND memory address. | |||
| * @param __HANDLE__ : NAND handle. | |||
| * @param __ADDRESS__ NAND memory address. | |||
| * @param __HANDLE__ NAND handle. | |||
| * @retval NAND Raw address value | |||
| */ | |||
| #define ARRAY_ADDRESS(__ADDRESS__ , __HANDLE__) ((__ADDRESS__)->Page + \ | |||
| @@ -295,7 +319,7 @@ uint32_t HAL_NAND_Read_Status(NAND_HandleTypeDef *hnand); | |||
| /** | |||
| * @brief NAND memory address cycling. | |||
| * @param __ADDRESS__: NAND memory address. | |||
| * @param __ADDRESS__ NAND memory address. | |||
| * @retval NAND address cycling value. | |||
| */ | |||
| #define ADDR_1ST_CYCLE(__ADDRESS__) (uint8_t)(__ADDRESS__) /* 1st addressing cycle */ | |||
| @@ -305,7 +329,7 @@ uint32_t HAL_NAND_Read_Status(NAND_HandleTypeDef *hnand); | |||
| /** | |||
| * @brief NAND memory Columns cycling. | |||
| * @param __ADDRESS__: NAND memory address. | |||
| * @param __ADDRESS__ NAND memory address. | |||
| * @retval NAND Column address cycling value. | |||
| */ | |||
| #define COLUMN_1ST_CYCLE(__ADDRESS__) (uint8_t)(__ADDRESS__) /* 1st Column addressing cycle */ | |||
| @@ -318,6 +342,7 @@ uint32_t HAL_NAND_Read_Status(NAND_HandleTypeDef *hnand); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -326,10 +351,11 @@ uint32_t HAL_NAND_Read_Status(NAND_HandleTypeDef *hnand); | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_NAND_H */ | |||
| #endif /* STM32H7xx_HAL_NAND_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,47 +2,29 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_nor.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of NOR HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_NOR_H | |||
| #define __STM32H7xx_HAL_NOR_H | |||
| #ifndef STM32H7xx_HAL_NOR_H | |||
| #define STM32H7xx_HAL_NOR_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_ll_fmc.h" | |||
| @@ -70,7 +52,7 @@ typedef enum | |||
| 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; | |||
| } HAL_NOR_StateTypeDef; | |||
| /** | |||
| * @brief FMC NOR Status typedef | |||
| @@ -81,14 +63,14 @@ typedef enum | |||
| HAL_NOR_STATUS_ONGOING, | |||
| HAL_NOR_STATUS_ERROR, | |||
| HAL_NOR_STATUS_TIMEOUT | |||
| }HAL_NOR_StatusTypeDef; | |||
| } 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 Manufacturer_Code; /*!< Defines the device's manufacturer code used to identify the memory */ | |||
| uint16_t Device_Code1; | |||
| @@ -97,8 +79,8 @@ typedef struct | |||
| 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; | |||
| an Auto Select command */ | |||
| } NOR_IDTypeDef; | |||
| /** | |||
| * @brief FMC NOR CFI typedef | |||
| @@ -116,12 +98,17 @@ typedef struct | |||
| uint16_t CFI_3; | |||
| uint16_t CFI_4; | |||
| }NOR_CFITypeDef; | |||
| } NOR_CFITypeDef; | |||
| /** | |||
| * @brief NOR handle Structure definition | |||
| */ | |||
| #if (USE_HAL_NOR_REGISTER_CALLBACKS == 1) | |||
| typedef struct __NOR_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_NOR_REGISTER_CALLBACKS */ | |||
| { | |||
| FMC_NORSRAM_TypeDef *Instance; /*!< Register base address */ | |||
| @@ -133,7 +120,27 @@ typedef struct | |||
| __IO HAL_NOR_StateTypeDef State; /*!< NOR device access state */ | |||
| }NOR_HandleTypeDef; | |||
| #if (USE_HAL_NOR_REGISTER_CALLBACKS == 1) | |||
| void (* MspInitCallback) ( struct __NOR_HandleTypeDef * hnor); /*!< NOR Msp Init callback */ | |||
| void (* MspDeInitCallback) ( struct __NOR_HandleTypeDef * hnor); /*!< NOR Msp DeInit callback */ | |||
| #endif | |||
| } NOR_HandleTypeDef; | |||
| #if (USE_HAL_NOR_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL NOR Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_NOR_MSP_INIT_CB_ID = 0x00U, /*!< NOR MspInit Callback ID */ | |||
| HAL_NOR_MSP_DEINIT_CB_ID = 0x01U /*!< NOR MspDeInit Callback ID */ | |||
| }HAL_NOR_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL NOR Callback pointer definition | |||
| */ | |||
| typedef void (*pNOR_CallbackTypeDef)(NOR_HandleTypeDef *hnor); | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -144,10 +151,18 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| /** @brief Reset NOR handle state | |||
| * @param __HANDLE__: specifies the NOR handle. | |||
| * @param __HANDLE__ specifies the NOR handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_NOR_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_NOR_RESET_HANDLE_STATE(__HANDLE__) do { \ | |||
| (__HANDLE__)->State = HAL_NOR_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_NOR_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_NOR_STATE_RESET) | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -187,6 +202,12 @@ HAL_StatusTypeDef HAL_NOR_ProgramBuffer(NOR_HandleTypeDef *hnor, uint32_t uwAddr | |||
| 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); | |||
| #if (USE_HAL_NOR_REGISTER_CALLBACKS == 1) | |||
| /* NOR callback registering/unregistering */ | |||
| HAL_StatusTypeDef HAL_NOR_RegisterCallback(NOR_HandleTypeDef *hnor, HAL_NOR_CallbackIDTypeDef CallbackId, pNOR_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_NOR_UnRegisterCallback(NOR_HandleTypeDef *hnor, HAL_NOR_CallbackIDTypeDef CallbackId); | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -257,26 +278,26 @@ HAL_NOR_StatusTypeDef HAL_NOR_GetStatus(NOR_HandleTypeDef *hnor, uint32_t Addres | |||
| */ | |||
| /** | |||
| * @brief NOR memory address shifting. | |||
| * @param __NOR_ADDRESS: NOR base address | |||
| * @param __NOR_MEMORY_WIDTH_: NOR memory width | |||
| * @param __ADDRESS__: NOR memory address | |||
| * @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) + (2 * (__ADDRESS__)))): \ | |||
| #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 | |||
| * @param __ADDRESS__ NOR memory address | |||
| * @param __DATA__ Data to write | |||
| * @retval None | |||
| */ | |||
| #define NOR_WRITE(__ADDRESS__, __DATA__) do{ \ | |||
| (*(__IO uint16_t *)((uint32_t)(__ADDRESS__)) = (__DATA__)); \ | |||
| __DSB(); \ | |||
| } while(0) | |||
| (*(__IO uint16_t *)((uint32_t)(__ADDRESS__)) = (__DATA__)); \ | |||
| __DSB(); \ | |||
| } while(0) | |||
| /** | |||
| * @} | |||
| @@ -290,10 +311,11 @@ HAL_NOR_StatusTypeDef HAL_NOR_GetStatus(NOR_HandleTypeDef *hnor, uint32_t Addres | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_NOR_H */ | |||
| #endif /* STM32H7xx_HAL_NOR_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_opamp.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of OPAMP HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_OPAMP_H | |||
| #define __STM32H7xx_HAL_OPAMP_H | |||
| #ifndef STM32H7xx_HAL_OPAMP_H | |||
| #define STM32H7xx_HAL_OPAMP_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -127,13 +109,13 @@ typedef struct | |||
| typedef enum | |||
| { | |||
| HAL_OPAMP_STATE_RESET = 0x00000000, /*!< OPAMP is not yet Initialized */ | |||
| HAL_OPAMP_STATE_RESET = 0x00000000U, /*!< OPAMP is not yet Initialized */ | |||
| HAL_OPAMP_STATE_READY = 0x00000001, /*!< OPAMP is initialized and ready for use */ | |||
| HAL_OPAMP_STATE_CALIBBUSY = 0x00000002, /*!< OPAMP is enabled in auto calibration mode */ | |||
| HAL_OPAMP_STATE_READY = 0x00000001U, /*!< OPAMP is initialized and ready for use */ | |||
| HAL_OPAMP_STATE_CALIBBUSY = 0x00000002U, /*!< OPAMP is enabled in auto calibration mode */ | |||
| HAL_OPAMP_STATE_BUSY = 0x00000004, /*!< OPAMP is enabled and running in normal mode */ | |||
| HAL_OPAMP_STATE_BUSYLOCKED = 0x00000005 /*!< OPAMP is locked | |||
| HAL_OPAMP_STATE_BUSY = 0x00000004U, /*!< OPAMP is enabled and running in normal mode */ | |||
| HAL_OPAMP_STATE_BUSYLOCKED = 0x00000005U /*!< OPAMP is locked | |||
| only system reset allows reconfiguring the opamp. */ | |||
| }HAL_OPAMP_StateTypeDef; | |||
| @@ -141,7 +123,11 @@ typedef enum | |||
| /** | |||
| * @brief OPAMP Handle Structure definition | |||
| */ | |||
| #if (USE_HAL_OPAMP_REGISTER_CALLBACKS == 1) | |||
| typedef struct __OPAMP_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_OPAMP_REGISTER_CALLBACKS */ | |||
| { | |||
| OPAMP_TypeDef *Instance; /*!< OPAMP instance's registers base address */ | |||
| OPAMP_InitTypeDef Init; /*!< OPAMP required parameters */ | |||
| @@ -149,6 +135,10 @@ typedef struct | |||
| HAL_LockTypeDef Lock; /*!< Locking object */ | |||
| __IO HAL_OPAMP_StateTypeDef State; /*!< OPAMP communication state */ | |||
| #if (USE_HAL_OPAMP_REGISTER_CALLBACKS == 1) | |||
| void (* MspInitCallback) (struct __OPAMP_HandleTypeDef *hopamp); | |||
| void (* MspDeInitCallback) (struct __OPAMP_HandleTypeDef *hopamp); | |||
| #endif /* USE_HAL_OPAMP_REGISTER_CALLBACKS */ | |||
| } OPAMP_HandleTypeDef; | |||
| /** | |||
| @@ -161,8 +151,25 @@ typedef uint32_t HAL_OPAMP_TrimmingValueTypeDef; | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| #if (USE_HAL_OPAMP_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL OPAMP Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_OPAMP_MSP_INIT_CB_ID = 0x01U, /*!< OPAMP MspInit Callback ID */ | |||
| HAL_OPAMP_MSP_DEINIT_CB_ID = 0x02U, /*!< OPAMP MspDeInit Callback ID */ | |||
| HAL_OPAMP_ALL_CB_ID = 0x03U /*!< OPAMP All ID */ | |||
| }HAL_OPAMP_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL OPAMP Callback pointer definition | |||
| */ | |||
| typedef void (*pOPAMP_CallbackTypeDef)(OPAMP_HandleTypeDef *hopamp); | |||
| #endif /* USE_HAL_OPAMP_REGISTER_CALLBACKS */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup OPAMP_Exported_Constants OPAMP Exported Constants | |||
| * @{ | |||
| */ | |||
| @@ -170,9 +177,9 @@ typedef uint32_t HAL_OPAMP_TrimmingValueTypeDef; | |||
| /** @defgroup OPAMP_Mode OPAMP Mode | |||
| * @{ | |||
| */ | |||
| #define OPAMP_STANDALONE_MODE ((uint32_t)0x00000000) /*!< standalone mode */ | |||
| #define OPAMP_PGA_MODE OPAMP_CSR_VMSEL_1 /*!< PGA mode */ | |||
| #define OPAMP_FOLLOWER_MODE (OPAMP_CSR_VMSEL_1 | OPAMP_CSR_VMSEL_0) /*!< follower mode */ | |||
| #define OPAMP_STANDALONE_MODE 0x00000000U /*!< standalone mode */ | |||
| #define OPAMP_PGA_MODE OPAMP_CSR_VMSEL_1 /*!< PGA mode */ | |||
| #define OPAMP_FOLLOWER_MODE (OPAMP_CSR_VMSEL_1 | OPAMP_CSR_VMSEL_0) /*!< follower mode */ | |||
| /** | |||
| * @} | |||
| @@ -182,8 +189,8 @@ typedef uint32_t HAL_OPAMP_TrimmingValueTypeDef; | |||
| * @{ | |||
| */ | |||
| #define OPAMP_NONINVERTINGINPUT_IO0 ((uint32_t)0x00000000) /*!< OPAMP non-inverting input connected to dedicated IO pin */ | |||
| #define OPAMP_NONINVERTINGINPUT_DAC_CH OPAMP_CSR_VPSEL_0 /*!< OPAMP non-inverting input connected internally to DAC channel */ | |||
| #define OPAMP_NONINVERTINGINPUT_IO0 0x00000000U /*!< OPAMP non-inverting input connected to dedicated IO pin */ | |||
| #define OPAMP_NONINVERTINGINPUT_DAC_CH OPAMP_CSR_VPSEL_0 /*!< OPAMP non-inverting input connected internally to DAC channel */ | |||
| /** | |||
| * @} | |||
| @@ -193,8 +200,8 @@ typedef uint32_t HAL_OPAMP_TrimmingValueTypeDef; | |||
| * @{ | |||
| */ | |||
| #define OPAMP_INVERTINGINPUT_IO0 ((uint32_t)0x00000000) /*!< OPAMP inverting input connected to dedicated IO pin */ | |||
| #define OPAMP_INVERTINGINPUT_IO1 OPAMP_CSR_VMSEL_0 /*!< OPAMP inverting input connected to dedicated IO pin */ | |||
| #define OPAMP_INVERTINGINPUT_IO0 0x00000000U /*!< OPAMP inverting input connected to dedicated IO pin */ | |||
| #define OPAMP_INVERTINGINPUT_IO1 OPAMP_CSR_VMSEL_0 /*!< OPAMP inverting input connected to dedicated IO pin */ | |||
| /** | |||
| * @} | |||
| @@ -204,10 +211,10 @@ typedef uint32_t HAL_OPAMP_TrimmingValueTypeDef; | |||
| * @{ | |||
| */ | |||
| #define OPAMP_PGA_CONNECT_INVERTINGINPUT_NO ((uint32_t)0x00000000) /*!< In PGA mode, the inverting input is not connected */ | |||
| #define OPAMP_PGA_CONNECT_INVERTINGINPUT_IO0 OPAMP_CSR_PGGAIN_2 /*!< In PGA mode, the inverting input is connected to VINM0 */ | |||
| #define OPAMP_PGA_CONNECT_INVERTINGINPUT_IO0_BIAS OPAMP_CSR_PGGAIN_3 /*!< In PGA mode, the inverting input is connected to VINM0 or bias */ | |||
| #define OPAMP_PGA_CONNECT_INVERTINGINPUT_IO0_IO1_BIAS (OPAMP_CSR_PGGAIN_2 | OPAMP_CSR_PGGAIN_3) /*!< In PGA mode, the inverting input is connected to VINM0 or bias , VINM1 connected for filtering */ | |||
| #define OPAMP_PGA_CONNECT_INVERTINGINPUT_NO 0x00000000U /*!< In PGA mode, the inverting input is not connected */ | |||
| #define OPAMP_PGA_CONNECT_INVERTINGINPUT_IO0 OPAMP_CSR_PGGAIN_2 /*!< In PGA mode, the inverting input is connected to VINM0 */ | |||
| #define OPAMP_PGA_CONNECT_INVERTINGINPUT_IO0_BIAS OPAMP_CSR_PGGAIN_3 /*!< In PGA mode, the inverting input is connected to VINM0 or bias */ | |||
| #define OPAMP_PGA_CONNECT_INVERTINGINPUT_IO0_IO1_BIAS (OPAMP_CSR_PGGAIN_2 | OPAMP_CSR_PGGAIN_3) /*!< In PGA mode, the inverting input is connected to VINM0 or bias , VINM1 connected for filtering */ | |||
| /** | |||
| @@ -218,10 +225,10 @@ typedef uint32_t HAL_OPAMP_TrimmingValueTypeDef; | |||
| * @{ | |||
| */ | |||
| #define OPAMP_PGA_GAIN_2_OR_MINUS_1 ((uint32_t)0x00000000) /*!< PGA gain could be 2 or -1 */ | |||
| #define OPAMP_PGA_GAIN_2_OR_MINUS_1 0x00000000U /*!< PGA gain could be 2 or -1 */ | |||
| #define OPAMP_PGA_GAIN_4_OR_MINUS_3 OPAMP_CSR_PGGAIN_0 /*!< PGA gain could be 4 or -3 */ | |||
| #define OPAMP_PGA_GAIN_8_OR_MINUS_7 OPAMP_CSR_PGGAIN_1 /*!< PGA gain could be 8 or -7 */ | |||
| #define OPAMP_PGA_GAIN_16_OR_MINUS_15 (OPAMP_CSR_PGGAIN_0 | OPAMP_CSR_PGGAIN_1) /*!< PGA gain could be 16 or -15 */ | |||
| #define OPAMP_PGA_GAIN_16_OR_MINUS_15 (OPAMP_CSR_PGGAIN_0 | OPAMP_CSR_PGGAIN_1) /*!< PGA gain could be 16 or -15 */ | |||
| /** | |||
| * @} | |||
| @@ -230,7 +237,7 @@ typedef uint32_t HAL_OPAMP_TrimmingValueTypeDef; | |||
| /** @defgroup OPAMP_PowerMode OPAMP PowerMode | |||
| * @{ | |||
| */ | |||
| #define OPAMP_POWERMODE_NORMAL ((uint32_t)0x00000000) | |||
| #define OPAMP_POWERMODE_NORMAL 0x00000000U | |||
| #define OPAMP_POWERMODE_HIGHSPEED OPAMP_CSR_OPAHSM | |||
| /** | |||
| @@ -242,7 +249,7 @@ typedef uint32_t HAL_OPAMP_TrimmingValueTypeDef; | |||
| * @{ | |||
| */ | |||
| #define OPAMP_VREF_3VDDA ((uint32_t)0x00000000) /*!< OPAMP Vref = 3.3% VDDA */ | |||
| #define OPAMP_VREF_3VDDA 0x00000000U /*!< OPAMP Vref = 3.3% VDDA */ | |||
| #define OPAMP_VREF_10VDDA OPAMP_CSR_CALSEL_0 /*!< OPAMP Vref = 10% VDDA */ | |||
| #define OPAMP_VREF_50VDDA OPAMP_CSR_CALSEL_1 /*!< OPAMP Vref = 50% VDDA */ | |||
| #define OPAMP_VREF_90VDDA OPAMP_CSR_CALSEL /*!< OPAMP Vref = 90% VDDA */ | |||
| @@ -254,8 +261,8 @@ typedef uint32_t HAL_OPAMP_TrimmingValueTypeDef; | |||
| /** @defgroup OPAMP_UserTrimming OPAMP User Trimming | |||
| * @{ | |||
| */ | |||
| #define OPAMP_TRIMMING_FACTORY ((uint32_t)0x00000000) /*!< Factory trimming */ | |||
| #define OPAMP_TRIMMING_USER OPAMP_CSR_USERTRIM /*!< User trimming */ | |||
| #define OPAMP_TRIMMING_FACTORY 0x00000000U /*!< Factory trimming */ | |||
| #define OPAMP_TRIMMING_USER OPAMP_CSR_USERTRIM /*!< User trimming */ | |||
| /** | |||
| @@ -265,10 +272,10 @@ typedef uint32_t HAL_OPAMP_TrimmingValueTypeDef; | |||
| /** @defgroup OPAMP_FactoryTrimming OPAMP Factory Trimming | |||
| * @{ | |||
| */ | |||
| #define OPAMP_FACTORYTRIMMING_DUMMY ((uint32_t)0xFFFFFFFF) /*!< Dummy value if trimming value could not be retrieved */ | |||
| #define OPAMP_FACTORYTRIMMING_DUMMY 0xFFFFFFFFU /*!< Dummy value if trimming value could not be retrieved */ | |||
| #define OPAMP_FACTORYTRIMMING_N ((uint32_t)0x00000000) /*!< Offset trimming N */ | |||
| #define OPAMP_FACTORYTRIMMING_P ((uint32_t)0x00000001) /*!< Offset trimming P */ | |||
| #define OPAMP_FACTORYTRIMMING_N 0x00000000U /*!< Offset trimming N */ | |||
| #define OPAMP_FACTORYTRIMMING_P 0x00000001U /*!< Offset trimming P */ | |||
| /** | |||
| * @} | |||
| @@ -285,13 +292,13 @@ typedef uint32_t HAL_OPAMP_TrimmingValueTypeDef; | |||
| */ | |||
| /* NONINVERTING bit position in OTR & HSOTR */ | |||
| #define OPAMP_INPUT_NONINVERTING ((uint32_t) 8) /*!< Non inverting input */ | |||
| #define OPAMP_INPUT_NONINVERTING (8U) /*!< Non inverting input */ | |||
| /* Offset trimming time: during calibration, minimum time needed between two */ | |||
| /* steps to have 1 mV accuracy. */ | |||
| /* Refer to datasheet, electrical characteristics: parameter tOFFTRIM Typ=2ms.*/ | |||
| /* Unit: ms. */ | |||
| #define OPAMP_TRIMMING_DELAY ((uint32_t) 2) | |||
| #define OPAMP_TRIMMING_DELAY (2U) | |||
| /** | |||
| * @} | |||
| @@ -353,7 +360,7 @@ typedef uint32_t HAL_OPAMP_TrimmingValueTypeDef; | |||
| ((TRIMMING) == OPAMP_TRIMMING_USER)) | |||
| #define IS_OPAMP_TRIMMINGVALUE(TRIMMINGVALUE) ((TRIMMINGVALUE) <= 0x1F) | |||
| #define IS_OPAMP_TRIMMINGVALUE(TRIMMINGVALUE) ((TRIMMINGVALUE) <= 0x1FU) | |||
| #define IS_OPAMP_FACTORYTRIMMING(TRIMMING) (((TRIMMING) == OPAMP_FACTORYTRIMMING_N) || \ | |||
| ((TRIMMING) == OPAMP_FACTORYTRIMMING_P)) | |||
| @@ -400,6 +407,11 @@ HAL_StatusTypeDef HAL_OPAMP_SelfCalibrate(OPAMP_HandleTypeDef *hopamp); | |||
| */ | |||
| /* Peripheral Control functions ************************************************/ | |||
| #if (USE_HAL_OPAMP_REGISTER_CALLBACKS == 1) | |||
| /* OPAMP callback registering/unregistering */ | |||
| HAL_StatusTypeDef HAL_OPAMP_RegisterCallback (OPAMP_HandleTypeDef *hopamp, HAL_OPAMP_CallbackIDTypeDef CallbackId, pOPAMP_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_OPAMP_UnRegisterCallback (OPAMP_HandleTypeDef *hopamp, HAL_OPAMP_CallbackIDTypeDef CallbackId); | |||
| #endif /* USE_HAL_OPAMP_REGISTER_CALLBACKS */ | |||
| HAL_StatusTypeDef HAL_OPAMP_Lock(OPAMP_HandleTypeDef *hopamp); | |||
| HAL_OPAMP_TrimmingValueTypeDef HAL_OPAMP_GetTrimOffset (OPAMP_HandleTypeDef *hopamp, uint32_t trimmingoffset); | |||
| @@ -434,6 +446,6 @@ HAL_OPAMP_StateTypeDef HAL_OPAMP_GetState(OPAMP_HandleTypeDef *hopamp); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_OPAMP_H */ | |||
| #endif /* STM32H7xx_HAL_OPAMP_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_opamp_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of OPAMP HAL Extended module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_OPAMP_EX_H | |||
| #define __STM32H7xx_HAL_OPAMP_EX_H | |||
| #ifndef STM32H7xx_HAL_OPAMP_EX_H | |||
| #define STM32H7xx_HAL_OPAMP_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -96,6 +78,6 @@ HAL_StatusTypeDef HAL_OPAMPEx_Unlock(OPAMP_HandleTypeDef *hopamp); | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_OPAMP_EX_H */ | |||
| #endif /* STM32H7xx_HAL_OPAMP_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,50 +2,34 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_pcd.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of PCD HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_PCD_H | |||
| #define __STM32H7xx_HAL_PCD_H | |||
| #ifndef STM32H7xx_HAL_PCD_H | |||
| #define STM32H7xx_HAL_PCD_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_ll_usb.h" | |||
| #if defined (USB_OTG_FS) || defined (USB_OTG_HS) | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| @@ -64,53 +48,100 @@ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_PCD_STATE_RESET = 0x00U, | |||
| HAL_PCD_STATE_READY = 0x01U, | |||
| HAL_PCD_STATE_ERROR = 0x02U, | |||
| HAL_PCD_STATE_BUSY = 0x03U, | |||
| HAL_PCD_STATE_TIMEOUT = 0x04U | |||
| HAL_PCD_STATE_RESET = 0x00, | |||
| HAL_PCD_STATE_READY = 0x01, | |||
| HAL_PCD_STATE_ERROR = 0x02, | |||
| HAL_PCD_STATE_BUSY = 0x03, | |||
| HAL_PCD_STATE_TIMEOUT = 0x04 | |||
| } PCD_StateTypeDef; | |||
| /* Device LPM suspend state */ | |||
| typedef enum | |||
| { | |||
| LPM_L0 = 0x00U, /* on */ | |||
| LPM_L1 = 0x01U, /* LPM L1 sleep */ | |||
| LPM_L2 = 0x02U, /* suspend */ | |||
| LPM_L3 = 0x03U, /* off */ | |||
| }PCD_LPM_StateTypeDef; | |||
| LPM_L0 = 0x00, /* on */ | |||
| LPM_L1 = 0x01, /* LPM L1 sleep */ | |||
| LPM_L2 = 0x02, /* suspend */ | |||
| LPM_L3 = 0x03, /* off */ | |||
| } PCD_LPM_StateTypeDef; | |||
| typedef enum | |||
| { | |||
| PCD_LPM_L0_ACTIVE = 0x00, /* on */ | |||
| PCD_LPM_L1_ACTIVE = 0x01, /* LPM L1 sleep */ | |||
| } PCD_LPM_MsgTypeDef; | |||
| typedef enum | |||
| { | |||
| PCD_BCD_ERROR = 0xFF, | |||
| PCD_BCD_CONTACT_DETECTION = 0xFE, | |||
| PCD_BCD_STD_DOWNSTREAM_PORT = 0xFD, | |||
| PCD_BCD_CHARGING_DOWNSTREAM_PORT = 0xFC, | |||
| PCD_BCD_DEDICATED_CHARGING_PORT = 0xFB, | |||
| PCD_BCD_DISCOVERY_COMPLETED = 0x00, | |||
| } PCD_BCD_MsgTypeDef; | |||
| #if defined (USB_OTG_FS) || defined (USB_OTG_HS) | |||
| typedef USB_OTG_GlobalTypeDef PCD_TypeDef; | |||
| typedef USB_OTG_CfgTypeDef PCD_InitTypeDef; | |||
| typedef USB_OTG_EPTypeDef PCD_EPTypeDef ; | |||
| typedef USB_OTG_EPTypeDef PCD_EPTypeDef; | |||
| #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */ | |||
| /** | |||
| * @brief PCD Handle Structure definition | |||
| */ | |||
| #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) | |||
| typedef struct __PCD_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ | |||
| { | |||
| PCD_TypeDef *Instance; /*!< Register base address */ | |||
| PCD_InitTypeDef Init; /*!< PCD required 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 */ | |||
| PCD_LPM_StateTypeDef LPM_State; /*!< LPM State */ | |||
| PCD_InitTypeDef Init; /*!< PCD required parameters */ | |||
| __IO uint8_t USB_Address; /*!< USB Address */ | |||
| 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 */ | |||
| __IO uint32_t ErrorCode; /*!< PCD Error code */ | |||
| uint32_t Setup[12]; /*!< Setup packet buffer */ | |||
| PCD_LPM_StateTypeDef LPM_State; /*!< LPM State */ | |||
| uint32_t BESL; | |||
| uint32_t lpm_active; /*!< Enable or disable the Link Power Management . | |||
| This parameter can be set to ENABLE or DISABLE */ | |||
| uint32_t battery_charging_active; /*!< Enable or disable Battery charging. | |||
| This parameter can be set to ENABLE or DISABLE */ | |||
| void *pData; /*!< Pointer to upper stack Handler */ | |||
| uint32_t lpm_active; /*!< Enable or disable the Link Power Management . | |||
| This parameter can be set to ENABLE or DISABLE */ | |||
| uint32_t battery_charging_active; /*!< Enable or disable Battery charging. | |||
| This parameter can be set to ENABLE or DISABLE */ | |||
| void *pData; /*!< Pointer to upper stack Handler */ | |||
| #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) | |||
| void (* SOFCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD SOF callback */ | |||
| void (* SetupStageCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Setup Stage callback */ | |||
| void (* ResetCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Reset callback */ | |||
| void (* SuspendCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Suspend callback */ | |||
| void (* ResumeCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Resume callback */ | |||
| void (* ConnectCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Connect callback */ | |||
| void (* DisconnectCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Disconnect callback */ | |||
| void (* DataOutStageCallback)(struct __PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< USB OTG PCD Data OUT Stage callback */ | |||
| void (* DataInStageCallback)(struct __PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< USB OTG PCD Data IN Stage callback */ | |||
| void (* ISOOUTIncompleteCallback)(struct __PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< USB OTG PCD ISO OUT Incomplete callback */ | |||
| void (* ISOINIncompleteCallback)(struct __PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< USB OTG PCD ISO IN Incomplete callback */ | |||
| void (* BCDCallback)(struct __PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg); /*!< USB OTG PCD BCD callback */ | |||
| void (* LPMCallback)(struct __PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg); /*!< USB OTG PCD LPM callback */ | |||
| void (* MspInitCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Msp Init callback */ | |||
| void (* MspDeInitCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Msp DeInit callback */ | |||
| #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ | |||
| } PCD_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Include PCD HAL Extension module */ | |||
| /* Include PCD HAL Extended module */ | |||
| #include "stm32h7xx_hal_pcd_ex.h" | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| @@ -121,9 +152,9 @@ typedef struct | |||
| /** @defgroup PCD_Speed PCD Speed | |||
| * @{ | |||
| */ | |||
| #define PCD_SPEED_HIGH 0U | |||
| #define PCD_SPEED_HIGH_IN_FULL 1U | |||
| #define PCD_SPEED_FULL 2U | |||
| #define PCD_SPEED_HIGH USBD_HS_SPEED | |||
| #define PCD_SPEED_HIGH_IN_FULL USBD_HSINFS_SPEED | |||
| #define PCD_SPEED_FULL USBD_FS_SPEED | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -133,19 +164,18 @@ typedef struct | |||
| */ | |||
| #define PCD_PHY_ULPI 1U | |||
| #define PCD_PHY_EMBEDDED 2U | |||
| #define PCD_PHY_UTMI 3U | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup PCD_Turnaround_Timeout Turnaround Timeout Value | |||
| /** @defgroup PCD_Error_Code_definition PCD Error Code definition | |||
| * @brief PCD Error Code definition | |||
| * @{ | |||
| */ | |||
| #ifndef USBD_HS_TRDT_VALUE | |||
| #define USBD_HS_TRDT_VALUE 9U | |||
| #endif /* USBD_HS_TRDT_VALUE */ | |||
| #ifndef USBD_FS_TRDT_VALUE | |||
| #define USBD_FS_TRDT_VALUE 5U | |||
| #endif /* USBD_HS_TRDT_VALUE */ | |||
| #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) | |||
| #define HAL_PCD_ERROR_INVALID_CALLBACK (0x00000010U) /*!< Invalid Callback error */ | |||
| #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| @@ -160,74 +190,32 @@ typedef struct | |||
| * @brief macros to handle interrupts and specific clock configurations | |||
| * @{ | |||
| */ | |||
| #define __HAL_PCD_ENABLE(__HANDLE__) USB_EnableGlobalInt ((__HANDLE__)->Instance) | |||
| #define __HAL_PCD_DISABLE(__HANDLE__) USB_DisableGlobalInt ((__HANDLE__)->Instance) | |||
| #if defined (USB_OTG_FS) || defined (USB_OTG_HS) | |||
| #define __HAL_PCD_ENABLE(__HANDLE__) (void)USB_EnableGlobalInt ((__HANDLE__)->Instance) | |||
| #define __HAL_PCD_DISABLE(__HANDLE__) (void)USB_DisableGlobalInt ((__HANDLE__)->Instance) | |||
| #define __HAL_PCD_GET_FLAG(__HANDLE__, __INTERRUPT__) ((USB_ReadInterrupts((__HANDLE__)->Instance) & (__INTERRUPT__)) == (__INTERRUPT__)) | |||
| #define __HAL_PCD_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->GINTSTS) = (__INTERRUPT__)) | |||
| #define __HAL_PCD_IS_INVALID_INTERRUPT(__HANDLE__) (USB_ReadInterrupts((__HANDLE__)->Instance) == 0) | |||
| #define __HAL_PCD_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->GINTSTS) &= (__INTERRUPT__)) | |||
| #define __HAL_PCD_IS_INVALID_INTERRUPT(__HANDLE__) (USB_ReadInterrupts((__HANDLE__)->Instance) == 0U) | |||
| #define __HAL_PCD_UNGATE_PHYCLOCK(__HANDLE__) *(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE) &= \ | |||
| ~(USB_OTG_PCGCCTL_STOPCLK) | |||
| ~(USB_OTG_PCGCCTL_STOPCLK) | |||
| #define __HAL_PCD_GATE_PHYCLOCK(__HANDLE__) *(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE) |= USB_OTG_PCGCCTL_STOPCLK | |||
| #define __HAL_PCD_IS_PHY_SUSPENDED(__HANDLE__) ((*(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE))&0x10) | |||
| #define USB_OTG_FS_WAKEUP_EXTI_RISING_EDGE ((uint32_t)0x08U) | |||
| #define USB_OTG_FS_WAKEUP_EXTI_FALLING_EDGE ((uint32_t)0x0CU) | |||
| #define USB_OTG_FS_WAKEUP_EXTI_RISING_FALLING_EDGE ((uint32_t)0x10U) | |||
| #define USB_OTG_HS_WAKEUP_EXTI_RISING_EDGE ((uint32_t)0x08U) | |||
| #define USB_OTG_HS_WAKEUP_EXTI_FALLING_EDGE ((uint32_t)0x0CU) | |||
| #define USB_OTG_HS_WAKEUP_EXTI_RISING_FALLING_EDGE ((uint32_t)0x10U) | |||
| #define __HAL_PCD_IS_PHY_SUSPENDED(__HANDLE__) ((*(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE)) & 0x10U) | |||
| #define USB_OTG_HS_WAKEUP_EXTI_LINE ((uint32_t)EXTI_IMR2_IM43) /*!< External interrupt line 43 Connected to the USB HS EXTI Line */ | |||
| #define USB_OTG_FS_WAKEUP_EXTI_LINE ((uint32_t)EXTI_IMR2_IM44) /*!< External interrupt line 44 Connected to the USB FS EXTI Line */ | |||
| /* HS */ | |||
| #define __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_IT() EXTI_D1->IMR2 |= (USB_OTG_HS_WAKEUP_EXTI_LINE) | |||
| #define __HAL_USB_OTG_HS_WAKEUP_EXTI_DISABLE_IT() EXTI_D1->IMR2 &= ~(USB_OTG_HS_WAKEUP_EXTI_LINE) | |||
| #define __HAL_USB_OTG_HS_WAKEUP_EXTI_GET_FLAG() EXTI_D1->PR2 & (USB_OTG_HS_WAKEUP_EXTI_LINE) | |||
| #define __HAL_USB_OTG_HS_WAKEUP_EXTI_CLEAR_FLAG() EXTI_D1->PR2 = (USB_OTG_HS_WAKEUP_EXTI_LINE) | |||
| #define __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_RISING_EDGE() EXTI->FTSR2 &= ~(USB_OTG_HS_WAKEUP_EXTI_LINE);\ | |||
| EXTI->RTSR2 |= USB_OTG_HS_WAKEUP_EXTI_LINE | |||
| #define __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_FALLING_EDGE() EXTI->FTSR2 |= (USB_OTG_HS_WAKEUP_EXTI_LINE);\ | |||
| EXTI->RTSR2 &= ~(USB_OTG_HS_WAKEUP_EXTI_LINE) | |||
| #define __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_RISING_FALLING_EDGE() EXTI->RTSR2 &= ~(USB_OTG_HS_WAKEUP_EXTI_LINE);\ | |||
| EXTI->FTSR2 &= ~(USB_OTG_HS_WAKEUP_EXTI_LINE;)\ | |||
| EXTI->RTSR2 |= USB_OTG_HS_WAKEUP_EXTI_LINE;\ | |||
| EXTI->FTSR2 |= USB_OTG_HS_WAKEUP_EXTI_LINE | |||
| #define __HAL_USB_OTG_HS_WAKEUP_EXTI_GENERATE_SWIT() (EXTI->SWIER2 |= USB_OTG_HS_WAKEUP_EXTI_LINE) | |||
| /* FS */ | |||
| #define __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_IT() EXTI_D1->IMR2 |= USB_OTG_FS_WAKEUP_EXTI_LINE | |||
| #define __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_IT() EXTI_D1->IMR2 |= (USB_OTG_FS_WAKEUP_EXTI_LINE) | |||
| #define __HAL_USB_OTG_FS_WAKEUP_EXTI_DISABLE_IT() EXTI_D1->IMR2 &= ~(USB_OTG_FS_WAKEUP_EXTI_LINE) | |||
| #define __HAL_USB_OTG_FS_WAKEUP_EXTI_GET_FLAG() EXTI_D1->PR2 & (USB_OTG_FS_WAKEUP_EXTI_LINE) | |||
| #define __HAL_USB_OTG_FS_WAKEUP_EXTI_CLEAR_FLAG() EXTI_D1->PR2 = USB_OTG_FS_WAKEUP_EXTI_LINE | |||
| #define __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_RISING_EDGE() EXTI->FTSR2 &= ~(USB_OTG_FS_WAKEUP_EXTI_LINE);\ | |||
| EXTI->RTSR2 |= USB_OTG_FS_WAKEUP_EXTI_LINE | |||
| #define __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_FALLING_EDGE() EXTI->FTSR2 |= (USB_OTG_FS_WAKEUP_EXTI_LINE);\ | |||
| EXTI->RTSR2 &= ~(USB_OTG_FS_WAKEUP_EXTI_LINE) | |||
| #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */ | |||
| #define __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_RISING_FALLING_EDGE() EXTI->RTSR2 &= ~(USB_OTG_FS_WAKEUP_EXTI_LINE);\ | |||
| EXTI->FTSR2 &= ~(USB_OTG_FS_WAKEUP_EXTI_LINE);\ | |||
| EXTI->RTSR2 |= USB_OTG_FS_WAKEUP_EXTI_LINE;\ | |||
| EXTI->FTSR2 |= USB_OTG_FS_WAKEUP_EXTI_LINE | |||
| #define __HAL_USB_OTG_FS_WAKEUP_EXTI_GENERATE_SWIT() (EXTI->SWIER2 |= USB_OTG_FS_WAKEUP_EXTI_LINE) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup PCD_Exported_Functions PCD Exported Functions | |||
| @@ -239,9 +227,71 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_PCD_Init(PCD_HandleTypeDef *hpcd); | |||
| HAL_StatusTypeDef HAL_PCD_DeInit (PCD_HandleTypeDef *hpcd); | |||
| HAL_StatusTypeDef HAL_PCD_DeInit(PCD_HandleTypeDef *hpcd); | |||
| void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd); | |||
| void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd); | |||
| #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) | |||
| /** @defgroup HAL_PCD_Callback_ID_enumeration_definition HAL USB OTG PCD Callback ID enumeration definition | |||
| * @brief HAL USB OTG PCD Callback ID enumeration definition | |||
| * @{ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_PCD_SOF_CB_ID = 0x01, /*!< USB PCD SOF callback ID */ | |||
| HAL_PCD_SETUPSTAGE_CB_ID = 0x02, /*!< USB PCD Setup Stage callback ID */ | |||
| HAL_PCD_RESET_CB_ID = 0x03, /*!< USB PCD Reset callback ID */ | |||
| HAL_PCD_SUSPEND_CB_ID = 0x04, /*!< USB PCD Suspend callback ID */ | |||
| HAL_PCD_RESUME_CB_ID = 0x05, /*!< USB PCD Resume callback ID */ | |||
| HAL_PCD_CONNECT_CB_ID = 0x06, /*!< USB PCD Connect callback ID */ | |||
| HAL_PCD_DISCONNECT_CB_ID = 0x07, /*!< USB PCD Disconnect callback ID */ | |||
| HAL_PCD_MSPINIT_CB_ID = 0x08, /*!< USB PCD MspInit callback ID */ | |||
| HAL_PCD_MSPDEINIT_CB_ID = 0x09 /*!< USB PCD MspDeInit callback ID */ | |||
| } HAL_PCD_CallbackIDTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup HAL_PCD_Callback_pointer_definition HAL USB OTG PCD Callback pointer definition | |||
| * @brief HAL USB OTG PCD Callback pointer definition | |||
| * @{ | |||
| */ | |||
| typedef void (*pPCD_CallbackTypeDef)(PCD_HandleTypeDef *hpcd); /*!< pointer to a common USB OTG PCD callback function */ | |||
| typedef void (*pPCD_DataOutStageCallbackTypeDef)(PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< pointer to USB OTG PCD Data OUT Stage callback */ | |||
| typedef void (*pPCD_DataInStageCallbackTypeDef)(PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< pointer to USB OTG PCD Data IN Stage callback */ | |||
| typedef void (*pPCD_IsoOutIncpltCallbackTypeDef)(PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< pointer to USB OTG PCD ISO OUT Incomplete callback */ | |||
| typedef void (*pPCD_IsoInIncpltCallbackTypeDef)(PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< pointer to USB OTG PCD ISO IN Incomplete callback */ | |||
| typedef void (*pPCD_LpmCallbackTypeDef)(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg); /*!< pointer to USB OTG PCD LPM callback */ | |||
| typedef void (*pPCD_BcdCallbackTypeDef)(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg); /*!< pointer to USB OTG PCD BCD callback */ | |||
| /** | |||
| * @} | |||
| */ | |||
| HAL_StatusTypeDef HAL_PCD_RegisterCallback(PCD_HandleTypeDef *hpcd, HAL_PCD_CallbackIDTypeDef CallbackID, pPCD_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_PCD_UnRegisterCallback(PCD_HandleTypeDef *hpcd, HAL_PCD_CallbackIDTypeDef CallbackID); | |||
| HAL_StatusTypeDef HAL_PCD_RegisterDataOutStageCallback(PCD_HandleTypeDef *hpcd, pPCD_DataOutStageCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_PCD_UnRegisterDataOutStageCallback(PCD_HandleTypeDef *hpcd); | |||
| HAL_StatusTypeDef HAL_PCD_RegisterDataInStageCallback(PCD_HandleTypeDef *hpcd, pPCD_DataInStageCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_PCD_UnRegisterDataInStageCallback(PCD_HandleTypeDef *hpcd); | |||
| HAL_StatusTypeDef HAL_PCD_RegisterIsoOutIncpltCallback(PCD_HandleTypeDef *hpcd, pPCD_IsoOutIncpltCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_PCD_UnRegisterIsoOutIncpltCallback(PCD_HandleTypeDef *hpcd); | |||
| HAL_StatusTypeDef HAL_PCD_RegisterIsoInIncpltCallback(PCD_HandleTypeDef *hpcd, pPCD_IsoInIncpltCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_PCD_UnRegisterIsoInIncpltCallback(PCD_HandleTypeDef *hpcd); | |||
| HAL_StatusTypeDef HAL_PCD_RegisterBcdCallback(PCD_HandleTypeDef *hpcd, pPCD_BcdCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_PCD_UnRegisterBcdCallback(PCD_HandleTypeDef *hpcd); | |||
| HAL_StatusTypeDef HAL_PCD_RegisterLpmCallback(PCD_HandleTypeDef *hpcd, pPCD_LpmCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_PCD_UnRegisterLpmCallback(PCD_HandleTypeDef *hpcd); | |||
| #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -255,17 +305,18 @@ HAL_StatusTypeDef HAL_PCD_Start(PCD_HandleTypeDef *hpcd); | |||
| HAL_StatusTypeDef HAL_PCD_Stop(PCD_HandleTypeDef *hpcd); | |||
| void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd); | |||
| void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); | |||
| void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); | |||
| void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd); | |||
| void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd); | |||
| void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd); | |||
| void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd); | |||
| void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd); | |||
| void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd); | |||
| void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); | |||
| void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); | |||
| void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd); | |||
| void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd); | |||
| void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); | |||
| void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); | |||
| void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); | |||
| void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -281,7 +332,7 @@ HAL_StatusTypeDef HAL_PCD_EP_Open(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint | |||
| HAL_StatusTypeDef HAL_PCD_EP_Close(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); | |||
| HAL_StatusTypeDef HAL_PCD_EP_Receive(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len); | |||
| HAL_StatusTypeDef HAL_PCD_EP_Transmit(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len); | |||
| uint16_t HAL_PCD_EP_GetRxCount(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); | |||
| uint32_t HAL_PCD_EP_GetRxCount(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); | |||
| HAL_StatusTypeDef HAL_PCD_EP_SetStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); | |||
| HAL_StatusTypeDef HAL_PCD_EP_ClrStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); | |||
| HAL_StatusTypeDef HAL_PCD_EP_Flush(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); | |||
| @@ -304,23 +355,65 @@ PCD_StateTypeDef HAL_PCD_GetState(PCD_HandleTypeDef *hpcd); | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup PCD_Private_Macros PCD Private Macros | |||
| * @{ | |||
| */ | |||
| /** @defgroup PCD_Instance_definition PCD Instance definition | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup PCD_Private_Constants PCD Private Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup USB_EXTI_Line_Interrupt USB EXTI line interrupt | |||
| * @{ | |||
| */ | |||
| #define IS_PCD_ALL_INSTANCE(INSTANCE) (((INSTANCE) == USB1_OTG_HS) || \ | |||
| ((INSTANCE) == USB2_OTG_FS)) | |||
| #if defined (USB_OTG_FS) || defined (USB_OTG_HS) | |||
| #define USB_OTG_FS_WAKEUP_EXTI_RISING_EDGE 0x08U | |||
| #define USB_OTG_FS_WAKEUP_EXTI_FALLING_EDGE 0x0CU | |||
| #define USB_OTG_FS_WAKEUP_EXTI_RISING_FALLING_EDGE 0x10U | |||
| #define USB_OTG_HS_WAKEUP_EXTI_RISING_EDGE 0x08U | |||
| #define USB_OTG_HS_WAKEUP_EXTI_FALLING_EDGE 0x0CU | |||
| #define USB_OTG_HS_WAKEUP_EXTI_RISING_FALLING_EDGE 0x10U | |||
| #define USB_OTG_FS_WAKEUP_EXTI_LINE (0x1U << 12) /*!< USB FS EXTI Line WakeUp Interrupt */ | |||
| #define USB_OTG_HS_WAKEUP_EXTI_LINE (0x1U << 11) /*!< USB HS EXTI Line WakeUp Interrupt */ | |||
| #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #if defined (USB_OTG_FS) || defined (USB_OTG_HS) | |||
| #ifndef USB_OTG_DOEPINT_OTEPSPR | |||
| #define USB_OTG_DOEPINT_OTEPSPR (0x1UL << 5) /*!< Status Phase Received interrupt */ | |||
| #endif | |||
| #ifndef USB_OTG_DOEPMSK_OTEPSPRM | |||
| #define USB_OTG_DOEPMSK_OTEPSPRM (0x1UL << 5) /*!< Setup Packet Received interrupt mask */ | |||
| #endif | |||
| #ifndef USB_OTG_DOEPINT_NAK | |||
| #define USB_OTG_DOEPINT_NAK (0x1UL << 13) /*!< NAK interrupt */ | |||
| #endif | |||
| #ifndef USB_OTG_DOEPMSK_NAKM | |||
| #define USB_OTG_DOEPMSK_NAKM (0x1UL << 13) /*!< OUT Packet NAK interrupt mask */ | |||
| #endif | |||
| #ifndef USB_OTG_DOEPINT_STPKTRX | |||
| #define USB_OTG_DOEPINT_STPKTRX (0x1UL << 15) /*!< Setup Packet Received interrupt */ | |||
| #endif | |||
| #ifndef USB_OTG_DOEPMSK_NYETM | |||
| #define USB_OTG_DOEPMSK_NYETM (0x1UL << 14) /*!< Setup Packet Received interrupt mask */ | |||
| #endif | |||
| #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup PCD_Private_Macros PCD Private Macros | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -330,14 +423,14 @@ PCD_StateTypeDef HAL_PCD_GetState(PCD_HandleTypeDef *hpcd); | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| * @} | |||
| */ | |||
| #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_PCD_H */ | |||
| #endif /* STM32H7xx_HAL_PCD_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,50 +2,33 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_pcd_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of PCD HAL module. | |||
| * @brief Header file of PCD HAL Extension module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_PCD_EX_H | |||
| #define __STM32H7xx_HAL_PCD_EX_H | |||
| #ifndef STM32H7xx_HAL_PCD_EX_H | |||
| #define STM32H7xx_HAL_PCD_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_hal_def.h" | |||
| #if defined (USB_OTG_FS) || defined (USB_OTG_HS) | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| @@ -54,25 +37,6 @@ | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| typedef enum | |||
| { | |||
| PCD_LPM_L0_ACTIVE = 0x00U, /* on */ | |||
| PCD_LPM_L1_ACTIVE = 0x01U, /* LPM L1 sleep */ | |||
| }PCD_LPM_MsgTypeDef; | |||
| typedef enum | |||
| { | |||
| PCD_BCD_ERROR = 0xFF, | |||
| PCD_BCD_CONTACT_DETECTION = 0xFE, | |||
| PCD_BCD_STD_DOWNSTREAM_PORT = 0xFD, | |||
| PCD_BCD_CHARGING_DOWNSTREAM_PORT = 0xFC, | |||
| PCD_BCD_DEDICATED_CHARGING_PORT = 0xFB, | |||
| PCD_BCD_DISCOVERY_COMPLETED = 0x00, | |||
| }PCD_BCD_MsgTypeDef; | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /* Exported macros -----------------------------------------------------------*/ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| @@ -82,13 +46,21 @@ typedef enum | |||
| /** @addtogroup PCDEx_Exported_Functions_Group1 Peripheral Control functions | |||
| * @{ | |||
| */ | |||
| #if defined (USB_OTG_FS) || defined (USB_OTG_HS) | |||
| 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); | |||
| #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */ | |||
| HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd); | |||
| HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd); | |||
| 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_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg); | |||
| void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg); | |||
| @@ -107,12 +79,13 @@ void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg); | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_PCD_EX_H */ | |||
| #endif /* STM32H7xx_HAL_PCD_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_pwr.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of PWR HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_PWR_H | |||
| #define __STM32H7xx_HAL_PWR_H | |||
| #ifndef STM32H7xx_HAL_PWR_H | |||
| #define STM32H7xx_HAL_PWR_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -69,7 +51,7 @@ typedef struct | |||
| This parameter can be a value of @ref PWR_PVD_detection_level */ | |||
| uint32_t Mode; /*!< Mode: Specifies the operating mode for the selected pins. | |||
| This parameter can be a value of @ref PWR_PVD_Mode */ | |||
| This parameter can be a value of @ref PWR_PVD_Mode */ | |||
| }PWR_PVDTypeDef; | |||
| /** | |||
| @@ -84,14 +66,14 @@ typedef struct | |||
| /** @defgroup PWR_PVD_detection_level PWR PVD detection level | |||
| * @{ | |||
| */ | |||
| #define PWR_PVDLEVEL_0 PWR_CR1_PLS_LEV0 | |||
| #define PWR_PVDLEVEL_1 PWR_CR1_PLS_LEV1 | |||
| #define PWR_PVDLEVEL_2 PWR_CR1_PLS_LEV2 | |||
| #define PWR_PVDLEVEL_3 PWR_CR1_PLS_LEV3 | |||
| #define PWR_PVDLEVEL_4 PWR_CR1_PLS_LEV4 | |||
| #define PWR_PVDLEVEL_5 PWR_CR1_PLS_LEV5 | |||
| #define PWR_PVDLEVEL_6 PWR_CR1_PLS_LEV6 | |||
| #define PWR_PVDLEVEL_7 PWR_CR1_PLS_LEV7/* External input analog voltage (Compare internally to VREFINT) */ | |||
| #define PWR_PVDLEVEL_0 PWR_CR1_PLS_LEV0 /*!< Programmable voltage detector level 0 selection : 1V95 */ | |||
| #define PWR_PVDLEVEL_1 PWR_CR1_PLS_LEV1 /*!< Programmable voltage detector level 1 selection : 2V1 */ | |||
| #define PWR_PVDLEVEL_2 PWR_CR1_PLS_LEV2 /*!< Programmable voltage detector level 2 selection : 2V25 */ | |||
| #define PWR_PVDLEVEL_3 PWR_CR1_PLS_LEV3 /*!< Programmable voltage detector level 3 selection : 2V4 */ | |||
| #define PWR_PVDLEVEL_4 PWR_CR1_PLS_LEV4 /*!< Programmable voltage detector level 4 selection : 2V55 */ | |||
| #define PWR_PVDLEVEL_5 PWR_CR1_PLS_LEV5 /*!< Programmable voltage detector level 5 selection : 2V7 */ | |||
| #define PWR_PVDLEVEL_6 PWR_CR1_PLS_LEV6 /*!< Programmable voltage detector level 6 selection : 2V85 */ | |||
| #define PWR_PVDLEVEL_7 PWR_CR1_PLS_LEV7 /*!< External input analog voltage (Compare internally to VREFINT) */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -99,13 +81,13 @@ typedef struct | |||
| /** @defgroup PWR_PVD_Mode PWR PVD Mode | |||
| * @{ | |||
| */ | |||
| #define PWR_PVD_MODE_NORMAL ((uint32_t)0x00000000U) /*!< Basic mode is used */ | |||
| #define PWR_PVD_MODE_IT_RISING ((uint32_t)0x00010001U) /*!< External Interrupt Mode with Rising edge trigger detection */ | |||
| #define PWR_PVD_MODE_IT_FALLING ((uint32_t)0x00010002U) /*!< External Interrupt Mode with Falling edge trigger detection */ | |||
| #define PWR_PVD_MODE_NORMAL ((uint32_t)0x00000000U) /*!< Basic mode is used */ | |||
| #define PWR_PVD_MODE_IT_RISING ((uint32_t)0x00010001U) /*!< External Interrupt Mode with Rising edge trigger detection */ | |||
| #define PWR_PVD_MODE_IT_FALLING ((uint32_t)0x00010002U) /*!< External Interrupt Mode with Falling edge trigger detection */ | |||
| #define PWR_PVD_MODE_IT_RISING_FALLING ((uint32_t)0x00010003U) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */ | |||
| #define PWR_PVD_MODE_EVENT_RISING ((uint32_t)0x00020001U) /*!< Event Mode with Rising edge trigger detection */ | |||
| #define PWR_PVD_MODE_EVENT_FALLING ((uint32_t)0x00020002U) /*!< Event Mode with Falling edge trigger detection */ | |||
| #define PWR_PVD_MODE_EVENT_RISING_FALLING ((uint32_t)0x00020003U) /*!< Event Mode with Rising/Falling edge trigger detection */ | |||
| #define PWR_PVD_MODE_EVENT_RISING ((uint32_t)0x00020001U) /*!< Event Mode with Rising edge trigger detection */ | |||
| #define PWR_PVD_MODE_EVENT_FALLING ((uint32_t)0x00020002U) /*!< Event Mode with Falling edge trigger detection */ | |||
| #define PWR_PVD_MODE_EVENT_RISING_FALLING ((uint32_t)0x00020003U) /*!< Event Mode with Rising/Falling edge trigger detection */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -140,6 +122,7 @@ typedef struct | |||
| /** @defgroup PWR_Regulator_Voltage_Scale PWR Regulator Voltage Scale | |||
| * @{ | |||
| */ | |||
| #define PWR_REGULATOR_VOLTAGE_SCALE0 ((uint32_t)0x00000000) | |||
| #define PWR_REGULATOR_VOLTAGE_SCALE1 (PWR_D3CR_VOS_1 | PWR_D3CR_VOS_0) | |||
| #define PWR_REGULATOR_VOLTAGE_SCALE2 (PWR_D3CR_VOS_1) | |||
| #define PWR_REGULATOR_VOLTAGE_SCALE3 (PWR_D3CR_VOS_0) | |||
| @@ -154,16 +137,24 @@ typedef struct | |||
| #define PWR_FLAG_SB_D1 ((uint8_t)0x02U) | |||
| #define PWR_FLAG_SB_D2 ((uint8_t)0x03U) | |||
| #define PWR_FLAG_SB ((uint8_t)0x04U) | |||
| #define PWR_FLAG_PVDO ((uint8_t)0x07U) | |||
| #define PWR_FLAG_AVDO ((uint8_t)0x08U) | |||
| #define PWR_FLAG_ACTVOSRDY ((uint8_t)0x09U) | |||
| #define PWR_FLAG_ACTVOS ((uint8_t)0x0AU) | |||
| #define PWR_FLAG_BRR ((uint8_t)0x0BU) | |||
| #define PWR_FLAG_VOSRDY ((uint8_t)0x0CU) | |||
| #if defined(DUAL_CORE) | |||
| #define PWR_FLAG_CPU_HOLD ((uint8_t)0x05U) | |||
| #define PWR_FLAG_CPU2_HOLD ((uint8_t)0x06U) | |||
| #define PWR_FLAG2_STOP ((uint8_t)0x07U) | |||
| #define PWR_FLAG2_SB_D1 ((uint8_t)0x08U) | |||
| #define PWR_FLAG2_SB_D2 ((uint8_t)0x09U) | |||
| #define PWR_FLAG2_SB ((uint8_t)0x0AU) | |||
| #endif /*DUAL_CORE*/ | |||
| #define PWR_FLAG_PVDO ((uint8_t)0x0BU) | |||
| #define PWR_FLAG_AVDO ((uint8_t)0x0CU) | |||
| #define PWR_FLAG_ACTVOSRDY ((uint8_t)0x0DU) | |||
| #define PWR_FLAG_ACTVOS ((uint8_t)0x0EU) | |||
| #define PWR_FLAG_BRR ((uint8_t)0x0FU) | |||
| #define PWR_FLAG_VOSRDY ((uint8_t)0x10U) | |||
| #if defined(SMPS) | |||
| #define PWR_FLAG_SMPSEXTRDY ((uint8_t)0x0DU) | |||
| #define PWR_FLAG_SMPSEXTRDY ((uint8_t)0x11U) | |||
| #else | |||
| #define PWR_FLAG_SCUEN ((uint8_t)0x0DU) | |||
| #define PWR_FLAG_SCUEN ((uint8_t)0x11U) | |||
| #endif /* SMPS */ | |||
| /** | |||
| * @} | |||
| @@ -190,29 +181,101 @@ typedef struct | |||
| * a tradeoff between performance and power consumption when the device does | |||
| * not operate at the maximum frequency (refer to the datasheets for more details). | |||
| * This parameter can be one of the following values: | |||
| * @arg PWR_REGULATOR_VOLTAGE_SCALE0: Regulator voltage output Scale 0 mode | |||
| * @arg PWR_REGULATOR_VOLTAGE_SCALE1: Regulator voltage output Scale 1 mode | |||
| * @arg PWR_REGULATOR_VOLTAGE_SCALE2: Regulator voltage output Scale 2 mode | |||
| * @arg PWR_REGULATOR_VOLTAGE_SCALE3: Regulator voltage output Scale 3 mode | |||
| * @note PWR_REGULATOR_VOLTAGE_SCALE0 is only possible when Vcore is supplied from LDO. | |||
| * the SYSCFG Clock must be enabled before selecting PWR_REGULATOR_VOLTAGE_SCALE0 | |||
| * using macro __HAL_RCC_SYSCFG_CLK_ENABLE(). | |||
| * Transition to PWR_REGULATOR_VOLTAGE_SCALE0 is only possible when the system is already in | |||
| * PWR_REGULATOR_VOLTAGE_SCALE1. | |||
| * transition from PWR_REGULATOR_VOLTAGE_SCALE0 is only possible to PWR_REGULATOR_VOLTAGE_SCALE1 | |||
| * then once in PWR_REGULATOR_VOLTAGE_SCALE1 it is possible to switch to another voltage scale. | |||
| * After each regulator voltage setting, wait on PWR_FLAG_VOSRDY to be set using macro __HAL_PWR_GET_FLAG | |||
| * To enter low power mode , and if current regulator voltage is PWR_REGULATOR_VOLTAGE_SCALE0 then first | |||
| * switch to PWR_REGULATOR_VOLTAGE_SCALE1 before entering low power mode. | |||
| * | |||
| * @retval None | |||
| */ | |||
| #define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) \ | |||
| do { \ | |||
| __IO uint32_t tmpreg = 0x00; \ | |||
| __IO uint32_t tmpreg = 0x00; \ | |||
| if((__REGULATOR__) == PWR_REGULATOR_VOLTAGE_SCALE0) \ | |||
| { \ | |||
| MODIFY_REG(PWR->D3CR, PWR_D3CR_VOS, PWR_REGULATOR_VOLTAGE_SCALE1); \ | |||
| /* Delay after setting the voltage scaling */ \ | |||
| tmpreg = READ_BIT(PWR->D3CR, PWR_D3CR_VOS); \ | |||
| MODIFY_REG(SYSCFG->PWRCR, SYSCFG_PWRCR_ODEN, SYSCFG_PWRCR_ODEN); \ | |||
| /* Delay after setting the syscfg boost setting */ \ | |||
| tmpreg = READ_BIT(SYSCFG->PWRCR, SYSCFG_PWRCR_ODEN); \ | |||
| } \ | |||
| else \ | |||
| { \ | |||
| CLEAR_BIT(SYSCFG->PWRCR, SYSCFG_PWRCR_ODEN); \ | |||
| /* Delay after setting the syscfg boost setting */ \ | |||
| tmpreg = READ_BIT(SYSCFG->PWRCR, SYSCFG_PWRCR_ODEN); \ | |||
| MODIFY_REG(PWR->D3CR, PWR_D3CR_VOS, (__REGULATOR__)); \ | |||
| /* Delay after an RCC peripheral clock enabling */ \ | |||
| tmpreg = READ_BIT(PWR->D3CR, PWR_D3CR_VOS); \ | |||
| UNUSED(tmpreg); \ | |||
| } \ | |||
| UNUSED(tmpreg); \ | |||
| } while(0) | |||
| #if defined(DUAL_CORE) | |||
| /** @brief Check PWR PVD/AVD and VOSflags are set or not. | |||
| * @param __FLAG__: specifies the flag to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg PWR_FLAG_PVDO: PVD Output. This flag is valid only if PVD is enabled | |||
| * by the HAL_PWR_EnablePVD() function. The PVD is stopped by Standby mode. | |||
| * For this reason, this bit is equal to 0 after Standby or reset | |||
| * until the PVDE bit is set. | |||
| * @arg PWR_FLAG_AVDO: AVD Output. This flag is valid only if AVD is enabled | |||
| * by the HAL_PWREx_EnableAVD() function. The AVD is stopped by Standby mode. | |||
| * For this reason, this bit is equal to 0 after Standby or reset | |||
| * until the AVDE bit is set. | |||
| * @arg PWR_FLAG_ACTVOSRDY: This flag indicates that the Regulator voltage | |||
| * scaling output selection is ready. | |||
| * @arg PWR_FLAG_VOSRDY: This flag indicates that the Regulator voltage | |||
| * scaling output selection is ready. | |||
| * @arg PWR_FLAG_SMPSEXTRDY: SMPS External supply ready flag. | |||
| * @arg PWR_FLAG_BRR: Backup regulator ready flag. This bit is not reset | |||
| * when the device wakes up from Standby mode or by a system reset | |||
| * or power reset. | |||
| * @arg PWR_FLAG_SB: StandBy flag | |||
| * @arg PWR_FLAG_STOP: STOP flag | |||
| * @arg PWR_FLAG_SB_D1: StandBy D1 flag | |||
| * @arg PWR_FLAG_SB_D2: StandBy D2 flag | |||
| * @arg PWR_FLAG_CPU1_HOLD: CPU1 system wake up with hold | |||
| * @arg PWR_FLAG_CPU2_HOLD: CPU2 system wake up with hold | |||
| * @retval The new state of __FLAG__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_PWR_GET_FLAG(__FLAG__) ( \ | |||
| ((__FLAG__) == PWR_FLAG_PVDO)?((PWR->CSR1 & PWR_CSR1_PVDO) == PWR_CSR1_PVDO) : \ | |||
| ((__FLAG__) == PWR_FLAG_AVDO)?((PWR->CSR1 & PWR_CSR1_AVDO) == PWR_CSR1_AVDO) : \ | |||
| ((__FLAG__) == PWR_FLAG_ACTVOSRDY)?((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == PWR_CSR1_ACTVOSRDY) : \ | |||
| ((__FLAG__) == PWR_FLAG_VOSRDY)?((PWR->D3CR & PWR_D3CR_VOSRDY) == PWR_D3CR_VOSRDY) : \ | |||
| ((__FLAG__) == PWR_FLAG_SMPSEXTRDY)?((PWR->CR3 & PWR_CR3_SMPSEXTRDY) == PWR_CR3_SMPSEXTRDY) : \ | |||
| ((__FLAG__) == PWR_FLAG_BRR)?((PWR->CR2 & PWR_CR2_BRRDY) == PWR_CR2_BRRDY) : \ | |||
| ((__FLAG__) == PWR_FLAG_CPU_HOLD)?((PWR->CPU2CR & PWR_CPU2CR_HOLD1F) == PWR_CPU2CR_HOLD1F) : \ | |||
| ((__FLAG__) == PWR_FLAG_CPU2_HOLD)?((PWR->CPUCR & PWR_CPUCR_HOLD2F) == PWR_CPUCR_HOLD2F) : \ | |||
| ((__FLAG__) == PWR_FLAG_SB)?(READ_BIT(PWR->CPUCR, PWR_CPUCR_SBF) == PWR_CPUCR_SBF) : \ | |||
| ((__FLAG__) == PWR_FLAG2_SB)?(READ_BIT(PWR->CPU2CR, PWR_CPU2CR_SBF) == PWR_CPU2CR_SBF) : \ | |||
| ((__FLAG__) == PWR_FLAG_STOP)?(READ_BIT(PWR->CPUCR, PWR_CPUCR_STOPF) == PWR_CPUCR_STOPF) : \ | |||
| ((__FLAG__) == PWR_FLAG2_STOP)?(READ_BIT(PWR->CPU2CR, PWR_CPU2CR_STOPF) == PWR_CPU2CR_STOPF) : \ | |||
| ((__FLAG__) == PWR_FLAG_SB_D1)?(READ_BIT(PWR->CPUCR, PWR_CPUCR_SBF_D1) == PWR_CPUCR_SBF_D1) : \ | |||
| ((__FLAG__) == PWR_FLAG2_SB_D1)?(READ_BIT(PWR->CPU2CR, PWR_CPU2CR_SBF_D1) == PWR_CPU2CR_SBF_D1) : \ | |||
| ((__FLAG__) == PWR_FLAG_SB_D2)?(READ_BIT(PWR->CPUCR, PWR_CPUCR_SBF_D2) == PWR_CPUCR_SBF_D2) : \ | |||
| (READ_BIT(PWR->CPU2CR, PWR_CPU2CR_SBF_D2) == PWR_CPU2CR_SBF_D2)) | |||
| #else | |||
| /** @brief Check PWR PVD/AVD and VOSflags are set or not. | |||
| * @param __FLAG__: specifies the flag to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg PWR_FLAG_PVDO: PVD Output. This flag is valid only if PVD is enabled | |||
| * by the HAL_PWR_EnablePVD() function. The PVD is stopped by Standby mode | |||
| * by the HAL_PWR_EnablePVD() function. The PVD is stopped by Standby mode. | |||
| * For this reason, this bit is equal to 0 after Standby or reset | |||
| * until the PVDE bit is set. | |||
| * @arg PWR_FLAG_AVDO: AVD Output. This flag is valid only if AVD is enabled | |||
| * by the HAL_PWREx_EnableAVD() function. The AVD is stopped by Standby mode | |||
| * by the HAL_PWREx_EnableAVD() function. The AVD is stopped by Standby mode. | |||
| * For this reason, this bit is equal to 0 after Standby or reset | |||
| * until the AVDE bit is set. | |||
| * @arg PWR_FLAG_ACTVOSRDY: This flag indicates that the Regulator voltage | |||
| @@ -239,44 +302,88 @@ do { \ | |||
| ((__FLAG__) == PWR_FLAG_STOP)?((PWR->CPUCR & PWR_CPUCR_STOPF) == PWR_CPUCR_STOPF) : \ | |||
| ((__FLAG__) == PWR_FLAG_SB_D1)?((PWR->CPUCR & PWR_CPUCR_SBF_D1) == PWR_CPUCR_SBF_D1) : \ | |||
| ((PWR->CPUCR & PWR_CPUCR_SBF_D2) == PWR_CPUCR_SBF_D2)) | |||
| #endif /*DUAL_CORE*/ | |||
| /** @brief Clear the PWR's flags. | |||
| #if defined(DUAL_CORE) | |||
| /** @brief Clear PWR flags. | |||
| * @param __FLAG__: specifies the flag to clear. | |||
| * This parameter can be one of the following values: | |||
| * @arg PWR_FLAG_SB: Standby flag. | |||
| * @arg PWR_CPU_FLAGS: Clear HOLD2F, STOPF, SBF, SBF_D1, and SBF_D2 CPU flags. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_CLEAR_FLAG(__FLAG__) \ | |||
| do { \ | |||
| SET_BIT(PWR->CPUCR, PWR_CPUCR_CSSF); \ | |||
| SET_BIT(PWR->CPU2CR, PWR_CPU2CR_CSSF); \ | |||
| } while(0) | |||
| #else | |||
| /** @brief Clear PWR flags. | |||
| * @param __FLAG__: specifies the flag to clear. | |||
| * This parameter can be one of the following values: | |||
| * @arg PWR_FLAG_SB: StandBy flag. | |||
| * @arg PWR_FLAG_SB: Standby flag. | |||
| * @arg PWR_CPU_FLAGS: Clear STOPF, SBF, SBF_D1, and SBF_D2 CPU flags. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_CLEAR_FLAG(__FLAG__) SET_BIT(PWR->CPUCR, PWR_CPUCR_CSSF) | |||
| #endif /*DUAL_CORE*/ | |||
| /** | |||
| * @brief Enable the PVD EXTI Line 16. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_PVD_EXTI_ENABLE_IT() SET_BIT(EXTI_D1->IMR1, PWR_EXTI_LINE_PVD) | |||
| #define __HAL_PWR_PVD_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR1, PWR_EXTI_LINE_PVD) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Enable the PVD EXTI D2 Line 16. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_PVD_EXTID2_ENABLE_IT() SET_BIT(EXTI_D2->IMR1, PWR_EXTI_LINE_PVD) | |||
| #endif /*DUAL_CORE*/ | |||
| /** | |||
| * @brief Disable the PVD EXTI Line 16. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_PVD_EXTI_DISABLE_IT() CLEAR_BIT(EXTI_D1->IMR1, PWR_EXTI_LINE_PVD) | |||
| #define __HAL_PWR_PVD_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR1, PWR_EXTI_LINE_PVD) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Disable the PVD EXTI D2 Line 16. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_PVD_EXTID2_DISABLE_IT() CLEAR_BIT(EXTI_D2->IMR1, PWR_EXTI_LINE_PVD) | |||
| #endif /*DUAL_CORE*/ | |||
| /** | |||
| * @brief Enable event on PVD EXTI Line 16. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_PVD_EXTI_ENABLE_EVENT() SET_BIT(EXTI_D1->EMR1, PWR_EXTI_LINE_PVD) | |||
| #define __HAL_PWR_PVD_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR1, PWR_EXTI_LINE_PVD) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Enable event on PVD EXTI D2 Line. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_PVD_EXTID2_ENABLE_EVENT() SET_BIT(EXTI_D2->EMR1, PWR_EXTI_LINE_PVD) | |||
| #endif /*DUAL_CORE*/ | |||
| /** | |||
| * @brief Disable event on PVD EXTI Line 16. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_PVD_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI_D1->EMR1, PWR_EXTI_LINE_PVD) | |||
| #define __HAL_PWR_PVD_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR1, PWR_EXTI_LINE_PVD) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Disable event on PVD EXTI D2 Line. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_PVD_EXTID2_DISABLE_EVENT() CLEAR_BIT(EXTI_D2->EMR1, PWR_EXTI_LINE_PVD) | |||
| #endif /*DUAL_CORE*/ | |||
| /** | |||
| * @brief Enable the PVD Extended Interrupt Rising Trigger. | |||
| @@ -328,15 +435,30 @@ do { \ | |||
| * @brief Check whether the specified PVD EXTI interrupt flag is set or not. | |||
| * @retval EXTI PVD Line Status. | |||
| */ | |||
| #define __HAL_PWR_PVD_EXTI_GET_FLAG() READ_BIT(EXTI_D1->PR1, PWR_EXTI_LINE_PVD) | |||
| #define __HAL_PWR_PVD_EXTI_GET_FLAG() ((READ_BIT(EXTI->PR1, PWR_EXTI_LINE_PVD) == PWR_EXTI_LINE_PVD) ? SET : RESET) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief checks whether the specified PVD Exti interrupt flag is set or not. | |||
| * @retval EXTI D2 PVD Line Status. | |||
| */ | |||
| #define __HAL_PWR_PVD_EXTID2_GET_FLAG() ((READ_BIT(EXTI_D2->PR1, PWR_EXTI_LINE_PVD) == PWR_EXTI_LINE_PVD) ? SET : RESET) | |||
| #endif /*DUAL_CORE*/ | |||
| /** | |||
| * @brief Clear the PVD EXTI flag. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_PVD_EXTI_CLEAR_FLAG() SET_BIT(EXTI_D1->PR1, PWR_EXTI_LINE_PVD) | |||
| #define __HAL_PWR_PVD_EXTI_CLEAR_FLAG() SET_BIT(EXTI->PR1, PWR_EXTI_LINE_PVD) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Clear the PVD EXTI D2 flag. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_PVD_EXTID2_CLEAR_FLAG() SET_BIT(EXTI_D2->PR1, PWR_EXTI_LINE_PVD) | |||
| #endif /*DUAL_CORE*/ | |||
| /** | |||
| * @brief Generates a Software interrupt on PVD EXTI line. | |||
| @@ -433,13 +555,17 @@ void HAL_PWR_DisableSEVOnPend(void); | |||
| ((LEVEL) == PWR_PVDLEVEL_2) || ((LEVEL) == PWR_PVDLEVEL_3)|| \ | |||
| ((LEVEL) == PWR_PVDLEVEL_4) || ((LEVEL) == PWR_PVDLEVEL_5)|| \ | |||
| ((LEVEL) == PWR_PVDLEVEL_6) || ((LEVEL) == PWR_PVDLEVEL_7)) | |||
| #define IS_PWR_PVD_MODE(MODE) (((MODE) == PWR_PVD_MODE_IT_RISING)|| ((MODE) == PWR_PVD_MODE_IT_FALLING) || \ | |||
| ((MODE) == PWR_PVD_MODE_IT_RISING_FALLING) || ((MODE) == PWR_PVD_MODE_EVENT_RISING) || \ | |||
| ((MODE) == PWR_PVD_MODE_EVENT_FALLING) || ((MODE) == PWR_PVD_MODE_EVENT_RISING_FALLING) || \ | |||
| ((MODE) == PWR_PVD_MODE_NORMAL)) | |||
| #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_ON) || \ | |||
| ((REGULATOR) == PWR_LOWPOWERREGULATOR_ON)) | |||
| #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) || ((ENTRY) == PWR_SLEEPENTRY_WFE)) | |||
| #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) || ((ENTRY) == PWR_STOPENTRY_WFE)) | |||
| #define IS_PWR_REGULATOR_VOLTAGE(VOLTAGE) (((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE1) || \ | |||
| ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE2) || \ | |||
| @@ -466,6 +592,6 @@ void HAL_PWR_DisableSEVOnPend(void); | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_PWR_H */ | |||
| #endif /* STM32H7xx_HAL_PWR_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_pwr_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of PWR HAL Extension module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_PWR_EX_H | |||
| #define __STM32H7xx_HAL_PWR_EX_H | |||
| #ifndef STM32H7xx_HAL_PWR_EX_H | |||
| #define STM32H7xx_HAL_PWR_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -96,39 +78,26 @@ typedef struct | |||
| /** @defgroup PWREx_WakeUp_Pins PWREx Wake-Up Pins | |||
| * @{ | |||
| */ | |||
| #define PWR_WAKEUP_PIN6 PWR_WKUPEPR_WKUPEN_6 | |||
| #define PWR_WAKEUP_PIN5 PWR_WKUPEPR_WKUPEN_5 | |||
| #define PWR_WAKEUP_PIN4 PWR_WKUPEPR_WKUPEN_4 | |||
| #define PWR_WAKEUP_PIN3 PWR_WKUPEPR_WKUPEN_3 | |||
| #define PWR_WAKEUP_PIN2 PWR_WKUPEPR_WKUPEN_2 | |||
| #define PWR_WAKEUP_PIN1 PWR_WKUPEPR_WKUPEN_1 | |||
| #define PWR_WAKEUP_PIN6 PWR_WKUPEPR_WKUPEN6 | |||
| #define PWR_WAKEUP_PIN5 PWR_WKUPEPR_WKUPEN5 | |||
| #define PWR_WAKEUP_PIN4 PWR_WKUPEPR_WKUPEN4 | |||
| #define PWR_WAKEUP_PIN3 PWR_WKUPEPR_WKUPEN3 | |||
| #define PWR_WAKEUP_PIN2 PWR_WKUPEPR_WKUPEN2 | |||
| #define PWR_WAKEUP_PIN1 PWR_WKUPEPR_WKUPEN1 | |||
| /* High level and No pull */ | |||
| #define PWR_WAKEUP_PIN6_HIGH PWR_WKUPEPR_WKUPEN_6 | |||
| #define PWR_WAKEUP_PIN5_HIGH PWR_WKUPEPR_WKUPEN_5 | |||
| #define PWR_WAKEUP_PIN4_HIGH PWR_WKUPEPR_WKUPEN_4 | |||
| #define PWR_WAKEUP_PIN3_HIGH PWR_WKUPEPR_WKUPEN_3 | |||
| #define PWR_WAKEUP_PIN2_HIGH PWR_WKUPEPR_WKUPEN_2 | |||
| #define PWR_WAKEUP_PIN1_HIGH PWR_WKUPEPR_WKUPEN_1 | |||
| #define PWR_WAKEUP_PIN6_HIGH PWR_WKUPEPR_WKUPEN6 | |||
| #define PWR_WAKEUP_PIN5_HIGH PWR_WKUPEPR_WKUPEN5 | |||
| #define PWR_WAKEUP_PIN4_HIGH PWR_WKUPEPR_WKUPEN4 | |||
| #define PWR_WAKEUP_PIN3_HIGH PWR_WKUPEPR_WKUPEN3 | |||
| #define PWR_WAKEUP_PIN2_HIGH PWR_WKUPEPR_WKUPEN2 | |||
| #define PWR_WAKEUP_PIN1_HIGH PWR_WKUPEPR_WKUPEN1 | |||
| /* Low level and No pull */ | |||
| #define PWR_WAKEUP_PIN6_LOW (uint32_t)(PWR_WKUPEPR_WKUPP_6 | PWR_WKUPEPR_WKUPEN_6) | |||
| #define PWR_WAKEUP_PIN5_LOW (uint32_t)(PWR_WKUPEPR_WKUPP_5 | PWR_WKUPEPR_WKUPEN_5) | |||
| #define PWR_WAKEUP_PIN4_LOW (uint32_t)(PWR_WKUPEPR_WKUPP_4 | PWR_WKUPEPR_WKUPEN_4) | |||
| #define PWR_WAKEUP_PIN3_LOW (uint32_t)(PWR_WKUPEPR_WKUPP_3 | PWR_WKUPEPR_WKUPEN_3) | |||
| #define PWR_WAKEUP_PIN2_LOW (uint32_t)(PWR_WKUPEPR_WKUPP_2 | PWR_WKUPEPR_WKUPEN_2) | |||
| #define PWR_WAKEUP_PIN1_LOW (uint32_t)(PWR_WKUPEPR_WKUPP_1 | PWR_WKUPEPR_WKUPEN_1) | |||
| /* Wake-Up Pins EXTI register mask */ | |||
| #define PWR_EXTI_WAKEUP_PINS_MASK (uint32_t)(EXTI_IMR2_IM55 | EXTI_IMR2_IM56 | \ | |||
| EXTI_IMR2_IM57 | EXTI_IMR2_IM58 | \ | |||
| EXTI_IMR2_IM59 | EXTI_IMR2_IM60) | |||
| /* Wake-Up Pins EXTI register offset */ | |||
| #define PWR_EXTI_WAKEUP_PINS_PULL_POSITION_OFFSET 23U | |||
| /* Wake-Up Pins PWR register offsets */ | |||
| #define PWR_WAKEUP_PINS_POLARITY_REGISTER_OFFSET 8U | |||
| #define PWR_WAKEUP_PINS_PULL_REGISTER_OFFSET 16U | |||
| #define PWR_WAKEUP_PINS_PULL_POSITION_OFFSET 2U | |||
| #define PWR_WAKEUP_PIN6_LOW (uint32_t)(PWR_WKUPEPR_WKUPP6 | PWR_WKUPEPR_WKUPEN6) | |||
| #define PWR_WAKEUP_PIN5_LOW (uint32_t)(PWR_WKUPEPR_WKUPP5 | PWR_WKUPEPR_WKUPEN5) | |||
| #define PWR_WAKEUP_PIN4_LOW (uint32_t)(PWR_WKUPEPR_WKUPP4 | PWR_WKUPEPR_WKUPEN4) | |||
| #define PWR_WAKEUP_PIN3_LOW (uint32_t)(PWR_WKUPEPR_WKUPP3 | PWR_WKUPEPR_WKUPEN3) | |||
| #define PWR_WAKEUP_PIN2_LOW (uint32_t)(PWR_WKUPEPR_WKUPP2 | PWR_WKUPEPR_WKUPEN2) | |||
| #define PWR_WAKEUP_PIN1_LOW (uint32_t)(PWR_WKUPEPR_WKUPP1 | PWR_WKUPEPR_WKUPEN1) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -166,6 +135,16 @@ typedef struct | |||
| * @} | |||
| */ | |||
| #if defined(DUAL_CORE) | |||
| /** @defgroup PWREx_Core_Select PWREx Core definition | |||
| * @{ | |||
| */ | |||
| #define PWR_CORE_CPU1 ((uint32_t)0x00000000U) | |||
| #define PWR_CORE_CPU2 ((uint32_t)0x00000001U) | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /*DUAL_CORE*/ | |||
| /** @defgroup PWREx_Domains PWREx Domains definition | |||
| * @{ | |||
| @@ -180,7 +159,12 @@ typedef struct | |||
| /** @defgroup PWREx_Domain_Flags PWREx Domain Flags definition | |||
| * @{ | |||
| */ | |||
| #if defined(DUAL_CORE) | |||
| #define PWR_D1_DOMAIN_FLAGS ((uint32_t)0x00000000U) | |||
| #define PWR_D2_DOMAIN_FLAGS ((uint32_t)0x00000001U) | |||
| #else | |||
| #define PWR_CPU_FLAGS ((uint32_t)0x00000000U) | |||
| #endif /*DUAL_CORE*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -198,17 +182,17 @@ typedef struct | |||
| /** @defgroup PWREx_Supply_configuration PWREx Supply configuration | |||
| * @{ | |||
| */ | |||
| #define PWR_LDO_SUPPLY PWR_CR3_LDOEN /* Core domains are suppplied from the LDO */ | |||
| #define PWR_LDO_SUPPLY PWR_CR3_LDOEN /*!< Core domains are suppplied from the LDO */ | |||
| #if defined(SMPS) | |||
| #define PWR_DIRECT_SMPS_SUPPLY PWR_CR3_SMPSEN /* Core domains are suppplied from the SMPS only */ | |||
| #define PWR_SMPS_1V8_SUPPLIES_LDO (PWR_CR3_SMPSLEVEL_0 | PWR_CR3_SMPSEN | PWR_CR3_LDOEN) /* The SMPS 1.8V output supplies the LDO which supplies the Core domains */ | |||
| #define PWR_SMPS_2V5_SUPPLIES_LDO (PWR_CR3_SMPSLEVEL_1 | PWR_CR3_SMPSEN | PWR_CR3_LDOEN) /* The SMPS 2.5V output supplies the LDO which supplies the Core domains */ | |||
| #define PWR_SMPS_1V8_SUPPLIES_EXT_AND_LDO (PWR_CR3_SMPSLEVEL_0 | PWR_CR3_SMPSEXTHP | PWR_CR3_SMPSEN | PWR_CR3_LDOEN) /* The SMPS 1.8V output supplies an external circuits and the LDO. The Core domains are suppplied from the LDO */ | |||
| #define PWR_SMPS_2V5_SUPPLIES_EXT_AND_LDO (PWR_CR3_SMPSLEVEL_1 | PWR_CR3_SMPSEXTHP | PWR_CR3_SMPSEN | PWR_CR3_LDOEN) /* The SMPS 2.5V output supplies an external circuits and the LDO. The Core domains are suppplied from the LDO */ | |||
| #define PWR_SMPS_1V8_SUPPLIES_EXT (PWR_CR3_SMPSLEVEL_0 | PWR_CR3_SMPSEXTHP | PWR_CR3_SMPSEN | PWR_CR3_BYPASS) /* The SMPS 1.8V output supplies an external source which supplies the Core domains */ | |||
| #define PWR_SMPS_2V5_SUPPLIES_EXT (PWR_CR3_SMPSLEVEL_1 | PWR_CR3_SMPSEXTHP | PWR_CR3_SMPSEN | PWR_CR3_BYPASS) /* The SMPS 2.5V output supplies an external source which supplies the Core domains */ | |||
| #define PWR_DIRECT_SMPS_SUPPLY PWR_CR3_SMPSEN /*!< Core domains are suppplied from the SMPS only */ | |||
| #define PWR_SMPS_1V8_SUPPLIES_LDO (PWR_CR3_SMPSLEVEL_0 | PWR_CR3_SMPSEN | PWR_CR3_LDOEN) /*!< The SMPS 1.8V output supplies the LDO which supplies the Core domains */ | |||
| #define PWR_SMPS_2V5_SUPPLIES_LDO (PWR_CR3_SMPSLEVEL_1 | PWR_CR3_SMPSEN | PWR_CR3_LDOEN) /*!< The SMPS 2.5V output supplies the LDO which supplies the Core domains */ | |||
| #define PWR_SMPS_1V8_SUPPLIES_EXT_AND_LDO (PWR_CR3_SMPSLEVEL_0 | PWR_CR3_SMPSEXTHP | PWR_CR3_SMPSEN | PWR_CR3_LDOEN) /*!< The SMPS 1.8V output supplies an external circuits and the LDO. The Core domains are suppplied from the LDO */ | |||
| #define PWR_SMPS_2V5_SUPPLIES_EXT_AND_LDO (PWR_CR3_SMPSLEVEL_1 | PWR_CR3_SMPSEXTHP | PWR_CR3_SMPSEN | PWR_CR3_LDOEN) /*!< The SMPS 2.5V output supplies an external circuits and the LDO. The Core domains are suppplied from the LDO */ | |||
| #define PWR_SMPS_1V8_SUPPLIES_EXT (PWR_CR3_SMPSLEVEL_0 | PWR_CR3_SMPSEXTHP | PWR_CR3_SMPSEN | PWR_CR3_BYPASS) /*!< The SMPS 1.8V output supplies an external source which supplies the Core domains */ | |||
| #define PWR_SMPS_2V5_SUPPLIES_EXT (PWR_CR3_SMPSLEVEL_1 | PWR_CR3_SMPSEXTHP | PWR_CR3_SMPSEN | PWR_CR3_BYPASS) /*!< The SMPS 2.5V output supplies an external source which supplies the Core domains */ | |||
| #endif /* SMPS */ | |||
| #define PWR_EXTERNAL_SOURCE_SUPPLY PWR_CR3_BYPASS /* The SMPS disabled and the LDO Bypass. The Core domains are supplied from an external source */ | |||
| #define PWR_EXTERNAL_SOURCE_SUPPLY PWR_CR3_BYPASS /*!< The SMPS disabled and the LDO Bypass. The Core domains are supplied from an external source */ | |||
| #if defined(SMPS) | |||
| #define PWR_SUPPLY_CONFIG_MASK (PWR_CR3_SMPSLEVEL | PWR_CR3_SMPSEXTHP | \ | |||
| @@ -220,22 +204,6 @@ typedef struct | |||
| * @} | |||
| */ | |||
| #if defined(SMPS) | |||
| /** @defgroup HAL_PWREx_SMPS_SetOperationMode PWREx SMPS operation modes | |||
| * @{ | |||
| */ | |||
| #define PWR_SMPS_FORCED_PWM PWR_PDR1_SMPSFPWMEN | |||
| #define PWR_SMPS_SLOW_PULSE_SKIPPING_LEVEL0 PWR_PDR1_PSKSYNC | |||
| #define PWR_SMPS_SLOW_PULSE_SKIPPING_LEVEL1 (PWR_PDR1_PSKSYNC | PWR_PDR1_PSKTHR_0) | |||
| #define PWR_SMPS_SLOW_PULSE_SKIPPING_LEVEL2 (PWR_PDR1_PSKSYNC | PWR_PDR1_PSKTHR_1) | |||
| #define PWR_SMPS_SLOW_PULSE_SKIPPING_LEVEL3 (PWR_PDR1_PSKSYNC | PWR_PDR1_PSKTHR) | |||
| #define PWR_SMPS_FAST_PULSE_SKIPPING (PWR_PDR1_FASTTRAN |PWR_PDR1_PSKSYNC) | |||
| #define PWR_SMPS_ULTRA_FAST_PULSE_SKIPPING PWR_PDR1_FASTTRAN | |||
| #define PWR_SMPS_MODE_MASK (PWR_PDR1_FASTTRAN | PWR_PDR1_PSKTHR | PWR_PDR1_PSKSYNC | PWR_PDR1_SMPSFPWMEN) | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* SMPS */ | |||
| /** @defgroup PWREx_AVD_detection_level PWREx AVD detection level | |||
| * @{ | |||
| @@ -251,13 +219,13 @@ typedef struct | |||
| /** @defgroup PWREx_AVD_Mode PWREx AVD Mode | |||
| * @{ | |||
| */ | |||
| #define PWR_AVD_MODE_NORMAL ((uint32_t)0x00000000U) /*!< Basic mode is used */ | |||
| #define PWR_AVD_MODE_IT_RISING ((uint32_t)0x00010001U) /*!< External Interrupt Mode with Rising edge trigger detection */ | |||
| #define PWR_AVD_MODE_IT_FALLING ((uint32_t)0x00010002U) /*!< External Interrupt Mode with Falling edge trigger detection */ | |||
| #define PWR_AVD_MODE_NORMAL ((uint32_t)0x00000000U) /*!< Basic mode is used */ | |||
| #define PWR_AVD_MODE_IT_RISING ((uint32_t)0x00010001U) /*!< External Interrupt Mode with Rising edge trigger detection */ | |||
| #define PWR_AVD_MODE_IT_FALLING ((uint32_t)0x00010002U) /*!< External Interrupt Mode with Falling edge trigger detection */ | |||
| #define PWR_AVD_MODE_IT_RISING_FALLING ((uint32_t)0x00010003U) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */ | |||
| #define PWR_AVD_MODE_EVENT_RISING ((uint32_t)0x00020001U) /*!< Event Mode with Rising edge trigger detection */ | |||
| #define PWR_AVD_MODE_EVENT_FALLING ((uint32_t)0x00020002U) /*!< Event Mode with Falling edge trigger detection */ | |||
| #define PWR_AVD_MODE_EVENT_RISING_FALLING ((uint32_t)0x00020003U) /*!< Event Mode with Rising/Falling edge trigger detection */ | |||
| #define PWR_AVD_MODE_EVENT_RISING ((uint32_t)0x00020001U) /*!< Event Mode with Rising edge trigger detection */ | |||
| #define PWR_AVD_MODE_EVENT_FALLING ((uint32_t)0x00020002U) /*!< Event Mode with Falling edge trigger detection */ | |||
| #define PWR_AVD_MODE_EVENT_RISING_FALLING ((uint32_t)0x00020003U) /*!< Event Mode with Rising/Falling edge trigger detection */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -276,7 +244,7 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| #define PWR_BATTERY_CHARGING_RESISTOR_5 ((uint32_t)0x00000000U) /*!< VBAT charging through a 5 kOhms resistor */ | |||
| #define PWR_BATTERY_CHARGING_RESISTOR_1_5 PWR_CR3_VBRS /*!< VBAT charging through a 1.5 kOhms resistor */ | |||
| #define PWR_BATTERY_CHARGING_RESISTOR_1_5 PWR_CR3_VBRS /*!< VBAT charging through a 1.5 kOhms resistor */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -319,29 +287,57 @@ typedef struct | |||
| * @brief Enable the AVD EXTI Line 16. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_AVD_EXTI_ENABLE_IT() SET_BIT(EXTI_D1->IMR1, PWR_EXTI_LINE_AVD) | |||
| #define __HAL_PWR_AVD_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR1, PWR_EXTI_LINE_AVD) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Enable the AVD EXTI D2 Line 16. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_AVD_EXTID2_ENABLE_IT() SET_BIT(EXTI_D2->IMR1, PWR_EXTI_LINE_AVD) | |||
| #endif /*DUAL_CORE*/ | |||
| /** | |||
| * @brief Disable the AVD EXTI Line 16 | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_AVD_EXTI_DISABLE_IT() CLEAR_BIT(EXTI_D1->IMR1, PWR_EXTI_LINE_AVD) | |||
| #define __HAL_PWR_AVD_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR1, PWR_EXTI_LINE_AVD) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Disable the AVD EXTI D2 Line 16. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_AVD_EXTID2_DISABLE_IT() CLEAR_BIT(EXTI_D2->IMR1, PWR_EXTI_LINE_AVD) | |||
| #endif /*DUAL_CORE*/ | |||
| /** | |||
| * @brief Enable event on AVD EXTI Line 16. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_AVD_EXTI_ENABLE_EVENT() SET_BIT(EXTI_D1->EMR1, PWR_EXTI_LINE_AVD) | |||
| #define __HAL_PWR_AVD_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR1, PWR_EXTI_LINE_AVD) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Enable event on AVD EXTI D2 Line 16. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_AVD_EXTID2_ENABLE_EVENT() SET_BIT(EXTI_D2->EMR1, PWR_EXTI_LINE_AVD) | |||
| #endif /*DUAL_CORE*/ | |||
| /** | |||
| * @brief Disable event on AVD EXTI Line 16. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_AVD_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI_D1->EMR1, PWR_EXTI_LINE_AVD) | |||
| #define __HAL_PWR_AVD_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR1, PWR_EXTI_LINE_AVD) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Disable event on AVD EXTI D2 Line 16. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_AVD_EXTID2_DISABLE_EVENT() CLEAR_BIT(EXTI_D2->EMR1, PWR_EXTI_LINE_AVD) | |||
| #endif /*DUAL_CORE*/ | |||
| /** | |||
| * @brief Enable the AVD Extended Interrupt Rising Trigger. | |||
| @@ -392,15 +388,29 @@ do { \ | |||
| * @brief Check whether the specified AVD EXTI interrupt flag is set or not. | |||
| * @retval EXTI AVD Line Status. | |||
| */ | |||
| #define __HAL_PWR_AVD_EXTI_GET_FLAG() READ_BIT(EXTI_D1->PR1, PWR_EXTI_LINE_AVD) | |||
| #define __HAL_PWR_AVD_EXTI_GET_FLAG() ((READ_BIT(EXTI->PR1, PWR_EXTI_LINE_AVD) == PWR_EXTI_LINE_AVD) ? SET : RESET) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Check whether the specified AVD EXTI D2 interrupt flag is set or not. | |||
| * @retval EXTI D2 AVD Line Status. | |||
| */ | |||
| #define __HAL_PWR_AVD_EXTID2_GET_FLAG() ((READ_BIT(EXTI_D2->PR1, PWR_EXTI_LINE_AVD) == PWR_EXTI_LINE_AVD) ? SET : RESET) | |||
| #endif /*DUAL_CORE*/ | |||
| /** | |||
| * @brief Clear the AVD EXTI flag. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_AVD_EXTI_CLEAR_FLAG() SET_BIT(EXTI_D1->PR1, PWR_EXTI_LINE_AVD) | |||
| #define __HAL_PWR_AVD_EXTI_CLEAR_FLAG() SET_BIT(EXTI->PR1, PWR_EXTI_LINE_AVD) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Clear the AVD EXTI D2 flag. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_PWR_AVD_EXTID2_CLEAR_FLAG() SET_BIT(EXTI_D2->PR1, PWR_EXTI_LINE_AVD) | |||
| #endif /*DUAL_CORE*/ | |||
| /** | |||
| * @} | |||
| @@ -417,9 +427,6 @@ do { \ | |||
| /* Power supply control functions */ | |||
| HAL_StatusTypeDef HAL_PWREx_ConfigSupply(uint32_t SupplySource); | |||
| uint32_t HAL_PWREx_GetSupplyConfig(void); | |||
| #if defined(SMPS) | |||
| uint32_t HAL_PWREx_SMPS_SetOperationMode(uint32_t SMPS_Mode); | |||
| #endif /*SMPS*/ | |||
| /* Power volatge scaling functions */ | |||
| HAL_StatusTypeDef HAL_PWREx_ControlVoltageScaling(uint32_t VoltageScaling); | |||
| uint32_t HAL_PWREx_GetVoltageRange(void); | |||
| @@ -437,6 +444,17 @@ void HAL_PWREx_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry, uint32_t Dom | |||
| void HAL_PWREx_EnterSTANDBYMode(uint32_t Domain); | |||
| void HAL_PWREx_ConfigD3Domain(uint32_t D3State); | |||
| #if defined(DUAL_CORE) | |||
| void HAL_PWREx_ClearDomainFlags(uint32_t DomainFlags); | |||
| /* Power core holding functions */ | |||
| HAL_StatusTypeDef HAL_PWREx_HoldCore(uint32_t CPU); | |||
| void HAL_PWREx_ReleaseCore(uint32_t CPU); | |||
| #endif /*DUAL_CORE*/ | |||
| /* Clear pending event function */ | |||
| void HAL_PWREx_ClearPendingEvent(void); | |||
| /* Flash low power control functions */ | |||
| void HAL_PWREx_EnableFlashPowerDown(void); | |||
| @@ -446,6 +464,7 @@ void HAL_PWREx_EnableWakeUpPin(PWREx_WakeupPinTypeDef *sPinParams); | |||
| void HAL_PWREx_DisableWakeUpPin(uint32_t WakeUpPin); | |||
| uint32_t HAL_PWREx_GetWakeupFlag(uint32_t WakeUpFlag); | |||
| HAL_StatusTypeDef HAL_PWREx_ClearWakeupFlag(uint32_t WakeUpFlag); | |||
| /* Power Wakeup PIN IRQ Handler */ | |||
| void HAL_PWREx_WAKEUP_PIN_IRQHandler(void); | |||
| void HAL_PWREx_WKUP1_Callback(void); | |||
| @@ -464,11 +483,13 @@ void HAL_PWREx_WKUP6_Callback(void); | |||
| /* Backup regulator control functions */ | |||
| HAL_StatusTypeDef HAL_PWREx_EnableBkUpReg(void); | |||
| HAL_StatusTypeDef HAL_PWREx_DisableBkUpReg(void); | |||
| /* USB regulator control functions */ | |||
| HAL_StatusTypeDef HAL_PWREx_EnableUSBReg(void); | |||
| HAL_StatusTypeDef HAL_PWREx_DisableUSBReg(void); | |||
| void HAL_PWREx_EnableUSBVoltageDetector(void); | |||
| void HAL_PWREx_DisableUSBVoltageDetector(void); | |||
| /* Battery control functions */ | |||
| void HAL_PWREx_EnableBatteryCharging(uint32_t ResistorValue); | |||
| void HAL_PWREx_DisableBatteryCharging(void); | |||
| @@ -523,13 +544,6 @@ void HAL_PWREx_AVDCallback(void); | |||
| ((PWR_SOURCE) == PWR_SMPS_2V5_SUPPLIES_EXT) || \ | |||
| ((PWR_SOURCE) == PWR_EXTERNAL_SOURCE_SUPPLY)) | |||
| #define IS_PWR_SMPS_MODE(MODE) (((MODE) == PWR_SMPS_FORCED_PWM) || \ | |||
| ((MODE) == PWR_SMPS_SLOW_PULSE_SKIPPING_LEVEL0) || \ | |||
| ((MODE) == PWR_SMPS_SLOW_PULSE_SKIPPING_LEVEL1) || \ | |||
| ((MODE) == PWR_SMPS_SLOW_PULSE_SKIPPING_LEVEL2) || \ | |||
| ((MODE) == PWR_SMPS_SLOW_PULSE_SKIPPING_LEVEL3) || \ | |||
| ((MODE) == PWR_SMPS_FAST_PULSE_SKIPPING) || \ | |||
| ((MODE) == PWR_SMPS_ULTRA_FAST_PULSE_SKIPPING)) | |||
| #else | |||
| #define IS_PWR_SUPPLY(PWR_SOURCE) (((PWR_SOURCE) == PWR_LDO_SUPPLY) || \ | |||
| ((PWR_SOURCE) == PWR_EXTERNAL_SOURCE_SUPPLY)) | |||
| @@ -589,6 +603,16 @@ void HAL_PWREx_AVDCallback(void); | |||
| #define IS_PWR_BATTERY_RESISTOR_SELECT(RESISTOR) (((RESISTOR) == PWR_BATTERY_CHARGING_RESISTOR_5) ||\ | |||
| ((RESISTOR) == PWR_BATTERY_CHARGING_RESISTOR_1_5)) | |||
| #define IS_PWR_D1_CPU(CPU) ((CPU) == CM7_CPUID) | |||
| #if defined(DUAL_CORE) | |||
| #define IS_PWR_CORE(CPU) (((CPU) == PWR_CORE_CPU1) || ((CPU) == PWR_CORE_CPU2)) | |||
| #define IS_PWR_D2_CPU(CPU) ((CPU) == CM4_CPUID) | |||
| #define IS_PWR_DOMAIN_FLAG(FLAG) (((FLAG) == PWR_D1_DOMAIN_FLAGS) || \ | |||
| ((FLAG) == PWR_D2_DOMAIN_FLAGS)) | |||
| #endif /*DUAL_CORE*/ | |||
| /** | |||
| * @} | |||
| @@ -609,6 +633,6 @@ void HAL_PWREx_AVDCallback(void); | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_PWR_EX_H */ | |||
| #endif /* STM32H7xx_HAL_PWR_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_qspi.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of QSPI HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_QSPI_H | |||
| #define __STM32H7xx_HAL_QSPI_H | |||
| #ifndef STM32H7xx_HAL_QSPI_H | |||
| #define STM32H7xx_HAL_QSPI_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -45,7 +27,6 @@ | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_hal_def.h" | |||
| #include "stm32h7xx_hal_mdma.h" | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| @@ -115,7 +96,11 @@ typedef enum | |||
| /** | |||
| * @brief QSPI Handle Structure definition | |||
| */ | |||
| #if (USE_HAL_QSPI_REGISTER_CALLBACKS == 1) | |||
| typedef struct __QSPI_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif/* USE_HAL_QSPI_REGISTER_CALLBACKS */ | |||
| { | |||
| QUADSPI_TypeDef *Instance; /* QSPI registers base address */ | |||
| QSPI_InitTypeDef Init; /* QSPI communication parameters */ | |||
| @@ -130,6 +115,19 @@ typedef struct | |||
| __IO HAL_QSPI_StateTypeDef State; /* QSPI communication state */ | |||
| __IO uint32_t ErrorCode; /* QSPI Error code */ | |||
| uint32_t Timeout; /* Timeout for the QSPI memory access */ | |||
| #if (USE_HAL_QSPI_REGISTER_CALLBACKS == 1) | |||
| void (* ErrorCallback) (struct __QSPI_HandleTypeDef *hqspi); | |||
| void (* AbortCpltCallback) (struct __QSPI_HandleTypeDef *hqspi); | |||
| void (* FifoThresholdCallback)(struct __QSPI_HandleTypeDef *hqspi); | |||
| void (* CmdCpltCallback) (struct __QSPI_HandleTypeDef *hqspi); | |||
| void (* RxCpltCallback) (struct __QSPI_HandleTypeDef *hqspi); | |||
| void (* TxCpltCallback) (struct __QSPI_HandleTypeDef *hqspi); | |||
| void (* StatusMatchCallback) (struct __QSPI_HandleTypeDef *hqspi); | |||
| void (* TimeOutCallback) (struct __QSPI_HandleTypeDef *hqspi); | |||
| void (* MspInitCallback) (struct __QSPI_HandleTypeDef *hqspi); | |||
| void (* MspDeInitCallback) (struct __QSPI_HandleTypeDef *hqspi); | |||
| #endif | |||
| }QSPI_HandleTypeDef; | |||
| /** | |||
| @@ -199,6 +197,30 @@ typedef struct | |||
| This parameter can be a value of @ref QSPI_TimeOutActivation */ | |||
| }QSPI_MemoryMappedTypeDef; | |||
| #if (USE_HAL_QSPI_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL QSPI Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_QSPI_ERROR_CB_ID = 0x00U, /*!< QSPI Error Callback ID */ | |||
| HAL_QSPI_ABORT_CB_ID = 0x01U, /*!< QSPI Abort Callback ID */ | |||
| HAL_QSPI_FIFO_THRESHOLD_CB_ID = 0x02U, /*!< QSPI FIFO Threshold Callback ID */ | |||
| HAL_QSPI_CMD_CPLT_CB_ID = 0x03U, /*!< QSPI Command Complete Callback ID */ | |||
| HAL_QSPI_RX_CPLT_CB_ID = 0x04U, /*!< QSPI Rx Complete Callback ID */ | |||
| HAL_QSPI_TX_CPLT_CB_ID = 0x05U, /*!< QSPI Tx Complete Callback ID */ | |||
| HAL_QSPI_STATUS_MATCH_CB_ID = 0x08U, /*!< QSPI Status Match Callback ID */ | |||
| HAL_QSPI_TIMEOUT_CB_ID = 0x09U, /*!< QSPI Timeout Callback ID */ | |||
| HAL_QSPI_MSP_INIT_CB_ID = 0x0AU, /*!< QSPI MspInit Callback ID */ | |||
| HAL_QSPI_MSP_DEINIT_CB_ID = 0x0B0 /*!< QSPI MspDeInit Callback ID */ | |||
| }HAL_QSPI_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL QSPI Callback pointer definition | |||
| */ | |||
| typedef void (*pQSPI_CallbackTypeDef)(QSPI_HandleTypeDef *hqspi); | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -216,6 +238,9 @@ typedef struct | |||
| #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 */ | |||
| #if (USE_HAL_QSPI_REGISTER_CALLBACKS == 1) | |||
| #define HAL_QSPI_ERROR_INVALID_CALLBACK 0x00000010U /*!< Invalid callback error */ | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -437,7 +462,15 @@ typedef struct | |||
| * @param __HANDLE__: QSPI handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_QSPI_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_QSPI_RESET_HANDLE_STATE(__HANDLE__) do { \ | |||
| (__HANDLE__)->State = HAL_QSPI_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_QSPI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_QSPI_STATE_RESET) | |||
| #endif | |||
| /** @brief Enable the QSPI peripheral. | |||
| * @param __HANDLE__: specifies the QSPI Handle. | |||
| @@ -504,7 +537,7 @@ typedef struct | |||
| * @arg QSPI_FLAG_TE: QSPI Transfer error flag | |||
| * @retval None | |||
| */ | |||
| #define __HAL_QSPI_GET_FLAG(__HANDLE__, __FLAG__) (READ_BIT((__HANDLE__)->Instance->SR, (__FLAG__)) != 0) | |||
| #define __HAL_QSPI_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BIT((__HANDLE__)->Instance->SR, (__FLAG__)) != 0U) ? SET : RESET) | |||
| /** @brief Clears the specified QSPI's flag status. | |||
| * @param __HANDLE__: specifies the QSPI Handle. | |||
| @@ -561,8 +594,6 @@ void HAL_QSPI_FifoThresholdCallback(QSPI_HandleTypeDef *hqspi); | |||
| 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); | |||
| @@ -570,6 +601,18 @@ void HAL_QSPI_StatusMatchCallback (QSPI_HandleTypeDef *hqspi); | |||
| /* QSPI memory-mapped mode */ | |||
| void HAL_QSPI_TimeOutCallback (QSPI_HandleTypeDef *hqspi); | |||
| #if (USE_HAL_QSPI_REGISTER_CALLBACKS == 1) | |||
| /* QSPI callback registering/unregistering */ | |||
| HAL_StatusTypeDef HAL_QSPI_RegisterCallback (QSPI_HandleTypeDef *hqspi, HAL_QSPI_CallbackIDTypeDef CallbackId, pQSPI_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_QSPI_UnRegisterCallback (QSPI_HandleTypeDef *hqspi, HAL_QSPI_CallbackIDTypeDef CallbackId); | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup QSPI_Exported_Functions_Group3 | |||
| * @{ | |||
| */ | |||
| /* Peripheral Control and State functions ************************************/ | |||
| HAL_QSPI_StateTypeDef HAL_QSPI_GetState (QSPI_HandleTypeDef *hqspi); | |||
| uint32_t HAL_QSPI_GetError (QSPI_HandleTypeDef *hqspi); | |||
| @@ -578,23 +621,25 @@ 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); | |||
| HAL_StatusTypeDef HAL_QSPI_SetFlashID (QSPI_HandleTypeDef *hqspi, uint32_t FlashID); | |||
| /** | |||
| * @} | |||
| */ | |||
| /* End of exported functions -------------------------------------------------*/ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup QSPI_Private_Macros QSPI Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_QSPI_CLOCK_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFF) | |||
| #define IS_QSPI_CLOCK_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFFU) | |||
| #define IS_QSPI_FIFO_THRESHOLD(THR) (((THR) > 0) && ((THR) <= 32)) | |||
| #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)) | |||
| #define IS_QSPI_FLASH_SIZE(FSIZE) (((FSIZE) <= 31)) | |||
| #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) || \ | |||
| @@ -609,13 +654,13 @@ uint32_t HAL_QSPI_GetFifoThreshold(QSPI_HandleTypeDef *hqspi); | |||
| ((CLKMODE) == QSPI_CLOCK_MODE_3)) | |||
| #define IS_QSPI_FLASH_ID(FLASH) (((FLASH) == QSPI_FLASH_ID_1) || \ | |||
| ((FLASH) == QSPI_FLASH_ID_2)) | |||
| #define IS_QSPI_FLASH_ID(FLASH_ID) (((FLASH_ID) == QSPI_FLASH_ID_1) || \ | |||
| ((FLASH_ID) == QSPI_FLASH_ID_2)) | |||
| #define IS_QSPI_DUAL_FLASH_MODE(MODE) (((MODE) == QSPI_DUALFLASH_ENABLE) || \ | |||
| ((MODE) == QSPI_DUALFLASH_DISABLE)) | |||
| #define IS_QSPI_INSTRUCTION(INSTRUCTION) ((INSTRUCTION) <= 0xFF) | |||
| #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) || \ | |||
| @@ -627,7 +672,7 @@ uint32_t HAL_QSPI_GetFifoThreshold(QSPI_HandleTypeDef *hqspi); | |||
| ((SIZE) == QSPI_ALTERNATE_BYTES_24_BITS) || \ | |||
| ((SIZE) == QSPI_ALTERNATE_BYTES_32_BITS)) | |||
| #define IS_QSPI_DUMMY_CYCLES(DCY) ((DCY) <= 31) | |||
| #define IS_QSPI_DUMMY_CYCLES(DCY) ((DCY) <= 31U) | |||
| #define IS_QSPI_INSTRUCTION_MODE(MODE) (((MODE) == QSPI_INSTRUCTION_NONE) || \ | |||
| ((MODE) == QSPI_INSTRUCTION_1_LINE) || \ | |||
| @@ -660,7 +705,7 @@ uint32_t HAL_QSPI_GetFifoThreshold(QSPI_HandleTypeDef *hqspi); | |||
| #define IS_QSPI_INTERVAL(INTERVAL) ((INTERVAL) <= QUADSPI_PIR_INTERVAL) | |||
| #define IS_QSPI_STATUS_BYTES_SIZE(SIZE) (((SIZE) >= 1) && ((SIZE) <= 4)) | |||
| #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)) | |||
| @@ -671,7 +716,7 @@ uint32_t HAL_QSPI_GetFifoThreshold(QSPI_HandleTypeDef *hqspi); | |||
| #define IS_QSPI_TIMEOUT_ACTIVATION(TCEN) (((TCEN) == QSPI_TIMEOUT_COUNTER_DISABLE) || \ | |||
| ((TCEN) == QSPI_TIMEOUT_COUNTER_ENABLE)) | |||
| #define IS_QSPI_TIMEOUT_PERIOD(PERIOD) ((PERIOD) <= 0xFFFF) | |||
| #define IS_QSPI_TIMEOUT_PERIOD(PERIOD) ((PERIOD) <= 0xFFFFU) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -685,10 +730,13 @@ uint32_t HAL_QSPI_GetFifoThreshold(QSPI_HandleTypeDef *hqspi); | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_QSPI_H */ | |||
| #endif /* STM32H7xx_HAL_QSPI_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,309 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_ramecc.h | |||
| * @author MCD Application Team | |||
| * @brief Header file of RAMECC HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics. | |||
| * All rights reserved.</center></h2> | |||
| * | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef STM32H7xx_HAL_RAMECC_H | |||
| #define STM32H7xx_HAL_RAMECC_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_hal_def.h" | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup RAMECC | |||
| * @{ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup RAMECC_Exported_Types RAMECC Exported Types | |||
| * @brief RAMECC Exported Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief HAL RAMECC State structures definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_RAMECC_STATE_RESET = 0x00U, /*!< RAMECC not yet initialized or disabled */ | |||
| HAL_RAMECC_STATE_READY = 0x01U, /*!< RAMECC initialized and ready for use */ | |||
| HAL_RAMECC_STATE_BUSY = 0x02U, /*!< RAMECC process is ongoing */ | |||
| HAL_RAMECC_STATE_ERROR = 0x03U, /*!< RAMECC error state */ | |||
| }HAL_RAMECC_StateTypeDef; | |||
| /** | |||
| * @brief RAMECC handle Structure definition | |||
| */ | |||
| typedef struct __RAMECC_HandleTypeDef | |||
| { | |||
| RAMECC_MonitorTypeDef *Instance; /*!< Register base address */ | |||
| __IO HAL_RAMECC_StateTypeDef State; /*!< RAMECC state */ | |||
| void (* DetectErrorCallback)( struct __RAMECC_HandleTypeDef *hramecc); /*!< RAMECC error detect callback */ | |||
| }RAMECC_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup RAMECC_Interrupt RAMECC interrupts | |||
| * @{ | |||
| */ | |||
| #define RAMECC_IT_GLOBAL_ID 0x10000000UL | |||
| #define RAMECC_IT_MONITOR_ID 0x20000000UL | |||
| #define RAMECC_IT_GLOBAL_ENABLE (RAMECC_IT_GLOBAL_ID | RAMECC_IER_GIE) | |||
| #define RAMECC_IT_GLOBAL_SINGLEERR_R (RAMECC_IT_GLOBAL_ID | RAMECC_IER_GECCSEIE) | |||
| #define RAMECC_IT_GLOBAL_DOUBLEERR_R (RAMECC_IT_GLOBAL_ID | RAMECC_IER_GECCDEIE) | |||
| #define RAMECC_IT_GLOBAL_DOUBLEERR_W (RAMECC_IT_GLOBAL_ID | RAMECC_IER_GECCDEBWIE) | |||
| #define RAMECC_IT_GLOBAL_ALL (RAMECC_IT_GLOBAL_ID | RAMECC_IER_GIE | RAMECC_IER_GECCSEIE | RAMECC_IER_GECCDEIE | RAMECC_IER_GECCDEBWIE) | |||
| #define RAMECC_IT_MONITOR_SINGLEERR_R (RAMECC_IT_MONITOR_ID | RAMECC_CR_ECCSEIE) | |||
| #define RAMECC_IT_MONITOR_DOUBLEERR_R (RAMECC_IT_MONITOR_ID | RAMECC_CR_ECCDEIE) | |||
| #define RAMECC_IT_MONITOR_DOUBLEERR_W (RAMECC_IT_MONITOR_ID | RAMECC_CR_ECCDEBWIE) | |||
| #define RAMECC_IT_MONITOR_ALL (RAMECC_IT_MONITOR_ID | RAMECC_CR_ECCDEBWIE | RAMECC_CR_ECCDEIE | RAMECC_CR_ECCSEIE) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup RAMECC_FLAG RAMECC Monitor flags | |||
| * @{ | |||
| */ | |||
| #define RAMECC_FLAG_SINGLEERR_R RAMECC_SR_SEDCF | |||
| #define RAMECC_FLAG_DOUBLEERR_R RAMECC_SR_DEDF | |||
| #define RAMECC_FLAG_DOUBLEERR_W RAMECC_SR_DEBWDF | |||
| #define RAMECC_FLAGS_ALL (RAMECC_SR_SEDCF | RAMECC_SR_DEDF | RAMECC_SR_DEBWDF) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup RAMECC_Exported_Macros RAMECC Exported Macros | |||
| * @{ | |||
| */ | |||
| #define __HAL_RAMECC_ENABLE_GLOBAL_IT(__HANDLE__, __INTERRUPT__) ((((RAMECC_TypeDef *)((uint32_t)(__HANDLE__)->Instance & 0xFFFFFF00U))->IER) |= ((__INTERRUPT__) & ~RAMECC_IT_GLOBAL_ID)) | |||
| #define __HAL_RAMECC_ENABLE_MONITOR_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= ((__INTERRUPT__) & ~RAMECC_IT_MONITOR_ID)) | |||
| /** | |||
| * @brief Enable the specified RAMECC interrupts. | |||
| * @param __HANDLE__ : RAMECC handle. | |||
| * @param __INTERRUPT__: specifies the RAMECC interrupt sources to be enabled or disabled. | |||
| * This parameter can be one of the following values: | |||
| * @arg RAMECC_IT_GLOBAL_E : Global interrupt enable mask. | |||
| * @arg RAMECC_IT_GLOBAL_SEE : Global ECC single error interrupt enable. | |||
| * @arg RAMECC_IT_GLOBAL_DEE : Global ECC double error interrupt enable. | |||
| * @arg RAMECC_IT_GLOBAL_DEBWE : Global ECC double error on byte write (BW) interrupt enable. | |||
| * @arg RAMECC_IT_GLOBAL_ALL : All Global ECC interrupts enable mask. | |||
| * @arg RAMECC_IT_MONITOR_SEE : Monitor ECC single error interrupt enable. | |||
| * @arg RAMECC_IT_MONITOR_DEE : Monitor ECC double error interrupt enable. | |||
| * @arg RAMECC_IT_MONITOR_DEBWE : Monitor ECC double error on byte write (BW) interrupt enable. | |||
| * @arg RAMECC_IT_MONITOR_ALL : All Monitor ECC interrupts enable mask. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RAMECC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ( \ | |||
| (IS_RAMECC_GLOBAL_INTERRUPT(__INTERRUPT__)) ? (__HAL_RAMECC_ENABLE_GLOBAL_IT((__HANDLE__), (__INTERRUPT__))) :\ | |||
| (__HAL_RAMECC_ENABLE_MONITOR_IT((__HANDLE__), (__INTERRUPT__)))) | |||
| #define __HAL_RAMECC_DISABLE_GLOBAL_IT(__HANDLE__, __INTERRUPT__) ((((RAMECC_TypeDef *)((uint32_t)&(__HANDLE__)->Instance & 0xFFFFFF00U))->IER) &= ~((__INTERRUPT__) & ~RAMECC_IT_GLOBAL_ID)) | |||
| #define __HAL_RAMECC_DISABLE_MONITOR_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~((__INTERRUPT__) & ~RAMECC_IT_MONITOR_ID)) | |||
| /** | |||
| * @brief Disable the specified RAMECC interrupts. | |||
| * @param __HANDLE__ : RAMECC handle. | |||
| * @param __INTERRUPT__: specifies the RAMECC interrupt sources to be enabled or disabled. | |||
| * This parameter can be one of the following values: | |||
| * @arg RAMECC_IT_GLOBAL_E : Global interrupt enable mask. | |||
| * @arg RAMECC_IT_GLOBAL_SEE : Global ECC single error interrupt enable. | |||
| * @arg RAMECC_IT_GLOBAL_DEE : Global ECC double error interrupt enable. | |||
| * @arg RAMECC_IT_GLOBAL_DEBWE : Global ECC double error on byte write (BW) interrupt enable. | |||
| * @arg RAMECC_IT_GLOBAL_ALL : All Global ECC interrupts enable mask. | |||
| * @arg RAMECC_IT_MONITOR_SEE : Monitor ECC single error interrupt enable. | |||
| * @arg RAMECC_IT_MONITOR_DEE : Monitor ECC double error interrupt enable. | |||
| * @arg RAMECC_IT_MONITOR_DEBWE : Monitor ECC double error on byte write (BW) interrupt enable. | |||
| * @arg RAMECC_IT_MONITOR_ALL : All Monitor ECC interrupts enable mask. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RAMECC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ( \ | |||
| (IS_RAMECC_GLOBAL_INTERRUPT(__INTERRUPT__)) ? (__HAL_RAMECC_DISABLE_GLOBAL_IT((__HANDLE__), (__INTERRUPT__))) :\ | |||
| (__HAL_RAMECC_DISABLE_MONITOR_IT((__HANDLE__), (__INTERRUPT__)))) | |||
| /** | |||
| * @brief Get the RAMECC pending flags. | |||
| * @param __HANDLE__ : RAMECC handle. | |||
| * @param __FLAG__ : specifies the flag to clear. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg RAMECC_FLAG_SEDCF : RAMECC instance ECC single error detected and corrected flag. | |||
| * @arg RAMECC_FLAG_DEDF : RAMECC instance ECC double error detected flag. | |||
| * @arg RAMECC_FLAG_DEBWDF : RAMECC instance ECC double error on byte write (BW) detected flag. | |||
| * @arg RAMECC_FLAGS_ALL : RAMECC instance all flag. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_RAMECC_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR &= (__FLAG__)) | |||
| /** | |||
| * @brief Clear the RAMECC pending flags. | |||
| * @param __HANDLE__ : RAMECC handle. | |||
| * @param __FLAG__ : specifies the flag to clear. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg RAMECC_FLAG_SEDCF : RAMECC instance ECC single error detected and corrected flag. | |||
| * @arg RAMECC_FLAG_DEDF : RAMECC instance ECC double error detected flag. | |||
| * @arg RAMECC_FLAG_DEBWDF : RAMECC instance ECC double error on byte write (BW) detected flag. | |||
| * @arg RAMECC_FLAGS_ALL : RAMECC instance all flag. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_RAMECC_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR &= ~(__FLAG__)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @defgroup RAMECC_Exported_Functions RAMECC Exported Functions | |||
| * @brief RAMECC Exported functions | |||
| * @{ | |||
| */ | |||
| /** @defgroup RAMECC_Exported_Functions_Group1 Initialization and de-initialization functions | |||
| * @brief Initialization and de-initialization functions | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_RAMECC_Init(RAMECC_HandleTypeDef *hramecc); | |||
| HAL_StatusTypeDef HAL_RAMECC_DeInit(RAMECC_HandleTypeDef *hramecc); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup RAMECC_Exported_Functions_Group2 monitoring operation functions | |||
| * @brief monitoring operation functions | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_RAMECC_StartMonitor(RAMECC_HandleTypeDef *hramecc); | |||
| HAL_StatusTypeDef HAL_RAMECC_StopMonitor(RAMECC_HandleTypeDef *hramecc); | |||
| HAL_StatusTypeDef HAL_RAMECC_EnableNotification(RAMECC_HandleTypeDef *hramecc, uint32_t Notifications); | |||
| HAL_StatusTypeDef HAL_RAMECC_DisableNotification(RAMECC_HandleTypeDef *hramecc, uint32_t Notifications); | |||
| void HAL_RAMECC_IRQHandler(RAMECC_HandleTypeDef *hramecc); | |||
| HAL_StatusTypeDef HAL_RAMECC_RegisterCallback(RAMECC_HandleTypeDef *hramecc, void (* pCallback)(RAMECC_HandleTypeDef *_hramecc)); | |||
| HAL_StatusTypeDef HAL_RAMECC_UnRegisterCallback(RAMECC_HandleTypeDef *hramecc); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup RAMECC_Exported_Functions_Group3 Error informations functions | |||
| * @brief Error informations functions | |||
| * @{ | |||
| */ | |||
| uint32_t HAL_RAMECC_GetFailingAddress(RAMECC_HandleTypeDef *hramecc); | |||
| uint32_t HAL_RAMECC_GetFailingDataLow(RAMECC_HandleTypeDef *hramecc); | |||
| uint32_t HAL_RAMECC_GetFailingDataHigh(RAMECC_HandleTypeDef *hramecc); | |||
| uint32_t HAL_RAMECC_GetHammingErrorCode(RAMECC_HandleTypeDef *hramecc); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private Constants -------------------------------------------------------------*/ | |||
| /** @defgroup RAMECC_Private_Constants RAMECC Private Constants | |||
| * @brief RAMECC private defines and constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup RAMECC_Private_Macros RAMECC Private Macros | |||
| * @brief RAMECC private macros | |||
| * @{ | |||
| */ | |||
| #define IS_RAMECC_GLOBAL_INTERRUPT(INTERRUPT) ((((INTERRUPT) & RAMECC_IT_GLOBAL_ENABLE) == RAMECC_IT_GLOBAL_ENABLE) || \ | |||
| (((INTERRUPT) & RAMECC_IT_GLOBAL_SINGLEERR_R) == RAMECC_IT_GLOBAL_SINGLEERR_R) || \ | |||
| (((INTERRUPT) & RAMECC_IT_GLOBAL_DOUBLEERR_R) == RAMECC_IT_GLOBAL_DOUBLEERR_R) || \ | |||
| (((INTERRUPT) & RAMECC_IT_GLOBAL_DOUBLEERR_W) == RAMECC_IT_GLOBAL_DOUBLEERR_W) || \ | |||
| (((INTERRUPT) & RAMECC_IT_GLOBAL_ALL) == RAMECC_IT_GLOBAL_ALL)) | |||
| #define IS_RAMECC_MONITOR_INTERRUPT(INTERRUPT) ((((INTERRUPT) & RAMECC_IT_MONITOR_SINGLEERR_R) == RAMECC_IT_MONITOR_SINGLEERR_R) || \ | |||
| (((INTERRUPT) & RAMECC_IT_MONITOR_DOUBLEERR_R) == RAMECC_IT_MONITOR_DOUBLEERR_R) || \ | |||
| (((INTERRUPT) & RAMECC_IT_MONITOR_DOUBLEERR_W) == RAMECC_IT_MONITOR_DOUBLEERR_W) || \ | |||
| (((INTERRUPT) & RAMECC_IT_MONITOR_ALL) == RAMECC_IT_MONITOR_ALL)) | |||
| #define IS_RAMECC_INTERRUPT(INTERRUPT) ((IS_RAMECC_GLOBAL_INTERRUPT(INTERRUPT)) || \ | |||
| (IS_RAMECC_MONITOR_INTERRUPT(INTERRUPT))) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup RAMECC_FLAG RAMECC Monitor flags | |||
| * @{ | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup RAMECC_Private_Functions RAMECC Private Functions | |||
| * @brief RAMECC private functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* STM32H7xx_HAL_RAMECC_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_rng.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of RNG HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_RNG_H | |||
| #define __STM32H7xx_HAL_RNG_H | |||
| #ifndef STM32H7xx_HAL_RNG_H | |||
| #define STM32H7xx_HAL_RNG_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -50,7 +32,9 @@ | |||
| * @{ | |||
| */ | |||
| /** @addtogroup RNG RNG | |||
| #if defined (RNG) | |||
| /** @defgroup RNG RNG | |||
| * @brief RNG HAL module driver | |||
| * @{ | |||
| */ | |||
| @@ -67,8 +51,11 @@ | |||
| typedef struct | |||
| { | |||
| uint32_t ClockErrorDetection; /*!< CED Clock error detection */ | |||
| } RNG_InitTypeDef; | |||
| }RNG_InitTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup RNG_Exported_Types_Group2 RNG State Structure definition | |||
| * @{ | |||
| @@ -81,7 +68,7 @@ typedef enum | |||
| HAL_RNG_STATE_TIMEOUT = 0x03U, /*!< RNG timeout state */ | |||
| HAL_RNG_STATE_ERROR = 0x04U /*!< RNG error state */ | |||
| }HAL_RNG_StateTypeDef; | |||
| } HAL_RNG_StateTypeDef; | |||
| /** | |||
| * @} | |||
| @@ -90,19 +77,54 @@ typedef enum | |||
| /** @defgroup RNG_Exported_Types_Group3 RNG Handle Structure definition | |||
| * @{ | |||
| */ | |||
| #if (USE_HAL_RNG_REGISTER_CALLBACKS == 1) | |||
| typedef struct __RNG_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* (USE_HAL_RNG_REGISTER_CALLBACKS) */ | |||
| { | |||
| RNG_TypeDef *Instance; /*!< Register base address */ | |||
| RNG_InitTypeDef Init; /*!< RNG parameters */ | |||
| RNG_InitTypeDef Init; /*!< RNG configuration parameters */ | |||
| HAL_LockTypeDef Lock; /*!< RNG locking object */ | |||
| __IO HAL_RNG_StateTypeDef State; /*!< RNG communication state */ | |||
| __IO uint32_t ErrorCode; /*!< RNG Error code */ | |||
| uint32_t RandomNumber; /*!< Last Generated RNG Data */ | |||
| }RNG_HandleTypeDef; | |||
| #if (USE_HAL_RNG_REGISTER_CALLBACKS == 1) | |||
| void (* ReadyDataCallback)(struct __RNG_HandleTypeDef *hrng, uint32_t random32bit); /*!< RNG Data Ready Callback */ | |||
| void (* ErrorCallback)(struct __RNG_HandleTypeDef *hrng); /*!< RNG Error Callback */ | |||
| void (* MspInitCallback)(struct __RNG_HandleTypeDef *hrng); /*!< RNG Msp Init callback */ | |||
| void (* MspDeInitCallback)(struct __RNG_HandleTypeDef *hrng); /*!< RNG Msp DeInit callback */ | |||
| #endif /* USE_HAL_RNG_REGISTER_CALLBACKS */ | |||
| } RNG_HandleTypeDef; | |||
| #if (USE_HAL_RNG_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL RNG Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_RNG_ERROR_CB_ID = 0x00U, /*!< RNG Error Callback ID */ | |||
| HAL_RNG_MSPINIT_CB_ID = 0x01U, /*!< RNG MspInit callback ID */ | |||
| HAL_RNG_MSPDEINIT_CB_ID = 0x02U /*!< RNG MspDeInit callback ID */ | |||
| } HAL_RNG_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL RNG Callback pointer definition | |||
| */ | |||
| typedef void (*pRNG_CallbackTypeDef)(RNG_HandleTypeDef *hrng); /*!< pointer to a common RNG callback function */ | |||
| typedef void (*pRNG_ReadyDataCallbackTypeDef)(RNG_HandleTypeDef *hrng, uint32_t random32bit); /*!< pointer to an RNG Data Ready specific callback function */ | |||
| #endif /* USE_HAL_RNG_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| @@ -113,7 +135,6 @@ typedef struct | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup RNG_Exported_Constants RNG Exported Constants | |||
| * @{ | |||
| */ | |||
| @@ -134,7 +155,6 @@ typedef struct | |||
| #define RNG_FLAG_DRDY RNG_SR_DRDY /*!< Data ready */ | |||
| #define RNG_FLAG_CECS RNG_SR_CECS /*!< Clock error current status */ | |||
| #define RNG_FLAG_SECS RNG_SR_SECS /*!< Seed error current status */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -142,8 +162,20 @@ typedef struct | |||
| /** @defgroup RNG_Exported_Constants_Group3 RNG Clock Error Detection | |||
| * @{ | |||
| */ | |||
| #define RNG_CED_ENABLE ((uint32_t)0x00000000) /*!< Clock error detection Enabled*/ | |||
| #define RNG_CED_DISABLE RNG_CR_CED /*!< Clock error detection Disabled*/ | |||
| #define RNG_CED_ENABLE 0x00000000U /*!< Clock error detection Enabled */ | |||
| #define RNG_CED_DISABLE RNG_CR_CED /*!< Clock error detection Disabled */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup RNG_Error_Definition RNG Error Definition | |||
| * @{ | |||
| */ | |||
| #define HAL_RNG_ERROR_NONE 0x00000000U /*!< No error */ | |||
| #if (USE_HAL_RNG_REGISTER_CALLBACKS == 1) | |||
| #define HAL_RNG_ERROR_INVALID_CALLBACK 0x00000001U /*!< Invalid Callback error */ | |||
| #endif /* USE_HAL_RNG_REGISTER_CALLBACKS */ | |||
| #define HAL_RNG_ERROR_TIMEOUT 0x00000002U /*!< Timeout error */ | |||
| /** | |||
| * @} | |||
| @@ -154,73 +186,78 @@ typedef struct | |||
| */ | |||
| /* Exported macros -----------------------------------------------------------*/ | |||
| /** @defgroup RNG_Exported_Macros RNG Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @brief Reset RNG handle state | |||
| * @param __HANDLE__: RNG Handle | |||
| * @param __HANDLE__ RNG Handle | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_RNG_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_RNG_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->State = HAL_RNG_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0U) | |||
| #else | |||
| #define __HAL_RNG_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RNG_STATE_RESET) | |||
| #endif /*USE_HAL_RNG_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @brief Enables the RNG peripheral. | |||
| * @param __HANDLE__: RNG Handle | |||
| * @param __HANDLE__ RNG Handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RNG_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= RNG_CR_RNGEN) | |||
| /** | |||
| * @brief Disables the RNG peripheral. | |||
| * @param __HANDLE__: RNG Handle | |||
| * @param __HANDLE__ RNG Handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RNG_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~RNG_CR_RNGEN) | |||
| /** | |||
| * @brief Check the selected RNG flag status. | |||
| * @param __HANDLE__: RNG Handle | |||
| * @param __FLAG__: RNG flag | |||
| * @param __HANDLE__ RNG Handle | |||
| * @param __FLAG__ RNG flag | |||
| * This parameter can be one of the following values: | |||
| * @arg RNG_FLAG_DRDY: Data ready | |||
| * @arg RNG_FLAG_CECS: Clock error current status | |||
| * @arg RNG_FLAG_SECS: Seed error current status | |||
| * @arg RNG_FLAG_DRDY: Data ready | |||
| * @arg RNG_FLAG_CECS: Clock error current status | |||
| * @arg RNG_FLAG_SECS: Seed error current status | |||
| * @retval The new state of __FLAG__ (SET or RESET). | |||
| */ | |||
| #define __HAL_RNG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) | |||
| /** | |||
| * @brief Clears the selected RNG flag status. | |||
| * @param __HANDLE__: RNG handle | |||
| * @param __FLAG__: RNG flag to clear | |||
| * @param __HANDLE__ RNG handle | |||
| * @param __FLAG__ RNG flag to clear | |||
| * @note WARNING: This is a dummy macro for HAL code alignment, | |||
| * flags RNG_FLAG_DRDY, RNG_FLAG_CECS and RNG_FLAG_SECS are read-only. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RNG_CLEAR_FLAG(__HANDLE__, __FLAG__) /* dummy macro */ | |||
| /** | |||
| * @brief Enables the RNG interrupts. | |||
| * @param __HANDLE__: RNG Handle | |||
| * @param __HANDLE__ RNG Handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RNG_ENABLE_IT(__HANDLE__) ((__HANDLE__)->Instance->CR |= RNG_CR_IE) | |||
| /** | |||
| * @brief Disables the RNG interrupts. | |||
| * @param __HANDLE__: RNG Handle | |||
| * @param __HANDLE__ RNG Handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RNG_DISABLE_IT(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~RNG_CR_IE) | |||
| /** | |||
| * @brief Checks whether the specified RNG interrupt has occurred or not. | |||
| * @param __HANDLE__: RNG Handle | |||
| * @param __INTERRUPT__: specifies the RNG interrupt status flag to check. | |||
| * @param __HANDLE__ RNG Handle | |||
| * @param __INTERRUPT__ specifies the RNG interrupt status flag to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg RNG_IT_DRDY: Data ready interrupt | |||
| * @arg RNG_IT_CEI: Clock error interrupt | |||
| @@ -231,8 +268,8 @@ typedef struct | |||
| /** | |||
| * @brief Clear the RNG interrupt status flags. | |||
| * @param __HANDLE__: RNG Handle | |||
| * @param __INTERRUPT__: specifies the RNG interrupt status flag to clear. | |||
| * @param __HANDLE__ RNG Handle | |||
| * @param __INTERRUPT__ specifies the RNG interrupt status flag to clear. | |||
| * This parameter can be one of the following values: | |||
| * @arg RNG_IT_CEI: Clock error interrupt | |||
| * @arg RNG_IT_SEI: Seed error interrupt | |||
| @@ -250,14 +287,23 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| /** @defgroup RNG_Exported_Functions_Group1 Initialization and de-initialization functions | |||
| /** @defgroup RNG_Exported_Functions_Group1 Initialization and configuration functions | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_RNG_Init(RNG_HandleTypeDef *hrng); | |||
| HAL_StatusTypeDef HAL_RNG_DeInit (RNG_HandleTypeDef *hrng); | |||
| HAL_StatusTypeDef HAL_RNG_DeInit(RNG_HandleTypeDef *hrng); | |||
| void HAL_RNG_MspInit(RNG_HandleTypeDef *hrng); | |||
| void HAL_RNG_MspDeInit(RNG_HandleTypeDef *hrng); | |||
| /* Callbacks Register/UnRegister functions ***********************************/ | |||
| #if (USE_HAL_RNG_REGISTER_CALLBACKS == 1) | |||
| HAL_StatusTypeDef HAL_RNG_RegisterCallback(RNG_HandleTypeDef *hrng, HAL_RNG_CallbackIDTypeDef CallbackID, pRNG_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_RNG_UnRegisterCallback(RNG_HandleTypeDef *hrng, HAL_RNG_CallbackIDTypeDef CallbackID); | |||
| HAL_StatusTypeDef HAL_RNG_RegisterReadyDataCallback(RNG_HandleTypeDef *hrng, pRNG_ReadyDataCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_RNG_UnRegisterReadyDataCallback(RNG_HandleTypeDef *hrng); | |||
| #endif /* USE_HAL_RNG_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -265,14 +311,13 @@ void HAL_RNG_MspDeInit(RNG_HandleTypeDef *hrng); | |||
| /** @defgroup RNG_Exported_Functions_Group2 Peripheral Control functions | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_RNG_GenerateRandomNumber(RNG_HandleTypeDef *hrng, uint32_t *random32bit); | |||
| HAL_StatusTypeDef HAL_RNG_GenerateRandomNumber_IT(RNG_HandleTypeDef *hrng); | |||
| uint32_t HAL_RNG_ReadLastRandomNumber(RNG_HandleTypeDef *hrng); | |||
| void HAL_RNG_IRQHandler(RNG_HandleTypeDef *hrng); | |||
| void HAL_RNG_ErrorCallback(RNG_HandleTypeDef *hrng); | |||
| void HAL_RNG_ReadyDataCallback(RNG_HandleTypeDef* hrng, uint32_t random32bit); | |||
| void HAL_RNG_ReadyDataCallback(RNG_HandleTypeDef *hrng, uint32_t random32bit); | |||
| /** | |||
| * @} | |||
| @@ -282,47 +327,11 @@ void HAL_RNG_ReadyDataCallback(RNG_HandleTypeDef* hrng, uint32_t random32bit); | |||
| * @{ | |||
| */ | |||
| HAL_RNG_StateTypeDef HAL_RNG_GetState(RNG_HandleTypeDef *hrng); | |||
| /** | |||
| * @} | |||
| */ | |||
| uint32_t HAL_RNG_GetError(RNG_HandleTypeDef *hrng); | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /** @defgroup RNG_Private_Types RNG Private Types | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private defines -----------------------------------------------------------*/ | |||
| /** @defgroup RNG_Private_Defines RNG Private Defines | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /** @defgroup RNG_Private_Variables RNG Private Variables | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup RNG_Private_Constants RNG Private Constants | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -335,49 +344,35 @@ HAL_RNG_StateTypeDef HAL_RNG_GetState(RNG_HandleTypeDef *hrng); | |||
| ((IT) == RNG_IT_SEI)) | |||
| #define IS_RNG_FLAG(FLAG) (((FLAG) == RNG_FLAG_DRDY) || \ | |||
| ((FLAG) == RNG_FLAG_CECS) || \ | |||
| ((FLAG) == RNG_FLAG_SECS)) | |||
| ((FLAG) == RNG_FLAG_CECS) || \ | |||
| ((FLAG) == RNG_FLAG_SECS)) | |||
| #define IS_RNG_CED(CED) (((CED) == RNG_CED_ENABLE) || \ | |||
| ((CED) == RNG_CED_DISABLE)) | |||
| /** | |||
| * @} | |||
| * @brief Verify the RNG Clock Error Detection mode. | |||
| * @param __MODE__ RNG Clock Error Detection mode | |||
| * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) | |||
| */ | |||
| /* Private functions prototypes ----------------------------------------------*/ | |||
| /** @defgroup RNG_Private_Functions_Prototypes RNG Private Functions Prototypes | |||
| * @{ | |||
| */ | |||
| #define IS_RNG_CED(__MODE__) (((__MODE__) == RNG_CED_ENABLE) || \ | |||
| ((__MODE__) == RNG_CED_DISABLE)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** @defgroup RNG_Private_Functions RNG Private Functions | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* RNG */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_RNG_H */ | |||
| #endif /* STM32H7xx_HAL_RNG_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_rtc.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of RTC HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_RTC_H | |||
| #define __STM32H7xx_HAL_RTC_H | |||
| #ifndef STM32H7xx_HAL_RTC_H | |||
| #define STM32H7xx_HAL_RTC_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -63,11 +45,11 @@ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_RTC_STATE_RESET = 0x00, /*!< RTC not yet initialized or disabled */ | |||
| HAL_RTC_STATE_READY = 0x01, /*!< RTC initialized and ready for use */ | |||
| HAL_RTC_STATE_BUSY = 0x02, /*!< RTC process is ongoing */ | |||
| HAL_RTC_STATE_TIMEOUT = 0x03, /*!< RTC timeout state */ | |||
| HAL_RTC_STATE_ERROR = 0x04 /*!< RTC error state */ | |||
| HAL_RTC_STATE_RESET = 0x00u, /*!< RTC not yet initialized or disabled */ | |||
| HAL_RTC_STATE_READY = 0x01u, /*!< RTC initialized and ready for use */ | |||
| HAL_RTC_STATE_BUSY = 0x02u, /*!< RTC process is ongoing */ | |||
| HAL_RTC_STATE_TIMEOUT = 0x03u, /*!< RTC timeout state */ | |||
| HAL_RTC_STATE_ERROR = 0x04u /*!< RTC error state */ | |||
| }HAL_RTCStateTypeDef; | |||
| @@ -130,7 +112,7 @@ typedef struct | |||
| uint32_t DayLightSaving; /*!< Specifies RTC_DayLightSaveOperation: the value of hour adjustment. | |||
| This parameter can be a value of @ref RTC_DayLightSaving_Definitions */ | |||
| uint32_t StoreOperation; /*!< Specifies RTC_StoreOperation value to be written in the BCK bit | |||
| uint32_t StoreOperation; /*!< Specifies RTC_StoreOperation value to be written in the BKP bit | |||
| in CR register to store the operation. | |||
| This parameter can be a value of @ref RTC_StoreOperation_Definitions */ | |||
| }RTC_TimeTypeDef; | |||
| @@ -179,9 +161,13 @@ typedef struct | |||
| }RTC_AlarmTypeDef; | |||
| /** | |||
| * @brief Time Handle Structure definition | |||
| * @brief RTC Handle Structure definition | |||
| */ | |||
| #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) | |||
| typedef struct __RTC_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* (USE_HAL_RTC_REGISTER_CALLBACKS) */ | |||
| { | |||
| RTC_TypeDef *Instance; /*!< Register base address */ | |||
| @@ -191,8 +177,52 @@ typedef struct | |||
| __IO HAL_RTCStateTypeDef State; /*!< Time communication state */ | |||
| #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) | |||
| void (* AlarmAEventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Alarm A Event callback */ | |||
| void (* AlarmBEventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Alarm B Event callback */ | |||
| void (* TimeStampEventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC TimeStamp Event callback */ | |||
| void (* WakeUpTimerEventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC WakeUpTimer Event callback */ | |||
| void (* Tamper1EventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Tamper 1 Event callback */ | |||
| void (* Tamper2EventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Tamper 2 Event callback */ | |||
| void (* Tamper3EventCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Tamper 3 Event callback */ | |||
| void (* MspInitCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Msp Init callback */ | |||
| void (* MspDeInitCallback) ( struct __RTC_HandleTypeDef * hrtc); /*!< RTC Msp DeInit callback */ | |||
| #endif /* (USE_HAL_RTC_REGISTER_CALLBACKS) */ | |||
| }RTC_HandleTypeDef; | |||
| #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL RTC Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_RTC_ALARM_A_EVENT_CB_ID = 0x00u, /*!< RTC Alarm A Event Callback ID */ | |||
| HAL_RTC_ALARM_B_EVENT_CB_ID = 0x01u, /*!< RTC Alarm B Event Callback ID */ | |||
| HAL_RTC_TIMESTAMP_EVENT_CB_ID = 0x02u, /*!< RTC TimeStamp Event Callback ID */ | |||
| HAL_RTC_WAKEUPTIMER_EVENT_CB_ID = 0x03u, /*!< RTC WakeUp Timer Event Callback ID */ | |||
| HAL_RTC_TAMPER1_EVENT_CB_ID = 0x04u, /*!< RTC Tamper 1 Callback ID */ | |||
| HAL_RTC_TAMPER2_EVENT_CB_ID = 0x05u, /*!< RTC Tamper 2 Callback ID */ | |||
| HAL_RTC_TAMPER3_EVENT_CB_ID = 0x06u, /*!< RTC Tamper 3 Callback ID */ | |||
| HAL_RTC_MSPINIT_CB_ID = 0x0Eu, /*!< RTC Msp Init callback ID */ | |||
| HAL_RTC_MSPDEINIT_CB_ID = 0x0Fu /*!< RTC Msp DeInit callback ID */ | |||
| }HAL_RTC_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL RTC Callback pointer definition | |||
| */ | |||
| typedef void (*pRTC_CallbackTypeDef)(RTC_HandleTypeDef * hrtc); /*!< pointer to an RTC callback function */ | |||
| #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -205,8 +235,8 @@ typedef struct | |||
| /** @defgroup RTC_Hour_Formats RTC Hour Formats | |||
| * @{ | |||
| */ | |||
| #define RTC_HOURFORMAT_24 ((uint32_t)0x00000000) | |||
| #define RTC_HOURFORMAT_12 ((uint32_t)0x00000040) | |||
| #define RTC_HOURFORMAT_24 0x00000000u | |||
| #define RTC_HOURFORMAT_12 RTC_CR_FMT | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -214,8 +244,8 @@ typedef struct | |||
| /** @defgroup RTC_Output_Polarity_Definitions RTC Output Polarity Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_OUTPUT_POLARITY_HIGH ((uint32_t)0x00000000) | |||
| #define RTC_OUTPUT_POLARITY_LOW ((uint32_t)0x00100000) | |||
| #define RTC_OUTPUT_POLARITY_HIGH 0x00000000u | |||
| #define RTC_OUTPUT_POLARITY_LOW RTC_CR_POL | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -223,8 +253,8 @@ typedef struct | |||
| /** @defgroup RTC_Output_Type_ALARM_OUT RTC Output Type ALARM OUT | |||
| * @{ | |||
| */ | |||
| #define RTC_OUTPUT_TYPE_OPENDRAIN ((uint32_t)0x00000000) | |||
| #define RTC_OUTPUT_TYPE_PUSHPULL ((uint32_t)RTC_OR_ALARMOUTTYPE) | |||
| #define RTC_OUTPUT_TYPE_OPENDRAIN 0x00000000u | |||
| #define RTC_OUTPUT_TYPE_PUSHPULL RTC_OR_ALARMOUTTYPE | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -232,8 +262,8 @@ typedef struct | |||
| /** @defgroup RTC_Output_ALARM_OUT_Remap RTC Output ALARM OUT Remap | |||
| * @{ | |||
| */ | |||
| #define RTC_OUTPUT_REMAP_NONE ((uint32_t)0x00000000) | |||
| #define RTC_OUTPUT_REMAP_POS1 ((uint32_t)RTC_OR_OUT_RMP) | |||
| #define RTC_OUTPUT_REMAP_NONE 0x00000000u | |||
| #define RTC_OUTPUT_REMAP_POS1 RTC_OR_OUT_RMP | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -242,7 +272,7 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| #define RTC_HOURFORMAT12_AM ((uint8_t)0x00) | |||
| #define RTC_HOURFORMAT12_PM ((uint8_t)0x40) | |||
| #define RTC_HOURFORMAT12_PM ((uint8_t)0x01) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -250,9 +280,9 @@ typedef struct | |||
| /** @defgroup RTC_DayLightSaving_Definitions RTC DayLight Saving Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_DAYLIGHTSAVING_SUB1H ((uint32_t)0x00020000) | |||
| #define RTC_DAYLIGHTSAVING_ADD1H ((uint32_t)0x00010000) | |||
| #define RTC_DAYLIGHTSAVING_NONE ((uint32_t)0x00000000) | |||
| #define RTC_DAYLIGHTSAVING_SUB1H RTC_CR_SUB1H | |||
| #define RTC_DAYLIGHTSAVING_ADD1H RTC_CR_ADD1H | |||
| #define RTC_DAYLIGHTSAVING_NONE 0x00000000u | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -260,8 +290,8 @@ typedef struct | |||
| /** @defgroup RTC_StoreOperation_Definitions RTC Store Operation Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_STOREOPERATION_RESET ((uint32_t)0x00000000) | |||
| #define RTC_STOREOPERATION_SET ((uint32_t)0x00040000) | |||
| #define RTC_STOREOPERATION_RESET 0x00000000u | |||
| #define RTC_STOREOPERATION_SET RTC_CR_BKP | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -269,17 +299,15 @@ typedef struct | |||
| /** @defgroup RTC_Input_parameter_format_definitions RTC Input Parameter Format Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_FORMAT_BIN ((uint32_t)0x00000000) | |||
| #define RTC_FORMAT_BCD ((uint32_t)0x00000001) | |||
| #define RTC_FORMAT_BIN 0x00000000u | |||
| #define RTC_FORMAT_BCD 0x00000001u | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup RTC_Month_Date_Definitions RTC Month Date Definitions | |||
| /** @defgroup RTC_Month_Date_Definitions RTC Month Date Definitions (in BCD format) | |||
| * @{ | |||
| */ | |||
| /* Coded in BCD format */ | |||
| #define RTC_MONTH_JANUARY ((uint8_t)0x01) | |||
| #define RTC_MONTH_FEBRUARY ((uint8_t)0x02) | |||
| #define RTC_MONTH_MARCH ((uint8_t)0x03) | |||
| @@ -299,13 +327,13 @@ typedef struct | |||
| /** @defgroup RTC_WeekDay_Definitions RTC WeekDay Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_WEEKDAY_MONDAY ((uint8_t)0x01) | |||
| #define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02) | |||
| #define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03) | |||
| #define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04) | |||
| #define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05) | |||
| #define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06) | |||
| #define RTC_WEEKDAY_SUNDAY ((uint8_t)0x07) | |||
| #define RTC_WEEKDAY_MONDAY ((uint8_t)0x01) | |||
| #define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02) | |||
| #define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03) | |||
| #define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04) | |||
| #define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05) | |||
| #define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06) | |||
| #define RTC_WEEKDAY_SUNDAY ((uint8_t)0x07) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -313,8 +341,8 @@ typedef struct | |||
| /** @defgroup RTC_AlarmDateWeekDay_Definitions RTC Alarm Date WeekDay Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_ALARMDATEWEEKDAYSEL_DATE ((uint32_t)0x00000000) | |||
| #define RTC_ALARMDATEWEEKDAYSEL_WEEKDAY ((uint32_t)0x40000000) | |||
| #define RTC_ALARMDATEWEEKDAYSEL_DATE 0x00000000u | |||
| #define RTC_ALARMDATEWEEKDAYSEL_WEEKDAY RTC_ALRMAR_WDSEL | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -323,12 +351,15 @@ typedef struct | |||
| /** @defgroup RTC_AlarmMask_Definitions RTC Alarm Mask Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_ALARMMASK_NONE ((uint32_t)0x00000000) | |||
| #define RTC_ALARMMASK_NONE 0x00000000u | |||
| #define RTC_ALARMMASK_DATEWEEKDAY RTC_ALRMAR_MSK4 | |||
| #define RTC_ALARMMASK_HOURS RTC_ALRMAR_MSK3 | |||
| #define RTC_ALARMMASK_MINUTES RTC_ALRMAR_MSK2 | |||
| #define RTC_ALARMMASK_SECONDS RTC_ALRMAR_MSK1 | |||
| #define RTC_ALARMMASK_ALL ((uint32_t)0x80808080) | |||
| #define RTC_ALARMMASK_ALL (RTC_ALARMMASK_DATEWEEKDAY | \ | |||
| RTC_ALARMMASK_HOURS | \ | |||
| RTC_ALARMMASK_MINUTES | \ | |||
| RTC_ALARMMASK_SECONDS) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -345,39 +376,39 @@ typedef struct | |||
| /** @defgroup RTC_Alarm_Sub_Seconds_Masks_Definitions RTC Alarm Sub Seconds Masks Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_ALARMSUBSECONDMASK_ALL ((uint32_t)0x00000000) /*!< All Alarm SS fields are masked. | |||
| There is no comparison on sub seconds | |||
| for Alarm */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_1 ((uint32_t)0x01000000) /*!< SS[14:1] are don't care in Alarm | |||
| comparison. Only SS[0] is compared. */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_2 ((uint32_t)0x02000000) /*!< SS[14:2] are don't care in Alarm | |||
| comparison. Only SS[1:0] are compared */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_3 ((uint32_t)0x03000000) /*!< SS[14:3] are don't care in Alarm | |||
| comparison. Only SS[2:0] are compared */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_4 ((uint32_t)0x04000000) /*!< SS[14:4] are don't care in Alarm | |||
| comparison. Only SS[3:0] are compared */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_5 ((uint32_t)0x05000000) /*!< SS[14:5] are don't care in Alarm | |||
| comparison. Only SS[4:0] are compared */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_6 ((uint32_t)0x06000000) /*!< SS[14:6] are don't care in Alarm | |||
| comparison. Only SS[5:0] are compared */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_7 ((uint32_t)0x07000000) /*!< SS[14:7] are don't care in Alarm | |||
| comparison. Only SS[6:0] are compared */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_8 ((uint32_t)0x08000000) /*!< SS[14:8] are don't care in Alarm | |||
| comparison. Only SS[7:0] are compared */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_9 ((uint32_t)0x09000000) /*!< SS[14:9] are don't care in Alarm | |||
| comparison. Only SS[8:0] are compared */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_10 ((uint32_t)0x0A000000) /*!< SS[14:10] are don't care in Alarm | |||
| comparison. Only SS[9:0] are compared */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_11 ((uint32_t)0x0B000000) /*!< SS[14:11] are don't care in Alarm | |||
| comparison. Only SS[10:0] are compared */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_12 ((uint32_t)0x0C000000) /*!< SS[14:12] are don't care in Alarm | |||
| comparison.Only SS[11:0] are compared */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_13 ((uint32_t)0x0D000000) /*!< SS[14:13] are don't care in Alarm | |||
| comparison. Only SS[12:0] are compared */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14 ((uint32_t)0x0E000000) /*!< SS[14] is don't care in Alarm | |||
| comparison.Only SS[13:0] are compared */ | |||
| #define RTC_ALARMSUBSECONDMASK_NONE ((uint32_t)0x0F000000) /*!< SS[14:0] are compared and must match | |||
| to activate alarm. */ | |||
| /*!< All Alarm SS fields are masked. There is no comparison on sub seconds for Alarm */ | |||
| #define RTC_ALARMSUBSECONDMASK_ALL 0x00000000u | |||
| /*!< SS[14:1] are don't care in Alarm comparison. Only SS[0] is compared. */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_1 RTC_ALRMASSR_MASKSS_0 | |||
| /*!< SS[14:2] are don't care in Alarm comparison. Only SS[1:0] are compared. */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_2 RTC_ALRMASSR_MASKSS_1 | |||
| /*!< SS[14:3] are don't care in Alarm comparison. Only SS[2:0] are compared. */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_3 (RTC_ALRMASSR_MASKSS_0 | RTC_ALRMASSR_MASKSS_1) | |||
| /*!< SS[14:4] are don't care in Alarm comparison. Only SS[3:0] are compared. */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_4 RTC_ALRMASSR_MASKSS_2 | |||
| /*!< SS[14:5] are don't care in Alarm comparison. Only SS[4:0] are compared. */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_5 (RTC_ALRMASSR_MASKSS_0 | RTC_ALRMASSR_MASKSS_2) | |||
| /*!< SS[14:6] are don't care in Alarm comparison. Only SS[5:0] are compared. */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_6 (RTC_ALRMASSR_MASKSS_1 | RTC_ALRMASSR_MASKSS_2) | |||
| /*!< SS[14:7] are don't care in Alarm comparison. Only SS[6:0] are compared. */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_7 (RTC_ALRMASSR_MASKSS_0 | RTC_ALRMASSR_MASKSS_1 | RTC_ALRMASSR_MASKSS_2) | |||
| /*!< SS[14:8] are don't care in Alarm comparison. Only SS[7:0] are compared. */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_8 RTC_ALRMASSR_MASKSS_3 | |||
| /*!< SS[14:9] are don't care in Alarm comparison. Only SS[8:0] are compared. */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_9 (RTC_ALRMASSR_MASKSS_0 | RTC_ALRMASSR_MASKSS_3) | |||
| /*!< SS[14:10] are don't care in Alarm comparison. Only SS[9:0] are compared. */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_10 (RTC_ALRMASSR_MASKSS_1 | RTC_ALRMASSR_MASKSS_3) | |||
| /*!< SS[14:11] are don't care in Alarm comparison. Only SS[10:0] are compared. */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_11 (RTC_ALRMASSR_MASKSS_0 | RTC_ALRMASSR_MASKSS_1 | RTC_ALRMASSR_MASKSS_3) | |||
| /*!< SS[14:12] are don't care in Alarm comparison. Only SS[11:0] are compared. */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_12 (RTC_ALRMASSR_MASKSS_2 | RTC_ALRMASSR_MASKSS_3) | |||
| /*!< SS[14:13] are don't care in Alarm comparison. Only SS[12:0] are compared. */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14_13 (RTC_ALRMASSR_MASKSS_0 | RTC_ALRMASSR_MASKSS_2 | RTC_ALRMASSR_MASKSS_3) | |||
| /*!< SS[14] is don't care in Alarm comparison. Only SS[13:0] are compared. */ | |||
| #define RTC_ALARMSUBSECONDMASK_SS14 (RTC_ALRMASSR_MASKSS_1 | RTC_ALRMASSR_MASKSS_2 | RTC_ALRMASSR_MASKSS_3) | |||
| /*!< SS[14:0] are compared and must match to activate alarm. */ | |||
| #define RTC_ALARMSUBSECONDMASK_NONE RTC_ALRMASSR_MASKSS | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -385,14 +416,14 @@ typedef struct | |||
| /** @defgroup RTC_Interrupts_Definitions RTC Interrupts Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_IT_TS ((uint32_t)RTC_CR_TSIE) /*!< Enable Timestamp Interrupt */ | |||
| #define RTC_IT_WUT ((uint32_t)RTC_CR_WUTIE) /*!< Enable Wakeup timer Interrupt */ | |||
| #define RTC_IT_ALRA ((uint32_t)RTC_CR_ALRAIE) /*!< Enable Alarm A Interrupt */ | |||
| #define RTC_IT_ALRB ((uint32_t)RTC_CR_ALRBIE) /*!< Enable Alarm B Interrupt */ | |||
| #define RTC_IT_TAMP ((uint32_t)RTC_TAMPCR_TAMPIE) /*!< Enable all Tamper Interrupt */ | |||
| #define RTC_IT_TAMP1 ((uint32_t)RTC_TAMPCR_TAMP1IE) /*!< Enable Tamper 1 Interrupt */ | |||
| #define RTC_IT_TAMP2 ((uint32_t)RTC_TAMPCR_TAMP2IE) /*!< Enable Tamper 2 Interrupt */ | |||
| #define RTC_IT_TAMP3 ((uint32_t)RTC_TAMPCR_TAMP3IE) /*!< Enable Tamper 3 Interrupt */ | |||
| #define RTC_IT_TS RTC_CR_TSIE /*!< Enable Timestamp Interrupt */ | |||
| #define RTC_IT_WUT RTC_CR_WUTIE /*!< Enable Wakeup timer Interrupt */ | |||
| #define RTC_IT_ALRA RTC_CR_ALRAIE /*!< Enable Alarm A Interrupt */ | |||
| #define RTC_IT_ALRB RTC_CR_ALRBIE /*!< Enable Alarm B Interrupt */ | |||
| #define RTC_IT_TAMP RTC_TAMPCR_TAMPIE /*!< Enable all Tamper Interrupt */ | |||
| #define RTC_IT_TAMP1 RTC_TAMPCR_TAMP1IE /*!< Enable Tamper 1 Interrupt */ | |||
| #define RTC_IT_TAMP2 RTC_TAMPCR_TAMP2IE /*!< Enable Tamper 2 Interrupt */ | |||
| #define RTC_IT_TAMP3 RTC_TAMPCR_TAMP3IE /*!< Enable Tamper 3 Interrupt */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -400,23 +431,23 @@ typedef struct | |||
| /** @defgroup RTC_Flags_Definitions RTC Flags Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_FLAG_RECALPF ((uint32_t)RTC_ISR_RECALPF) | |||
| #define RTC_FLAG_TAMP3F ((uint32_t)RTC_ISR_TAMP3F) | |||
| #define RTC_FLAG_TAMP2F ((uint32_t)RTC_ISR_TAMP2F) | |||
| #define RTC_FLAG_TAMP1F ((uint32_t)RTC_ISR_TAMP1F) | |||
| #define RTC_FLAG_TSOVF ((uint32_t)RTC_ISR_TSOVF) | |||
| #define RTC_FLAG_TSF ((uint32_t)RTC_ISR_TSF) | |||
| #define RTC_FLAG_ITSF ((uint32_t)RTC_ISR_ITSF) | |||
| #define RTC_FLAG_WUTF ((uint32_t)RTC_ISR_WUTF) | |||
| #define RTC_FLAG_ALRBF ((uint32_t)RTC_ISR_ALRBF) | |||
| #define RTC_FLAG_ALRAF ((uint32_t)RTC_ISR_ALRAF) | |||
| #define RTC_FLAG_INITF ((uint32_t)RTC_ISR_INITF) | |||
| #define RTC_FLAG_RSF ((uint32_t)RTC_ISR_RSF) | |||
| #define RTC_FLAG_INITS ((uint32_t)RTC_ISR_INITS) | |||
| #define RTC_FLAG_SHPF ((uint32_t)RTC_ISR_SHPF) | |||
| #define RTC_FLAG_WUTWF ((uint32_t)RTC_ISR_WUTWF) | |||
| #define RTC_FLAG_ALRBWF ((uint32_t)RTC_ISR_ALRBWF) | |||
| #define RTC_FLAG_ALRAWF ((uint32_t)RTC_ISR_ALRAWF) | |||
| #define RTC_FLAG_RECALPF RTC_ISR_RECALPF | |||
| #define RTC_FLAG_TAMP3F RTC_ISR_TAMP3F | |||
| #define RTC_FLAG_TAMP2F RTC_ISR_TAMP2F | |||
| #define RTC_FLAG_TAMP1F RTC_ISR_TAMP1F | |||
| #define RTC_FLAG_TSOVF RTC_ISR_TSOVF | |||
| #define RTC_FLAG_TSF RTC_ISR_TSF | |||
| #define RTC_FLAG_ITSF RTC_ISR_ITSF | |||
| #define RTC_FLAG_WUTF RTC_ISR_WUTF | |||
| #define RTC_FLAG_ALRBF RTC_ISR_ALRBF | |||
| #define RTC_FLAG_ALRAF RTC_ISR_ALRAF | |||
| #define RTC_FLAG_INITF RTC_ISR_INITF | |||
| #define RTC_FLAG_RSF RTC_ISR_RSF | |||
| #define RTC_FLAG_INITS RTC_ISR_INITS | |||
| #define RTC_FLAG_SHPF RTC_ISR_SHPF | |||
| #define RTC_FLAG_WUTWF RTC_ISR_WUTWF | |||
| #define RTC_FLAG_ALRBWF RTC_ISR_ALRBWF | |||
| #define RTC_FLAG_ALRAWF RTC_ISR_ALRAWF | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -431,65 +462,73 @@ typedef struct | |||
| */ | |||
| /** @brief Reset RTC handle state | |||
| * @param __HANDLE__: RTC handle. | |||
| * @param __HANDLE__ RTC handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) do{\ | |||
| (__HANDLE__)->State = HAL_RTC_STATE_RESET;\ | |||
| (__HANDLE__)->MspInitCallback = NULL;\ | |||
| (__HANDLE__)->MspDeInitCallback = NULL;\ | |||
| }while(0u) | |||
| #else | |||
| #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RTC_STATE_RESET) | |||
| #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @brief Disable the write protection for RTC registers. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__) \ | |||
| do{ \ | |||
| (__HANDLE__)->Instance->WPR = 0xCA; \ | |||
| (__HANDLE__)->Instance->WPR = 0x53; \ | |||
| } while(0) | |||
| #define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__) \ | |||
| do{ \ | |||
| (__HANDLE__)->Instance->WPR = 0xCAu; \ | |||
| (__HANDLE__)->Instance->WPR = 0x53u; \ | |||
| } while(0u) | |||
| /** | |||
| * @brief Enable the write protection for RTC registers. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__) \ | |||
| do{ \ | |||
| (__HANDLE__)->Instance->WPR = 0xFF; \ | |||
| } while(0) | |||
| #define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__) \ | |||
| do{ \ | |||
| (__HANDLE__)->Instance->WPR = 0xFFu; \ | |||
| } while(0u) | |||
| /** | |||
| * @brief Enable the RTC ALARMA peripheral. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_ALARMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRAE)) | |||
| /** | |||
| * @brief Disable the RTC ALARMA peripheral. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_ALARMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRAE)) | |||
| /** | |||
| * @brief Enable the RTC ALARMB peripheral. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_ALARMB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRBE)) | |||
| /** | |||
| * @brief Disable the RTC ALARMB peripheral. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_ALARMB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRBE)) | |||
| /** | |||
| * @brief Enable the RTC Alarm interrupt. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __INTERRUPT__ specifies the RTC Alarm interrupt sources to be enabled or disabled. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg RTC_IT_ALRA: Alarm A interrupt | |||
| * @arg RTC_IT_ALRB: Alarm B interrupt | |||
| @@ -499,8 +538,8 @@ typedef struct | |||
| /** | |||
| * @brief Disable the RTC Alarm interrupt. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __INTERRUPT__ specifies the RTC Alarm interrupt sources to be enabled or disabled. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg RTC_IT_ALRA: Alarm A interrupt | |||
| * @arg RTC_IT_ALRB: Alarm B interrupt | |||
| @@ -510,19 +549,19 @@ typedef struct | |||
| /** | |||
| * @brief Check whether the specified RTC Alarm interrupt has occurred or not. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to check. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __INTERRUPT__ specifies the RTC Alarm interrupt sources to check. | |||
| * This parameter can be: | |||
| * @arg RTC_IT_ALRA: Alarm A interrupt | |||
| * @arg RTC_IT_ALRB: Alarm B interrupt | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR)& ((__INTERRUPT__)>> 4)) != RESET) ? SET : RESET) | |||
| #define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4)) != 0u) ? 1u : 0u) | |||
| /** | |||
| * @brief Get the selected RTC Alarm's flag status. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __FLAG__: specifies the RTC Alarm Flag sources to check. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __FLAG__ specifies the RTC Alarm Flag sources to check. | |||
| * This parameter can be: | |||
| * @arg RTC_FLAG_ALRAF | |||
| * @arg RTC_FLAG_ALRBF | |||
| @@ -530,12 +569,12 @@ typedef struct | |||
| * @arg RTC_FLAG_ALRBWF | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET) | |||
| #define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0u) ? 1u : 0u) | |||
| /** | |||
| * @brief Clear the RTC Alarm's pending flags. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __FLAG__: specifies the RTC Alarm Flag sources to clear. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __FLAG__ specifies the RTC Alarm Flag sources to clear. | |||
| * This parameter can be: | |||
| * @arg RTC_FLAG_ALRAF | |||
| * @arg RTC_FLAG_ALRBF | |||
| @@ -545,14 +584,14 @@ typedef struct | |||
| /** | |||
| * @brief Check whether the specified RTC Alarm interrupt is enabled or not. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to check. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __INTERRUPT__ specifies the RTC Alarm interrupt sources to check. | |||
| * This parameter can be: | |||
| * @arg RTC_IT_ALRA: Alarm A interrupt | |||
| * @arg RTC_IT_ALRB: Alarm B interrupt | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET) | |||
| #define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != 0u) ? 1u : 0u) | |||
| /** | |||
| * @brief Enable interrupt on the RTC Alarm associated Exti line. | |||
| @@ -578,6 +617,32 @@ typedef struct | |||
| */ | |||
| #define __HAL_RTC_ALARM_EXTI_DISABLE_EVENT() (EXTI_D1->EMR1 &= ~(RTC_EXTI_LINE_ALARM_EVENT)) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Enable interrupt on the RTC Alarm associated D2 Exti line. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_ALARM_EXTID2_ENABLE_IT() (EXTI_D2->IMR1 |= RTC_EXTI_LINE_ALARM_EVENT) | |||
| /** | |||
| * @brief Disable interrupt on the RTC Alarm associated D2 Exti line. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_ALARM_EXTID2_DISABLE_IT() (EXTI_D2->IMR1 &= ~(RTC_EXTI_LINE_ALARM_EVENT)) | |||
| /** | |||
| * @brief Enable event on the RTC Alarm associated D2 Exti line. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_ALARM_EXTID2_ENABLE_EVENT() (EXTI_D2->EMR1 |= RTC_EXTI_LINE_ALARM_EVENT) | |||
| /** | |||
| * @brief Disable event on the RTC Alarm associated D2 Exti line. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_ALARM_EXTID2_DISABLE_EVENT() (EXTI_D2->EMR1 &= ~(RTC_EXTI_LINE_ALARM_EVENT)) | |||
| #endif | |||
| /** | |||
| * @brief Enable falling edge trigger on the RTC Alarm associated Exti line. | |||
| * @retval None | |||
| @@ -609,7 +674,7 @@ typedef struct | |||
| #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE() do { \ | |||
| __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE(); \ | |||
| __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE(); \ | |||
| } while(0) | |||
| } while(0u) | |||
| /** | |||
| * @brief Disable rising & falling edge trigger on the RTC Alarm associated Exti line. | |||
| * @retval None | |||
| @@ -617,7 +682,7 @@ typedef struct | |||
| #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLING_EDGE() do { \ | |||
| __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE(); \ | |||
| __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE(); \ | |||
| } while(0) | |||
| } while(0u) | |||
| /** | |||
| * @brief Check whether the RTC Alarm associated Exti line interrupt flag is set or not. | |||
| * @retval Line Status. | |||
| @@ -630,6 +695,19 @@ typedef struct | |||
| */ | |||
| #define __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() (EXTI_D1->PR1 = (RTC_EXTI_LINE_ALARM_EVENT)) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Check whether the RTC Alarm associated D2 Exti line interrupt flag is set or not. | |||
| * @retval Line Status | |||
| */ | |||
| #define __HAL_RTC_ALARM_EXTID2_GET_FLAG() (EXTI_D2->PR1 & RTC_EXTI_LINE_ALARM_EVENT) | |||
| /** | |||
| * @brief Clear the RTC Alarm associated D2 Exti line flag. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_ALARM_EXTID2_CLEAR_FLAG() (EXTI_D2->PR1 = (RTC_EXTI_LINE_ALARM_EVENT)) | |||
| #endif | |||
| /** | |||
| * @brief Generate a Software interrupt on RTC Alarm associated Exti line. | |||
| * @retval None | |||
| @@ -656,6 +734,12 @@ HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc); | |||
| HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc); | |||
| void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc); | |||
| void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc); | |||
| /* Callbacks Register/UnRegister functions ***********************************/ | |||
| #if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) | |||
| HAL_StatusTypeDef HAL_RTC_RegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID, pRTC_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_RTC_UnRegisterCallback(RTC_HandleTypeDef *hrtc, HAL_RTC_CallbackIDTypeDef CallbackID); | |||
| #endif /* USE_HAL_RTC_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -717,14 +801,20 @@ HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc); | |||
| * @{ | |||
| */ | |||
| /* Masks Definition */ | |||
| #define RTC_TR_RESERVED_MASK ((uint32_t)0x007F7F7F) | |||
| #define RTC_DR_RESERVED_MASK ((uint32_t)0x00FFFF3F) | |||
| #define RTC_INIT_MASK ((uint32_t)0xFFFFFFFFU) | |||
| #define RTC_RSF_MASK ((uint32_t)0xFFFFFF5FU) | |||
| #define RTC_TR_RESERVED_MASK (RTC_TR_PM | RTC_TR_HT | RTC_TR_HU | \ | |||
| RTC_TR_MNT | RTC_TR_MNU| RTC_TR_ST | \ | |||
| RTC_TR_SU) | |||
| #define RTC_DR_RESERVED_MASK (RTC_DR_YT | RTC_DR_YU | RTC_DR_WDU | \ | |||
| RTC_DR_MT | RTC_DR_MU | RTC_DR_DT | \ | |||
| RTC_DR_DU) | |||
| #define RTC_INIT_MASK 0xFFFFFFFFu | |||
| #define RTC_RSF_MASK (~(RTC_ISR_INIT | RTC_ISR_RSF)) | |||
| #define RTC_TIMEOUT_VALUE 1000 | |||
| #define RTC_TIMEOUT_VALUE 1000u | |||
| #define RTC_EXTI_LINE_ALARM_EVENT ((uint32_t)0x00020000) /*!< External interrupt line 17 Connected to the RTC Alarm event */ | |||
| #define RTC_EXTI_LINE_ALARM_EVENT EXTI_IMR1_IM17 /*!< External interrupt line 17 Connected to the RTC Alarm event */ | |||
| /** | |||
| * @} | |||
| @@ -762,11 +852,11 @@ HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc); | |||
| #define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_FORMAT_BIN) || ((FORMAT) == RTC_FORMAT_BCD)) | |||
| #define IS_RTC_YEAR(YEAR) ((YEAR) <= (uint32_t)99) | |||
| #define IS_RTC_YEAR(YEAR) ((YEAR) <= 99u) | |||
| #define IS_RTC_MONTH(MONTH) (((MONTH) >= (uint32_t)1) && ((MONTH) <= (uint32_t)12)) | |||
| #define IS_RTC_MONTH(MONTH) (((MONTH) >= 1u) && ((MONTH) <= 12u)) | |||
| #define IS_RTC_DATE(DATE) (((DATE) >= (uint32_t)1) && ((DATE) <= (uint32_t)31)) | |||
| #define IS_RTC_DATE(DATE) (((DATE) >= 1u) && ((DATE) <= 31u)) | |||
| #define IS_RTC_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \ | |||
| ((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \ | |||
| @@ -776,7 +866,7 @@ HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc); | |||
| ((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \ | |||
| ((WEEKDAY) == RTC_WEEKDAY_SUNDAY)) | |||
| #define IS_RTC_ALARM_DATE_WEEKDAY_DATE(DATE) (((DATE) >(uint32_t) 0) && ((DATE) <= (uint32_t)31)) | |||
| #define IS_RTC_ALARM_DATE_WEEKDAY_DATE(DATE) (((DATE) > 0u) && ((DATE) <= 31u)) | |||
| #define IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \ | |||
| ((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \ | |||
| @@ -789,13 +879,13 @@ HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc); | |||
| #define IS_RTC_ALARM_DATE_WEEKDAY_SEL(SEL) (((SEL) == RTC_ALARMDATEWEEKDAYSEL_DATE) || \ | |||
| ((SEL) == RTC_ALARMDATEWEEKDAYSEL_WEEKDAY)) | |||
| #define IS_RTC_ALARM_MASK(MASK) (((MASK) & 0x7F7F7F7F) == (uint32_t)RESET) | |||
| #define IS_RTC_ALARM_MASK(MASK) (((MASK) & (~RTC_ALARMMASK_ALL)) == 0u) | |||
| #define IS_RTC_ALARM(ALARM) (((ALARM) == RTC_ALARM_A) || ((ALARM) == RTC_ALARM_B)) | |||
| #define IS_RTC_ALARM_SUB_SECOND_VALUE(VALUE) ((VALUE) <= (uint32_t)0x00007FFF) | |||
| #define IS_RTC_ALARM_SUB_SECOND_VALUE(VALUE) ((VALUE) <= RTC_ALRMASSR_SS) | |||
| #define IS_RTC_ALARM_SUB_SECOND_MASK(MASK) (((MASK) == RTC_ALARMSUBSECONDMASK_ALL) || \ | |||
| #define IS_RTC_ALARM_SUB_SECOND_MASK(MASK) (((MASK) == RTC_ALARMSUBSECONDMASK_ALL) || \ | |||
| ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_1) || \ | |||
| ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_2) || \ | |||
| ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_3) || \ | |||
| @@ -809,20 +899,20 @@ HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc); | |||
| ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_11) || \ | |||
| ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_12) || \ | |||
| ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_13) || \ | |||
| ((MASK) == RTC_ALARMSUBSECONDMASK_SS14) || \ | |||
| ((MASK) == RTC_ALARMSUBSECONDMASK_SS14) || \ | |||
| ((MASK) == RTC_ALARMSUBSECONDMASK_NONE)) | |||
| #define IS_RTC_ASYNCH_PREDIV(PREDIV) ((PREDIV) <= (uint32_t)0x7F) | |||
| #define IS_RTC_ASYNCH_PREDIV(PREDIV) ((PREDIV) <= (RTC_PRER_PREDIV_A >> RTC_PRER_PREDIV_A_Pos)) | |||
| #define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= (uint32_t)0x7FFF) | |||
| #define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= (RTC_PRER_PREDIV_S >> RTC_PRER_PREDIV_S_Pos)) | |||
| #define IS_RTC_HOUR12(HOUR) (((HOUR) > (uint32_t)0) && ((HOUR) <= (uint32_t)12)) | |||
| #define IS_RTC_HOUR12(HOUR) (((HOUR) > 0u) && ((HOUR) <= 12u)) | |||
| #define IS_RTC_HOUR24(HOUR) ((HOUR) <= (uint32_t)23) | |||
| #define IS_RTC_HOUR24(HOUR) ((HOUR) <= 23u) | |||
| #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= (uint32_t)59) | |||
| #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= 59u) | |||
| #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= (uint32_t)59) | |||
| #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= 59u) | |||
| /** | |||
| * @} | |||
| @@ -857,6 +947,6 @@ uint8_t RTC_Bcd2ToByte(uint8_t Value); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_RTC_H */ | |||
| #endif /* STM32H7xx_HAL_RTC_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,46 +2,28 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_rtc_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of RTC HAL Extension module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_RTC_EX_H | |||
| #define __STM32H7xx_HAL_RTC_EX_H | |||
| #ifndef STM32H7xx_HAL_RTC_EX_H | |||
| #define STM32H7xx_HAL_RTC_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #endif /* __cplusplus */ | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_hal_def.h" | |||
| @@ -106,10 +88,10 @@ typedef struct | |||
| /** @defgroup RTCEx_Output_selection_Definitions RTC Output Selection Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_OUTPUT_DISABLE ((uint32_t)0x00000000) | |||
| #define RTC_OUTPUT_ALARMA ((uint32_t)0x00200000) | |||
| #define RTC_OUTPUT_ALARMB ((uint32_t)0x00400000) | |||
| #define RTC_OUTPUT_WAKEUP ((uint32_t)0x00600000) | |||
| #define RTC_OUTPUT_DISABLE 0x00000000u | |||
| #define RTC_OUTPUT_ALARMA RTC_CR_OSEL_0 | |||
| #define RTC_OUTPUT_ALARMB RTC_CR_OSEL_1 | |||
| #define RTC_OUTPUT_WAKEUP RTC_CR_OSEL | |||
| /** | |||
| * @} | |||
| @@ -118,38 +100,38 @@ typedef struct | |||
| /** @defgroup RTCEx_Backup_Registers_Definitions RTC Backup Registers Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_BKP_DR0 ((uint32_t)0x00000000) | |||
| #define RTC_BKP_DR1 ((uint32_t)0x00000001) | |||
| #define RTC_BKP_DR2 ((uint32_t)0x00000002) | |||
| #define RTC_BKP_DR3 ((uint32_t)0x00000003) | |||
| #define RTC_BKP_DR4 ((uint32_t)0x00000004) | |||
| #define RTC_BKP_DR5 ((uint32_t)0x00000005) | |||
| #define RTC_BKP_DR6 ((uint32_t)0x00000006) | |||
| #define RTC_BKP_DR7 ((uint32_t)0x00000007) | |||
| #define RTC_BKP_DR8 ((uint32_t)0x00000008) | |||
| #define RTC_BKP_DR9 ((uint32_t)0x00000009) | |||
| #define RTC_BKP_DR10 ((uint32_t)0x0000000A) | |||
| #define RTC_BKP_DR11 ((uint32_t)0x0000000B) | |||
| #define RTC_BKP_DR12 ((uint32_t)0x0000000C) | |||
| #define RTC_BKP_DR13 ((uint32_t)0x0000000D) | |||
| #define RTC_BKP_DR14 ((uint32_t)0x0000000E) | |||
| #define RTC_BKP_DR15 ((uint32_t)0x0000000F) | |||
| #define RTC_BKP_DR16 ((uint32_t)0x00000010) | |||
| #define RTC_BKP_DR17 ((uint32_t)0x00000011) | |||
| #define RTC_BKP_DR18 ((uint32_t)0x00000012) | |||
| #define RTC_BKP_DR19 ((uint32_t)0x00000013) | |||
| #define RTC_BKP_DR20 ((uint32_t)0x00000014) | |||
| #define RTC_BKP_DR21 ((uint32_t)0x00000015) | |||
| #define RTC_BKP_DR22 ((uint32_t)0x00000016) | |||
| #define RTC_BKP_DR23 ((uint32_t)0x00000017) | |||
| #define RTC_BKP_DR24 ((uint32_t)0x00000018) | |||
| #define RTC_BKP_DR25 ((uint32_t)0x00000019) | |||
| #define RTC_BKP_DR26 ((uint32_t)0x0000001A) | |||
| #define RTC_BKP_DR27 ((uint32_t)0x0000001B) | |||
| #define RTC_BKP_DR28 ((uint32_t)0x0000001C) | |||
| #define RTC_BKP_DR29 ((uint32_t)0x0000001D) | |||
| #define RTC_BKP_DR30 ((uint32_t)0x0000001E) | |||
| #define RTC_BKP_DR31 ((uint32_t)0x0000001F) | |||
| #define RTC_BKP_DR0 0x00000000u | |||
| #define RTC_BKP_DR1 0x00000001u | |||
| #define RTC_BKP_DR2 0x00000002u | |||
| #define RTC_BKP_DR3 0x00000003u | |||
| #define RTC_BKP_DR4 0x00000004u | |||
| #define RTC_BKP_DR5 0x00000005u | |||
| #define RTC_BKP_DR6 0x00000006u | |||
| #define RTC_BKP_DR7 0x00000007u | |||
| #define RTC_BKP_DR8 0x00000008u | |||
| #define RTC_BKP_DR9 0x00000009u | |||
| #define RTC_BKP_DR10 0x0000000Au | |||
| #define RTC_BKP_DR11 0x0000000Bu | |||
| #define RTC_BKP_DR12 0x0000000Cu | |||
| #define RTC_BKP_DR13 0x0000000Du | |||
| #define RTC_BKP_DR14 0x0000000Eu | |||
| #define RTC_BKP_DR15 0x0000000Fu | |||
| #define RTC_BKP_DR16 0x00000010u | |||
| #define RTC_BKP_DR17 0x00000011u | |||
| #define RTC_BKP_DR18 0x00000012u | |||
| #define RTC_BKP_DR19 0x00000013u | |||
| #define RTC_BKP_DR20 0x00000014u | |||
| #define RTC_BKP_DR21 0x00000015u | |||
| #define RTC_BKP_DR22 0x00000016u | |||
| #define RTC_BKP_DR23 0x00000017u | |||
| #define RTC_BKP_DR24 0x00000018u | |||
| #define RTC_BKP_DR25 0x00000019u | |||
| #define RTC_BKP_DR26 0x0000001Au | |||
| #define RTC_BKP_DR27 0x0000001Bu | |||
| #define RTC_BKP_DR28 0x0000001Cu | |||
| #define RTC_BKP_DR29 0x0000001Du | |||
| #define RTC_BKP_DR30 0x0000001Eu | |||
| #define RTC_BKP_DR31 0x0000001Fu | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -158,8 +140,8 @@ typedef struct | |||
| * | |||
| * @{ | |||
| */ | |||
| #define RTC_TIMESTAMPEDGE_RISING ((uint32_t)0x00000000) | |||
| #define RTC_TIMESTAMPEDGE_FALLING ((uint32_t)0x00000008) | |||
| #define RTC_TIMESTAMPEDGE_RISING 0x00000000u | |||
| #define RTC_TIMESTAMPEDGE_FALLING RTC_CR_TSEDGE | |||
| /** | |||
| * @} | |||
| @@ -168,7 +150,7 @@ typedef struct | |||
| /** @defgroup RTCEx_TimeStamp_Pin_Selection RTC TimeStamp Pins Selection | |||
| * @{ | |||
| */ | |||
| #define RTC_TIMESTAMPPIN_DEFAULT ((uint32_t)0x00000000) | |||
| #define RTC_TIMESTAMPPIN_DEFAULT 0x00000000u | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -197,10 +179,11 @@ typedef struct | |||
| /** @defgroup RTCEx_Tamper_Trigger_Definitions RTC Tamper Triggers Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_TAMPERTRIGGER_RISINGEDGE ((uint32_t)0x00000000) | |||
| #define RTC_TAMPERTRIGGER_FALLINGEDGE ((uint32_t)0x00000002) | |||
| #define RTC_TAMPERTRIGGER_LOWLEVEL RTC_TAMPERTRIGGER_RISINGEDGE | |||
| #define RTC_TAMPERTRIGGER_HIGHLEVEL RTC_TAMPERTRIGGER_FALLINGEDGE | |||
| #define RTC_TAMPERTRIGGER_RISINGEDGE 0x01u /*!< Warning : Filter must be RTC_TAMPERFILTER_DISABLE */ | |||
| #define RTC_TAMPERTRIGGER_FALLINGEDGE 0x02u /*!< Warning : Filter must be RTC_TAMPERFILTER_DISABLE */ | |||
| #define RTC_TAMPERTRIGGER_LOWLEVEL 0x04u /*!< Warning : Filter must not be RTC_TAMPERFILTER_DISABLE */ | |||
| #define RTC_TAMPERTRIGGER_HIGHLEVEL 0x08u /*!< Warning : Filter must not be RTC_TAMPERFILTER_DISABLE */ | |||
| /** | |||
| * @} | |||
| @@ -209,8 +192,8 @@ typedef struct | |||
| /** @defgroup RTCEx_Tamper_EraseBackUp_Definitions RTC Tamper EraseBackUp Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_TAMPER_ERASE_BACKUP_ENABLE ((uint32_t)0x00000000) | |||
| #define RTC_TAMPER_ERASE_BACKUP_DISABLE ((uint32_t)0x00020000) | |||
| #define RTC_TAMPER_ERASE_BACKUP_ENABLE 0x00000000u | |||
| #define RTC_TAMPER_ERASE_BACKUP_DISABLE RTC_TAMPCR_TAMP1NOERASE | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -218,8 +201,8 @@ typedef struct | |||
| /** @defgroup RTCEx_Tamper_MaskFlag_Definitions RTC Tamper Mask Flag Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_TAMPERMASK_FLAG_DISABLE ((uint32_t)0x00000000) | |||
| #define RTC_TAMPERMASK_FLAG_ENABLE ((uint32_t)0x00040000) | |||
| #define RTC_TAMPERMASK_FLAG_DISABLE 0x00000000u | |||
| #define RTC_TAMPERMASK_FLAG_ENABLE RTC_TAMPCR_TAMP1MF | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -227,14 +210,16 @@ typedef struct | |||
| /** @defgroup RTCEx_Tamper_Filter_Definitions RTC Tamper Filter Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_TAMPERFILTER_DISABLE ((uint32_t)0x00000000) /*!< Tamper filter is disabled */ | |||
| #define RTC_TAMPERFILTER_DISABLE 0x00000000u /*!< Tamper filter is disabled */ | |||
| #define RTC_TAMPERFILTER_2SAMPLE ((uint32_t)0x00000800) /*!< Tamper is activated after 2 | |||
| #define RTC_TAMPERFILTER_2SAMPLE RTC_TAMPCR_TAMPFLT_0 /*!< Tamper is activated after 2 | |||
| consecutive samples at the active level */ | |||
| #define RTC_TAMPERFILTER_4SAMPLE ((uint32_t)0x00001000) /*!< Tamper is activated after 4 | |||
| #define RTC_TAMPERFILTER_4SAMPLE RTC_TAMPCR_TAMPFLT_1 /*!< Tamper is activated after 4 | |||
| consecutive samples at the active level */ | |||
| #define RTC_TAMPERFILTER_8SAMPLE ((uint32_t)0x00001800) /*!< Tamper is activated after 8 | |||
| #define RTC_TAMPERFILTER_8SAMPLE RTC_TAMPCR_TAMPFLT /*!< Tamper is activated after 8 | |||
| consecutive samples at the active level. */ | |||
| #define RTC_TAMPERFILTER_MASK RTC_TAMPCR_TAMPFLT /*!< Masking all bits except those of | |||
| field TAMPFLT[1:0]. */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -242,37 +227,41 @@ typedef struct | |||
| /** @defgroup RTCEx_Tamper_Sampling_Frequencies_Definitions RTC Tamper Sampling Frequencies Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 ((uint32_t)0x00000000) /*!< Each of the tamper inputs are sampled | |||
| with a frequency = RTCCLK / 32768 */ | |||
| #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 ((uint32_t)0x00000100) /*!< Each of the tamper inputs are sampled | |||
| with a frequency = RTCCLK / 16384 */ | |||
| #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 ((uint32_t)0x00000200) /*!< Each of the tamper inputs are sampled | |||
| with a frequency = RTCCLK / 8192 */ | |||
| #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 ((uint32_t)0x00000300) /*!< Each of the tamper inputs are sampled | |||
| with a frequency = RTCCLK / 4096 */ | |||
| #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 ((uint32_t)0x00000400) /*!< Each of the tamper inputs are sampled | |||
| with a frequency = RTCCLK / 2048 */ | |||
| #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 ((uint32_t)0x00000500) /*!< Each of the tamper inputs are sampled | |||
| with a frequency = RTCCLK / 1024 */ | |||
| #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 ((uint32_t)0x00000600) /*!< Each of the tamper inputs are sampled | |||
| with a frequency = RTCCLK / 512 */ | |||
| #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 ((uint32_t)0x00000700) /*!< Each of the tamper inputs are sampled | |||
| with a frequency = RTCCLK / 256 */ | |||
| /** | |||
| #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 0x00000000u /*!< Each of the tamper inputs are sampled | |||
| with a frequency = RTCCLK / 32768 */ | |||
| #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 RTC_TAMPCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled | |||
| with a frequency = RTCCLK / 16384 */ | |||
| #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 RTC_TAMPCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled | |||
| with a frequency = RTCCLK / 8192 */ | |||
| #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 (RTC_TAMPCR_TAMPFREQ_0 | RTC_TAMPCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled | |||
| with a frequency = RTCCLK / 4096 */ | |||
| #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 RTC_TAMPCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled | |||
| with a frequency = RTCCLK / 2048 */ | |||
| #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 (RTC_TAMPCR_TAMPFREQ_0 | RTC_TAMPCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled | |||
| with a frequency = RTCCLK / 1024 */ | |||
| #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 (RTC_TAMPCR_TAMPFREQ_1 | RTC_TAMPCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled | |||
| with a frequency = RTCCLK / 512 */ | |||
| #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 RTC_TAMPCR_TAMPFREQ /*!< Each of the tamper inputs are sampled | |||
| with a frequency = RTCCLK / 256 */ | |||
| #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_MASK RTC_TAMPCR_TAMPFREQ /*!< Masking all bits except those of | |||
| field TAMPFREQ[2:0]*/ | |||
| #/** | |||
| * @} | |||
| */ | |||
| /** @defgroup RTCEx_Tamper_Pin_Precharge_Duration_Definitions RTC Tamper Pin Precharge Duration Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK ((uint32_t)0x00000000) /*!< Tamper pins are pre-charged before | |||
| #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK 0x00000000u /*!< Tamper pins are pre-charged before | |||
| sampling during 1 RTCCLK cycle */ | |||
| #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK ((uint32_t)0x00002000) /*!< Tamper pins are pre-charged before | |||
| #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK RTC_TAMPCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before | |||
| sampling during 2 RTCCLK cycles */ | |||
| #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK ((uint32_t)0x00004000) /*!< Tamper pins are pre-charged before | |||
| #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK RTC_TAMPCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before | |||
| sampling during 4 RTCCLK cycles */ | |||
| #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK ((uint32_t)0x00006000) /*!< Tamper pins are pre-charged before | |||
| #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK RTC_TAMPCR_TAMPPRCH /*!< Tamper pins are pre-charged before | |||
| sampling during 8 RTCCLK cycles */ | |||
| #define RTC_TAMPERPRECHARGEDURATION_MASK RTC_TAMPCR_TAMPPRCH /*!< Masking all bits except those of | |||
| field TAMPPRCH[1:0] */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -280,8 +269,9 @@ typedef struct | |||
| /** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection_Definitions RTC Tamper TimeStamp On Tamper Detection Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE ((uint32_t)RTC_TAMPCR_TAMPTS) /*!< TimeStamp on Tamper Detection event saved */ | |||
| #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE ((uint32_t)0x00000000) /*!< TimeStamp on Tamper Detection event is not saved */ | |||
| #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE RTC_TAMPCR_TAMPTS /*!< TimeStamp on Tamper Detection event saved */ | |||
| #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE 0x00000000u /*!< TimeStamp on Tamper Detection event is not saved */ | |||
| #define RTC_TIMESTAMPONTAMPERDETECTION_MASK RTC_TAMPCR_TAMPTS /*!< Masking all bits except bit TAMPTS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -289,8 +279,9 @@ typedef struct | |||
| /** @defgroup RTCEx_Tamper_Pull_UP_Definitions RTC Tamper Pull Up Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_TAMPER_PULLUP_ENABLE ((uint32_t)0x00000000) /*!< TimeStamp on Tamper Detection event saved */ | |||
| #define RTC_TAMPER_PULLUP_DISABLE ((uint32_t)RTC_TAMPCR_TAMPPUDIS) /*!< TimeStamp on Tamper Detection event is not saved */ | |||
| #define RTC_TAMPER_PULLUP_ENABLE 0x00000000u /*!< TimeStamp on Tamper Detection event saved */ | |||
| #define RTC_TAMPER_PULLUP_DISABLE RTC_TAMPCR_TAMPPUDIS /*!< TimeStamp on Tamper Detection event is not saved */ | |||
| #define RTC_TAMPER_PULLUP_MASK RTC_TAMPCR_TAMPPUDIS /*!< Maskin all bits except bit TAMPPUDIS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -298,12 +289,12 @@ typedef struct | |||
| /** @defgroup RTCEx_Wakeup_Timer_Definitions RTC Wakeup Timer Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 ((uint32_t)0x00000000) | |||
| #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 ((uint32_t)0x00000001) | |||
| #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 ((uint32_t)0x00000002) | |||
| #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 ((uint32_t)0x00000003) | |||
| #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS ((uint32_t)0x00000004) | |||
| #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS ((uint32_t)0x00000006) | |||
| #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 0x00000000u | |||
| #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 RTC_CR_WUCKSEL_0 | |||
| #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 RTC_CR_WUCKSEL_1 | |||
| #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 (RTC_CR_WUCKSEL_0 | RTC_CR_WUCKSEL_1) | |||
| #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS RTC_CR_WUCKSEL_2 | |||
| #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_2) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -311,12 +302,12 @@ typedef struct | |||
| /** @defgroup RTCEx_Smooth_calib_period_Definitions RTC Smooth Calib Period Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_SMOOTHCALIB_PERIOD_32SEC ((uint32_t)0x00000000) /*!< If RTCCLK = 32768 Hz, Smooth calibration | |||
| period is 32s, else 2exp20 RTCCLK seconds */ | |||
| #define RTC_SMOOTHCALIB_PERIOD_16SEC ((uint32_t)0x00002000) /*!< If RTCCLK = 32768 Hz, Smooth calibration | |||
| period is 16s, else 2exp19 RTCCLK seconds */ | |||
| #define RTC_SMOOTHCALIB_PERIOD_8SEC ((uint32_t)0x00004000) /*!< If RTCCLK = 32768 Hz, Smooth calibration | |||
| period is 8s, else 2exp18 RTCCLK seconds */ | |||
| #define RTC_SMOOTHCALIB_PERIOD_32SEC 0x00000000u /*!< If RTCCLK = 32768 Hz, Smooth calibration | |||
| period is 32s, else 2exp20 RTCCLK pulses */ | |||
| #define RTC_SMOOTHCALIB_PERIOD_16SEC RTC_CALR_CALW16 /*!< If RTCCLK = 32768 Hz, Smooth calibration | |||
| period is 16s, else 2exp19 RTCCLK pulses */ | |||
| #define RTC_SMOOTHCALIB_PERIOD_8SEC RTC_CALR_CALW8 /*!< If RTCCLK = 32768 Hz, Smooth calibration | |||
| period is 8s, else 2exp18 RTCCLK pulses */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -324,10 +315,10 @@ typedef struct | |||
| /** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions RTC Smooth Calib Plus Pulses Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_SMOOTHCALIB_PLUSPULSES_SET ((uint32_t)0x00008000) /*!< The number of RTCCLK pulses added | |||
| #define RTC_SMOOTHCALIB_PLUSPULSES_SET RTC_CALR_CALP /*!< The number of RTCCLK pulses added | |||
| during a X -second window = Y - CALM[8:0] | |||
| with Y = 512, 256, 128 when X = 32, 16, 8 */ | |||
| #define RTC_SMOOTHCALIB_PLUSPULSES_RESET ((uint32_t)0x00000000) /*!< The number of RTCCLK pulses subbstited | |||
| #define RTC_SMOOTHCALIB_PLUSPULSES_RESET 0x00000000u /*!< The number of RTCCLK pulses subbstited | |||
| during a 32-second window = CALM[8:0] */ | |||
| /** | |||
| * @} | |||
| @@ -336,8 +327,8 @@ typedef struct | |||
| /** @defgroup RTCEx_Calib_Output_selection_Definitions RTC Calib Output Selection Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_CALIBOUTPUT_512HZ ((uint32_t)0x00000000) | |||
| #define RTC_CALIBOUTPUT_1HZ ((uint32_t)0x00080000) | |||
| #define RTC_CALIBOUTPUT_512HZ 0x00000000u | |||
| #define RTC_CALIBOUTPUT_1HZ RTC_CR_COSEL | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -345,8 +336,8 @@ typedef struct | |||
| /** @defgroup RTCEx_Add_1_Second_Parameter_Definitions RTC Add 1 Second Parameter Definitions | |||
| * @{ | |||
| */ | |||
| #define RTC_SHIFTADD1S_RESET ((uint32_t)0x00000000) | |||
| #define RTC_SHIFTADD1S_SET ((uint32_t)0x80000000) | |||
| #define RTC_SHIFTADD1S_RESET 0x00000000u | |||
| #define RTC_SHIFTADD1S_SET RTC_SHIFTR_ADD1S | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -362,22 +353,22 @@ typedef struct | |||
| /** | |||
| * @brief Enable the RTC WakeUp Timer peripheral. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE)) | |||
| /** | |||
| * @brief Disable the RTC WakeUp Timer peripheral. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE)) | |||
| /** | |||
| * @brief Enable the RTC WakeUpTimer interrupt. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be enabled. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be enabled. | |||
| * This parameter can be: | |||
| * @arg RTC_IT_WUT: WakeUpTimer interrupt | |||
| * @retval None | |||
| @@ -386,8 +377,8 @@ typedef struct | |||
| /** | |||
| * @brief Disable the RTC WakeUpTimer interrupt. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to be disabled. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be disabled. | |||
| * This parameter can be: | |||
| * @arg RTC_IT_WUT: WakeUpTimer interrupt | |||
| * @retval None | |||
| @@ -396,39 +387,39 @@ typedef struct | |||
| /** | |||
| * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __INTERRUPT__: specifies the RTC WakeUpTimer interrupt sources to check. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to check. | |||
| * This parameter can be: | |||
| * @arg RTC_IT_WUT: WakeUpTimer interrupt | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4)) != RESET) ? SET : RESET) | |||
| #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & (__INTERRUPT__)) != 0u) ? 1u : 0u) | |||
| /** | |||
| * @brief Check whether the specified RTC Wake Up timer interrupt is enabled or not. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __INTERRUPT__: specifies the RTC Wake Up timer interrupt sources to check. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __INTERRUPT__ specifies the RTC Wake Up timer interrupt sources to check. | |||
| * This parameter can be: | |||
| * @arg RTC_IT_WUT: WakeUpTimer interrupt | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET) | |||
| #define __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != 0u) ? 1u : 0u) | |||
| /** | |||
| * @brief Get the selected RTC WakeUpTimer's flag status. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __FLAG__: specifies the RTC WakeUpTimer Flag is pending or not. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __FLAG__ specifies the RTC WakeUpTimer Flag is pending or not. | |||
| * This parameter can be: | |||
| * @arg RTC_FLAG_WUTF | |||
| * @arg RTC_FLAG_WUTWF | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET) | |||
| #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0u) ? 1u : 0u) | |||
| /** | |||
| * @brief Clear the RTC Wake Up timer's pending flags. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __FLAG__: specifies the RTC WakeUpTimer Flag to clear. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __FLAG__ specifies the RTC WakeUpTimer Flag to clear. | |||
| * This parameter can be: | |||
| * @arg RTC_FLAG_WUTF | |||
| * @retval None | |||
| @@ -437,50 +428,50 @@ typedef struct | |||
| /** | |||
| * @brief Enable the RTC Tamper1 input detection. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_TAMPER1_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP1E)) | |||
| /** | |||
| * @brief Disable the RTC Tamper1 input detection. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_TAMPER1_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP1E)) | |||
| /** | |||
| * @brief Enable the RTC Tamper2 input detection. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_TAMPER2_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP2E)) | |||
| /** | |||
| * @brief Disable the RTC Tamper2 input detection. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_TAMPER2_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP2E)) | |||
| /** | |||
| * @brief Enable the RTC Tamper3 input detection. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_TAMPER3_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP3E)) | |||
| /** | |||
| * @brief Disable the RTC Tamper3 input detection. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_TAMPER3_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP3E)) | |||
| /** | |||
| * @brief Enable the RTC Tamper interrupt. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __INTERRUPT__: specifies the RTC Tamper interrupt sources to be enabled. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __INTERRUPT__ specifies the RTC Tamper interrupt sources to be enabled. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg RTC_IT_TAMP: All tampers interrupts | |||
| * @arg RTC_IT_TAMP1: Tamper1 interrupt | |||
| @@ -492,8 +483,8 @@ typedef struct | |||
| /** | |||
| * @brief Disable the RTC Tamper interrupt. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __INTERRUPT__: specifies the RTC Tamper interrupt sources to be disabled. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __INTERRUPT__ specifies the RTC Tamper interrupt sources to be disabled. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg RTC_IT_TAMP: All tampers interrupts | |||
| * @arg RTC_IT_TAMP1: Tamper1 interrupt | |||
| @@ -505,47 +496,45 @@ typedef struct | |||
| /** | |||
| * @brief Check whether the specified RTC Tamper interrupt has occurred or not. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __INTERRUPT__: specifies the RTC Tamper interrupt to check. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __INTERRUPT__ specifies the RTC Tamper interrupt to check. | |||
| * This parameter can be: | |||
| * @arg RTC_IT_TAMP1: Tamper1 interrupt | |||
| * @arg RTC_IT_TAMP2: Tamper2 interrupt | |||
| * @arg RTC_IT_TAMP3: Tamper3 interrupt | |||
| * @retval None | |||
| * @arg RTC_FLAG_TAMP1F: Tamper1 interrupt flag | |||
| * @arg RTC_FLAG_TAMP2F: Tamper2 interrupt flag | |||
| * @arg RTC_FLAG_TAMP3F: Tamper3 interrupt flag | |||
| * @retval Flag status | |||
| */ | |||
| #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) (((__INTERRUPT__) == RTC_IT_TAMP1) ? (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 3)) != RESET) ? SET : RESET) : \ | |||
| ((__INTERRUPT__) == RTC_IT_TAMP2) ? (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 5)) != RESET) ? SET : RESET) : \ | |||
| (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 7)) != RESET) ? SET : RESET)) | |||
| #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & (__INTERRUPT__)) != 0u) ? 1u : 0u) | |||
| /** | |||
| * @brief Check whether the specified RTC Tamper interrupt is enabled or not. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __INTERRUPT__: specifies the RTC Tamper interrupt source to check. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __INTERRUPT__ specifies the RTC Tamper interrupt source to check. | |||
| * This parameter can be: | |||
| * @arg RTC_IT_TAMP: All tampers interrupts | |||
| * @arg RTC_IT_TAMP1: Tamper1 interrupt | |||
| * @arg RTC_IT_TAMP2: Tamper2 interrupt | |||
| * @arg RTC_IT_TAMP3: Tamper3 interrupt | |||
| * @retval None | |||
| * @retval Flag status | |||
| */ | |||
| #define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->TAMPCR) & (__INTERRUPT__)) != RESET) ? SET : RESET) | |||
| #define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->TAMPCR) & (__INTERRUPT__)) != 0u) ? 1u : 0u) | |||
| /** | |||
| * @brief Get the selected RTC Tamper's flag status. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __FLAG__: specifies the RTC Tamper Flag is pending or not. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __FLAG__ specifies the RTC Tamper Flag is pending or not. | |||
| * This parameter can be: | |||
| * @arg RTC_FLAG_TAMP1F: Tamper1 flag | |||
| * @arg RTC_FLAG_TAMP2F: Tamper2 flag | |||
| * @arg RTC_FLAG_TAMP3F: Tamper3 flag | |||
| * @retval None | |||
| * @retval Flag status | |||
| */ | |||
| #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET) | |||
| #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0u) ? 1u : 0u) | |||
| /** | |||
| * @brief Clear the RTC Tamper's pending flags. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __FLAG__: specifies the RTC Tamper Flag sources to clear. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __FLAG__ specifies the RTC Tamper Flag sources to clear. | |||
| * This parameter can be: | |||
| * @arg RTC_FLAG_TAMP1F: Tamper1 flag | |||
| * @arg RTC_FLAG_TAMP2F: Tamper2 flag | |||
| @@ -556,22 +545,22 @@ typedef struct | |||
| /** | |||
| * @brief Enable the RTC TimeStamp peripheral. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TSE)) | |||
| /** | |||
| * @brief Disable the RTC TimeStamp peripheral. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TSE)) | |||
| /** | |||
| * @brief Enable the RTC TimeStamp interrupt. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt source to be enabled. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt source to be enabled. | |||
| * This parameter can be: | |||
| * @arg RTC_IT_TS: TimeStamp interrupt | |||
| * @retval None | |||
| @@ -580,8 +569,8 @@ typedef struct | |||
| /** | |||
| * @brief Disable the RTC TimeStamp interrupt. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt source to be disabled. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt source to be disabled. | |||
| * This parameter can be: | |||
| * @arg RTC_IT_TS: TimeStamp interrupt | |||
| * @retval None | |||
| @@ -590,39 +579,39 @@ typedef struct | |||
| /** | |||
| * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __INTERRUPT__: specifies the RTC TimeStamp interrupt source to check. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt source to check. | |||
| * This parameter can be: | |||
| * @arg RTC_IT_TS: TimeStamp interrupt | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__)>> 4)) != RESET) ? SET : RESET) | |||
| #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & (__INTERRUPT__)) != 0u) ? 1u : 0u) | |||
| /** | |||
| * @brief Check whether the specified RTC Time Stamp interrupt is enabled or not. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __INTERRUPT__: specifies the RTC Time Stamp interrupt source to check. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __INTERRUPT__ specifies the RTC Time Stamp interrupt source to check. | |||
| * This parameter can be: | |||
| * @arg RTC_IT_TS: TimeStamp interrupt | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_TIMESTAMP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET) | |||
| #define __HAL_RTC_TIMESTAMP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != 0u) ? 1u : 0u) | |||
| /** | |||
| * @brief Get the selected RTC TimeStamp's flag status. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __FLAG__: specifies the RTC TimeStamp Flag is pending or not. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __FLAG__ specifies the RTC TimeStamp Flag is pending or not. | |||
| * This parameter can be: | |||
| * @arg RTC_FLAG_TSF | |||
| * @arg RTC_FLAG_TSOVF | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET) | |||
| #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0u) ? 1u : 0u) | |||
| /** | |||
| * @brief Clear the RTC Time Stamp's pending flags. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __FLAG__: specifies the RTC Alarm Flag sources to clear. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __FLAG__ specifies the RTC Alarm Flag sources to clear. | |||
| * This parameter can be: | |||
| * @arg RTC_FLAG_TSF | |||
| * @arg RTC_FLAG_TSOVF | |||
| @@ -632,32 +621,32 @@ typedef struct | |||
| /** | |||
| * @brief Enable the RTC internal TimeStamp peripheral. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_INTERNAL_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ITSE)) | |||
| /** | |||
| * @brief Disable the RTC internal TimeStamp peripheral. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_INTERNAL_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ITSE)) | |||
| /** | |||
| * @brief Get the selected RTC Internal Time Stamp's flag status. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __FLAG__: specifies the RTC Internal Time Stamp Flag is pending or not. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __FLAG__ specifies the RTC Internal Time Stamp Flag is pending or not. | |||
| * This parameter can be: | |||
| * @arg RTC_FLAG_ITSF | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_INTERNAL_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET) | |||
| #define __HAL_RTC_INTERNAL_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0u) ? 1u : 0u) | |||
| /** | |||
| * @brief Clear the RTC Internal Time Stamp's pending flags. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __FLAG__: specifies the RTC Internal Time Stamp Flag source to clear. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __FLAG__ specifies the RTC Internal Time Stamp Flag source to clear. | |||
| * This parameter can be: | |||
| * @arg RTC_FLAG_ITSF | |||
| * @retval None | |||
| @@ -666,41 +655,41 @@ typedef struct | |||
| /** | |||
| * @brief Enable the RTC calibration output. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_COE)) | |||
| /** | |||
| * @brief Disable the calibration output. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_COE)) | |||
| /** | |||
| * @brief Enable the clock reference detection. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_REFCKON)) | |||
| /** | |||
| * @brief Disable the clock reference detection. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_REFCKON)) | |||
| /** | |||
| * @brief Get the selected RTC shift operation's flag status. | |||
| * @param __HANDLE__: specifies the RTC handle. | |||
| * @param __FLAG__: specifies the RTC shift operation Flag is pending or not. | |||
| * @param __HANDLE__ specifies the RTC handle. | |||
| * @param __FLAG__ specifies the RTC shift operation Flag is pending or not. | |||
| * This parameter can be: | |||
| * @arg RTC_FLAG_SHPF | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET) | |||
| #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0u) ? 1u : 0u) | |||
| /** | |||
| * @brief Enable interrupt on the RTC WakeUp Timer associated Exti line. | |||
| @@ -737,6 +726,33 @@ typedef struct | |||
| */ | |||
| #define __HAL_RTC_WAKEUPTIMER_EXTID3_DISABLE_EVENT() (EXTI->D3PMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Enable interrupt on the RTC WakeUp Timer associated D2 Exti line. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_WAKEUPTIMER_EXTID2_ENABLE_IT() (EXTI_D2->IMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) | |||
| /** | |||
| * @brief Disable interrupt on the RTC WakeUp Timer associated D2 Exti line. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_WAKEUPTIMER_EXTID2_DISABLE_IT() (EXTI_D2->IMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) | |||
| /** | |||
| * @brief Enable event on the RTC WakeUp Timer associated D2 Exti line. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_WAKEUPTIMER_EXTID2_ENABLE_EVENT() (EXTI_D2->EMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) | |||
| /** | |||
| * @brief Disable event on the RTC WakeUp Timer associated D2 Exti line. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_WAKEUPTIMER_EXTID2_DISABLE_EVENT() (EXTI_D2->EMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) | |||
| #endif /* DUAL_CORE */ | |||
| /** | |||
| * @brief Enable falling edge trigger on the RTC WakeUp Timer associated Exti line. | |||
| * @retval None | |||
| @@ -832,6 +848,47 @@ typedef struct | |||
| */ | |||
| #define __HAL_RTC_WAKEUPTIMER_EXTI_GENERATE_SWIT() (EXTI->SWIER1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Check whether the RTC WakeUp Timer associated D2 Exti line interrupt flag is set or not. | |||
| * @retval Line Status. | |||
| */ | |||
| #define __HAL_RTC_WAKEUPTIMER_EXTID2_GET_FLAG() (EXTI_D2->PR1 & RTC_EXTI_LINE_WAKEUPTIMER_EVENT) | |||
| /** | |||
| * @brief Clear the RTC WakeUp Timer associated D2 Exti line flag. | |||
| * @retval None. | |||
| */ | |||
| #define __HAL_RTC_WAKEUPTIMER_EXTID2_CLEAR_FLAG() (EXTI_D2->PR1 = RTC_EXTI_LINE_WAKEUPTIMER_EVENT) | |||
| /** | |||
| * @brief Enable interrupt on the RTC Tamper and Timestamp associated D2 Exti line. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_TAMPER_TIMESTAMP_EXTID2_ENABLE_IT() (EXTI_D2->IMR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) | |||
| /** | |||
| * @brief Disable interrupt on the RTC Tamper and Timestamp associated D2 Exti line. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_TAMPER_TIMESTAMP_EXTID2_DISABLE_IT() (EXTI_D2->IMR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) | |||
| /** | |||
| * @brief Enable event on the RTC Tamper and Timestamp associated D2 Exti line. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_TAMPER_TIMESTAMP_EXTID2_ENABLE_EVENT() (EXTI_D2->EMR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) | |||
| /** | |||
| * @brief Disable event on the RTC Tamper and Timestamp associated D2 Exti line. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_TAMPER_TIMESTAMP_EXTID2_DISABLE_EVENT() (EXTI_D2->EMR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) | |||
| #endif | |||
| /** | |||
| * @brief Enable falling edge trigger on the RTC Tamper and Timestamp associated Exti line. | |||
| @@ -885,6 +942,20 @@ typedef struct | |||
| */ | |||
| #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG() (EXTI_D1->PR1 = RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) | |||
| #if defined(DUAL_CORE) | |||
| /** | |||
| * @brief Check whether the RTC Tamper and Timestamp associated D2 Exti line interrupt flag is set or not. | |||
| * @retval Line Status | |||
| */ | |||
| #define __HAL_RTC_TAMPER_TIMESTAMP_EXTID2_GET_FLAG() (EXTI_D2->PR1 & RTC_EXTI_LINE_WAKEUPTIMER_EVENT) | |||
| /** | |||
| * @brief Clear the RTC Tamper and Timestamp associated D2 Exti line flag. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_RTC_TAMPER_TIMESTAMP_EXTID2_CLEAR_FLAG() (EXTI_D2->PR1 = RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) | |||
| #endif | |||
| /** | |||
| * @brief Generate a Software interrupt on the RTC Tamper and Timestamp associated Exti line | |||
| * @retval None | |||
| @@ -935,7 +1006,7 @@ HAL_StatusTypeDef HAL_RTCEx_PollForTamper3Event(RTC_HandleTypeDef *hrtc, uint32_ | |||
| */ | |||
| HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock); | |||
| HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock); | |||
| uint32_t HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc); | |||
| HAL_StatusTypeDef HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc); | |||
| uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc); | |||
| void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc); | |||
| void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc); | |||
| @@ -983,12 +1054,12 @@ HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t | |||
| /** @defgroup RTCEx_Private_Constants RTCEx Private Constants | |||
| * @{ | |||
| */ | |||
| #define RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT ((uint32_t)0x00040000) /*!< External interrupt line 18 Connected to the RTC Tamper and Time Stamp events */ | |||
| #define RTC_EXTI_LINE_WAKEUPTIMER_EVENT ((uint32_t)0x00080000) /*!< External interrupt line 19 Connected to the RTC Wakeup event */ | |||
| #define RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT EXTI_IMR1_IM18 /*!< External interrupt line 18 Connected to the RTC Tamper and Time Stamp events */ | |||
| #define RTC_EXTI_LINE_WAKEUPTIMER_EVENT EXTI_IMR1_IM19 /*!< External interrupt line 19 Connected to the RTC Wakeup event */ | |||
| /* Masks Definition */ | |||
| #define RTC_TAMPCR_TAMPXE ((uint32_t) (RTC_TAMPCR_TAMP3E | RTC_TAMPCR_TAMP2E | RTC_TAMPCR_TAMP1E)) | |||
| #define RTC_TAMPCR_TAMPXIE ((uint32_t) (RTC_TAMPER1_INTERRUPT | RTC_TAMPER2_INTERRUPT | RTC_TAMPER3_INTERRUPT | RTC_ALL_TAMPER_INTERRUPT)) | |||
| #define RTC_TAMPCR_TAMPXE (RTC_TAMPCR_TAMP3E | RTC_TAMPCR_TAMP2E | RTC_TAMPCR_TAMP1E) | |||
| #define RTC_TAMPCR_TAMPXIE (RTC_TAMPER1_INTERRUPT | RTC_TAMPER2_INTERRUPT | RTC_TAMPER3_INTERRUPT | RTC_ALL_TAMPER_INTERRUPT) | |||
| /** | |||
| * @} | |||
| @@ -1008,14 +1079,14 @@ HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t | |||
| ((OUTPUT) == RTC_OUTPUT_ALARMB) || \ | |||
| ((OUTPUT) == RTC_OUTPUT_WAKEUP)) | |||
| #define IS_RTC_BKP(BKP) ((BKP) < (uint32_t) RTC_BKP_NUMBER) | |||
| #define IS_RTC_BKP(BKP) ((BKP) < RTC_BKP_NUMBER) | |||
| #define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \ | |||
| ((EDGE) == RTC_TIMESTAMPEDGE_FALLING)) | |||
| #define IS_RTC_TAMPER(__TAMPER__) ((((__TAMPER__) & ((uint32_t)(0xFFFFFFFFU ^ RTC_TAMPCR_TAMPXE))) == 0x00U) && ((__TAMPER__) != (uint32_t)RESET)) | |||
| #define IS_RTC_TAMPER(__TAMPER__) ((((__TAMPER__) & (0xFFFFFFFFu ^ RTC_TAMPCR_TAMPXE)) == 0x00u) && ((__TAMPER__) != 0u)) | |||
| #define IS_RTC_TAMPER_INTERRUPT(__INTERRUPT__) ((((__INTERRUPT__) & (uint32_t)(0xFFFFFFFFU ^ RTC_TAMPCR_TAMPXIE)) == 0x00U) && ((__INTERRUPT__) != (uint32_t)RESET)) | |||
| #define IS_RTC_TAMPER_INTERRUPT(__INTERRUPT__) ((((__INTERRUPT__) & (0xFFFFFFFFu ^ RTC_TAMPCR_TAMPXIE)) == 0x00u) && ((__INTERRUPT__) != 0u)) | |||
| #define IS_RTC_TIMESTAMP_PIN(PIN) (((PIN) == RTC_TIMESTAMPPIN_DEFAULT)) | |||
| @@ -1042,12 +1113,12 @@ HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t | |||
| ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \ | |||
| ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \ | |||
| ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \ | |||
| ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256)) | |||
| ((FREQ) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256)) | |||
| #define IS_RTC_TAMPER_PRECHARGE_DURATION(DURATION) (((DURATION) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \ | |||
| ((DURATION) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \ | |||
| ((DURATION) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \ | |||
| ((DURATION) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK)) | |||
| ((DURATION) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK)) | |||
| #define IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(DETECTION) (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \ | |||
| ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE)) | |||
| @@ -1062,7 +1133,7 @@ HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t | |||
| ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \ | |||
| ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS)) | |||
| #define IS_RTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= 0xFFFF) | |||
| #define IS_RTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= RTC_WUTR_WUT) | |||
| #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \ | |||
| ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \ | |||
| @@ -1071,16 +1142,23 @@ HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t | |||
| #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \ | |||
| ((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_RESET)) | |||
| #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= 0x000001FF) | |||
| #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= RTC_CALR_CALM) | |||
| #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_SHIFTADD1S_RESET) || \ | |||
| ((SEL) == RTC_SHIFTADD1S_SET)) | |||
| #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= 0x00007FFF) | |||
| #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= RTC_SHIFTR_SUBFS) | |||
| #define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CALIBOUTPUT_512HZ) || \ | |||
| ((OUTPUT) == RTC_CALIBOUTPUT_1HZ)) | |||
| #define IS_RTC_TAMPER_FILTER_CONFIG_CORRECT(FILTER, TRIGGER) \ | |||
| ( ( ((FILTER) != RTC_TAMPERFILTER_DISABLE) \ | |||
| && ( ((TRIGGER) == RTC_TAMPERTRIGGER_LOWLEVEL) \ | |||
| || ((TRIGGER) == RTC_TAMPERTRIGGER_HIGHLEVEL))) \ | |||
| || ( ((FILTER) == RTC_TAMPERFILTER_DISABLE) \ | |||
| && ( ((TRIGGER) == RTC_TAMPERTRIGGER_RISINGEDGE) \ | |||
| || ((TRIGGER) == RTC_TAMPERTRIGGER_FALLINGEDGE)))) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -1099,8 +1177,8 @@ HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __cplusplus */ | |||
| #endif /* __STM32H7xx_HAL_RTC_EX_H */ | |||
| #endif /* STM32H7xx_HAL_RTC_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,48 +2,29 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_sai.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of SAI HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_SAI_H | |||
| #define __STM32H7xx_HAL_SAI_H | |||
| #ifndef STM32H7xx_HAL_SAI_H | |||
| #define STM32H7xx_HAL_SAI_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_hal_def.h" | |||
| @@ -83,9 +64,9 @@ typedef void (*SAIcallback)(void); | |||
| */ | |||
| typedef struct | |||
| { | |||
| FunctionalState Activation; /*!< Enable/Disable PDM interface */ | |||
| FunctionalState Activation; /*!< Enable/disable PDM interface */ | |||
| uint32_t MicPairsNbr; /*!< Specifies the number of microphone pairs used. | |||
| This parameter must be a number between Min_Data = 1 and Max_Data = 4. */ | |||
| This parameter must be a number between Min_Data = 1 and Max_Data = 3. */ | |||
| uint32_t ClockEnable; /*!< Specifies which clock must be enabled. | |||
| This parameter can be a values combination of @ref SAI_PDM_ClockEnable */ | |||
| } SAI_PdmInitTypeDef; | |||
| @@ -93,7 +74,6 @@ typedef struct | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Init_Structure_definition SAI Init Structure definition | |||
| * @brief SAI Init Structure definition | |||
| * @{ | |||
| @@ -109,22 +89,25 @@ typedef struct | |||
| 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 */ | |||
| @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 MckOutput; /*!< Specifies whether master clock output will be generated or not. | |||
| This parameter can be a value of @ref SAI_Block_MckOutput | |||
| @note This feature is only available on STM32H7xx Rev.B and above */ | |||
| 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. */ | |||
| @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 NOMCK 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 NOMCK 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. */ | |||
| @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 from 8 to 256. | |||
| @note The NODIV bit is the same as NOMCK bit in STM32H7xx rev.Y */ | |||
| uint32_t FIFOThreshold; /*!< Specifies SAI Block FIFO threshold. | |||
| This parameter can be a value of @ref SAI_Block_Fifo_Threshold */ | |||
| @@ -134,7 +117,7 @@ typedef struct | |||
| 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 = 63 */ | |||
| This parameter must be a number between Min_Data = 0 and Max_Data = 63. */ | |||
| uint32_t MckOverSampling; /*!< Specifies the master clock oversampling. | |||
| This parameter can be a value of @ref SAI_Block_Mck_OverSampling */ | |||
| @@ -178,9 +161,9 @@ 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. */ | |||
| @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) | |||
| @@ -256,17 +239,47 @@ typedef struct __SAI_HandleTypeDef | |||
| __IO HAL_SAI_StateTypeDef State; /*!< SAI communication state */ | |||
| __IO uint32_t ErrorCode; /*!< SAI Error code */ | |||
| #if (USE_HAL_SAI_REGISTER_CALLBACKS == 1) | |||
| void (*RxCpltCallback)(struct __SAI_HandleTypeDef *hsai); /*!< SAI receive complete callback */ | |||
| void (*RxHalfCpltCallback)(struct __SAI_HandleTypeDef *hsai); /*!< SAI receive half complete callback */ | |||
| void (*TxCpltCallback)(struct __SAI_HandleTypeDef *hsai); /*!< SAI transmit complete callback */ | |||
| void (*TxHalfCpltCallback)(struct __SAI_HandleTypeDef *hsai); /*!< SAI transmit half complete callback */ | |||
| void (*ErrorCallback)(struct __SAI_HandleTypeDef *hsai); /*!< SAI error callback */ | |||
| void (*MspInitCallback)(struct __SAI_HandleTypeDef *hsai); /*!< SAI MSP init callback */ | |||
| void (*MspDeInitCallback)(struct __SAI_HandleTypeDef *hsai); /*!< SAI MSP de-init callback */ | |||
| #endif | |||
| } SAI_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| #if (USE_HAL_SAI_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief SAI callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_SAI_RX_COMPLETE_CB_ID = 0x00U, /*!< SAI receive complete callback ID */ | |||
| HAL_SAI_RX_HALFCOMPLETE_CB_ID = 0x01U, /*!< SAI receive half complete callback ID */ | |||
| HAL_SAI_TX_COMPLETE_CB_ID = 0x02U, /*!< SAI transmit complete callback ID */ | |||
| HAL_SAI_TX_HALFCOMPLETE_CB_ID = 0x03U, /*!< SAI transmit half complete callback ID */ | |||
| HAL_SAI_ERROR_CB_ID = 0x04U, /*!< SAI error callback ID */ | |||
| HAL_SAI_MSPINIT_CB_ID = 0x05U, /*!< SAI MSP init callback ID */ | |||
| HAL_SAI_MSPDEINIT_CB_ID = 0x06U /*!< SAI MSP de-init callback ID */ | |||
| } HAL_SAI_CallbackIDTypeDef; | |||
| /** | |||
| * @brief SAI callback pointer definition | |||
| */ | |||
| typedef void (*pSAI_CallbackTypeDef)(SAI_HandleTypeDef *hsai); | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup SAI_Exported_Constants SAI Exported Constants | |||
| * @{ | |||
| */ | |||
| @@ -274,15 +287,18 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @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 */ | |||
| #define HAL_SAI_ERROR_NONE 0x00000000U /*!< No error */ | |||
| #define HAL_SAI_ERROR_OVR 0x00000001U /*!< Overrun Error */ | |||
| #define HAL_SAI_ERROR_UDR 0x00000002U /*!< Underrun error */ | |||
| #define HAL_SAI_ERROR_AFSDET 0x00000004U /*!< Anticipated Frame synchronisation detection */ | |||
| #define HAL_SAI_ERROR_LFSDET 0x00000008U /*!< Late Frame synchronisation detection */ | |||
| #define HAL_SAI_ERROR_CNREADY 0x00000010U /*!< codec not ready */ | |||
| #define HAL_SAI_ERROR_WCKCFG 0x00000020U /*!< Wrong clock configuration */ | |||
| #define HAL_SAI_ERROR_TIMEOUT 0x00000040U /*!< Timeout error */ | |||
| #define HAL_SAI_ERROR_DMA 0x00000080U /*!< DMA error */ | |||
| #if (USE_HAL_SAI_REGISTER_CALLBACKS == 1) | |||
| #define HAL_SAI_ERROR_INVALID_CALLBACK 0x00000100U /*!< Invalid callback error */ | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -290,9 +306,18 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @defgroup SAI_Block_SyncExt SAI External synchronisation | |||
| * @{ | |||
| */ | |||
| #define SAI_SYNCEXT_DISABLE 0 | |||
| #define SAI_SYNCEXT_OUTBLOCKA_ENABLE 1 | |||
| #define SAI_SYNCEXT_OUTBLOCKB_ENABLE 2 | |||
| #define SAI_SYNCEXT_DISABLE 0U | |||
| #define SAI_SYNCEXT_OUTBLOCKA_ENABLE 1U | |||
| #define SAI_SYNCEXT_OUTBLOCKB_ENABLE 2U | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_MckOutput SAI Block Master Clock Output | |||
| * @{ | |||
| */ | |||
| #define SAI_MCK_OUTPUT_DISABLE 0x00000000U | |||
| #define SAI_MCK_OUTPUT_ENABLE SAI_xCR1_MCKEN | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -300,11 +325,11 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @defgroup SAI_Protocol SAI Supported protocol | |||
| * @{ | |||
| */ | |||
| #define SAI_I2S_STANDARD 0 | |||
| #define SAI_I2S_MSBJUSTIFIED 1 | |||
| #define SAI_I2S_LSBJUSTIFIED 2 | |||
| #define SAI_PCM_LONG 3 | |||
| #define SAI_PCM_SHORT 4 | |||
| #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 | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -312,10 +337,10 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @defgroup SAI_Protocol_DataSize SAI protocol data size | |||
| * @{ | |||
| */ | |||
| #define SAI_PROTOCOL_DATASIZE_16BIT 0 | |||
| #define SAI_PROTOCOL_DATASIZE_16BITEXTENDED 1 | |||
| #define SAI_PROTOCOL_DATASIZE_24BIT 2 | |||
| #define SAI_PROTOCOL_DATASIZE_32BIT 3 | |||
| #define SAI_PROTOCOL_DATASIZE_16BIT 0U | |||
| #define SAI_PROTOCOL_DATASIZE_16BITEXTENDED 1U | |||
| #define SAI_PROTOCOL_DATASIZE_24BIT 2U | |||
| #define SAI_PROTOCOL_DATASIZE_32BIT 3U | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -323,16 +348,16 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @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) | |||
| #define SAI_AUDIO_FREQUENCY_192K 192000U | |||
| #define SAI_AUDIO_FREQUENCY_96K 96000U | |||
| #define SAI_AUDIO_FREQUENCY_48K 48000U | |||
| #define SAI_AUDIO_FREQUENCY_44K 44100U | |||
| #define SAI_AUDIO_FREQUENCY_32K 32000U | |||
| #define SAI_AUDIO_FREQUENCY_22K 22050U | |||
| #define SAI_AUDIO_FREQUENCY_16K 16000U | |||
| #define SAI_AUDIO_FREQUENCY_11K 11025U | |||
| #define SAI_AUDIO_FREQUENCY_8K 8000U | |||
| #define SAI_AUDIO_FREQUENCY_MCKDIV 0U | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -340,8 +365,8 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @defgroup SAI_Block_Mck_OverSampling SAI Block Master Clock OverSampling | |||
| * @{ | |||
| */ | |||
| #define SAI_MCK_OVERSAMPLING_DISABLE ((uint32_t)0x00000000U) | |||
| #define SAI_MCK_OVERSAMPLING_ENABLE ((uint32_t)SAI_xCR1_OSR) | |||
| #define SAI_MCK_OVERSAMPLING_DISABLE 0x00000000U | |||
| #define SAI_MCK_OVERSAMPLING_ENABLE SAI_xCR1_OSR | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -349,10 +374,8 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @defgroup SAI_PDM_ClockEnable SAI PDM Clock Enable | |||
| * @{ | |||
| */ | |||
| #define SAI_PDM_CLOCK1_ENABLE ((uint32_t)SAI_PDMCR_CKEN1) | |||
| #define SAI_PDM_CLOCK2_ENABLE ((uint32_t)SAI_PDMCR_CKEN2) | |||
| #define SAI_PDM_CLOCK3_ENABLE ((uint32_t)SAI_PDMCR_CKEN3) | |||
| #define SAI_PDM_CLOCK4_ENABLE ((uint32_t)SAI_PDMCR_CKEN4) | |||
| #define SAI_PDM_CLOCK1_ENABLE SAI_PDMCR_CKEN1 | |||
| #define SAI_PDM_CLOCK2_ENABLE SAI_PDMCR_CKEN2 | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -360,10 +383,10 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @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)) | |||
| #define SAI_MODEMASTER_TX 0x00000000U | |||
| #define SAI_MODEMASTER_RX SAI_xCR1_MODE_0 | |||
| #define SAI_MODESLAVE_TX SAI_xCR1_MODE_1 | |||
| #define SAI_MODESLAVE_RX (SAI_xCR1_MODE_1 | SAI_xCR1_MODE_0) | |||
| /** | |||
| * @} | |||
| @@ -372,9 +395,9 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @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) | |||
| #define SAI_FREE_PROTOCOL 0x00000000U | |||
| #define SAI_SPDIF_PROTOCOL SAI_xCR1_PRTCFG_0 | |||
| #define SAI_AC97_PROTOCOL SAI_xCR1_PRTCFG_1 | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -382,12 +405,12 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @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)) | |||
| #define SAI_DATASIZE_8 SAI_xCR1_DS_1 | |||
| #define SAI_DATASIZE_10 (SAI_xCR1_DS_1 | SAI_xCR1_DS_0) | |||
| #define SAI_DATASIZE_16 SAI_xCR1_DS_2 | |||
| #define SAI_DATASIZE_20 (SAI_xCR1_DS_2 | SAI_xCR1_DS_0) | |||
| #define SAI_DATASIZE_24 (SAI_xCR1_DS_2 | SAI_xCR1_DS_1) | |||
| #define SAI_DATASIZE_32 (SAI_xCR1_DS_2 | SAI_xCR1_DS_1 | SAI_xCR1_DS_0) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -395,8 +418,8 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @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) | |||
| #define SAI_FIRSTBIT_MSB 0x00000000U | |||
| #define SAI_FIRSTBIT_LSB SAI_xCR1_LSBFIRST | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -404,8 +427,8 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @defgroup SAI_Block_Clock_Strobing SAI Block Clock Strobing | |||
| * @{ | |||
| */ | |||
| #define SAI_CLOCKSTROBING_FALLINGEDGE 0 | |||
| #define SAI_CLOCKSTROBING_RISINGEDGE 1 | |||
| #define SAI_CLOCKSTROBING_FALLINGEDGE 0U | |||
| #define SAI_CLOCKSTROBING_RISINGEDGE 1U | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -413,10 +436,12 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @defgroup SAI_Block_Synchronization SAI Block Synchronization | |||
| * @{ | |||
| */ | |||
| #define SAI_ASYNCHRONOUS 0 /*!< Asynchronous */ | |||
| #define SAI_SYNCHRONOUS 1 /*!< Synchronous with other block of same SAI */ | |||
| #define SAI_SYNCHRONOUS_EXT_SAI1 2 /*!< Synchronous with other SAI, SAI1 */ | |||
| #define SAI_SYNCHRONOUS_EXT_SAI2 3 /*!< Synchronous with other SAI, SAI2 */ | |||
| #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 */ | |||
| #define SAI_SYNCHRONOUS_EXT_SAI3 4U /*!< Synchronous with other SAI, SAI3 */ | |||
| #define SAI_SYNCHRONOUS_EXT_SAI4 5U /*!< Synchronous with other SAI, SAI4 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -424,8 +449,8 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @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) | |||
| #define SAI_OUTPUTDRIVE_DISABLE 0x00000000U | |||
| #define SAI_OUTPUTDRIVE_ENABLE SAI_xCR1_OUTDRIV | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -433,18 +458,17 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @defgroup SAI_Block_NoDivider SAI Block NoDivider | |||
| * @{ | |||
| */ | |||
| #define SAI_MASTERDIVIDER_ENABLE ((uint32_t)0x00000000U) | |||
| #define SAI_MASTERDIVIDER_DISABLE ((uint32_t)SAI_xCR1_NOMCK) | |||
| #define SAI_MASTERDIVIDER_ENABLE 0x00000000U | |||
| #define SAI_MASTERDIVIDER_DISABLE 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) | |||
| #define SAI_FS_STARTFRAME 0x00000000U | |||
| #define SAI_FS_CHANNEL_IDENTIFICATION SAI_xFRCR_FSDEF | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -452,8 +476,8 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @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) | |||
| #define SAI_FS_ACTIVE_LOW 0x00000000U | |||
| #define SAI_FS_ACTIVE_HIGH SAI_xFRCR_FSPOL | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -461,19 +485,18 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @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) | |||
| #define SAI_FS_FIRSTBIT 0x00000000U | |||
| #define SAI_FS_BEFOREFIRSTBIT SAI_xFRCR_FSOFF | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SAI_Block_Slot_Size SAI Block Slot Size | |||
| /** @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) | |||
| #define SAI_SLOTSIZE_DATASIZE 0x00000000U | |||
| #define SAI_SLOTSIZE_16B SAI_xSLOTR_SLOTSZ_0 | |||
| #define SAI_SLOTSIZE_32B SAI_xSLOTR_SLOTSZ_1 | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -481,24 +504,24 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @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) | |||
| #define SAI_SLOT_NOTACTIVE 0x00000000U | |||
| #define SAI_SLOTACTIVE_0 0x00000001U | |||
| #define SAI_SLOTACTIVE_1 0x00000002U | |||
| #define SAI_SLOTACTIVE_2 0x00000004U | |||
| #define SAI_SLOTACTIVE_3 0x00000008U | |||
| #define SAI_SLOTACTIVE_4 0x00000010U | |||
| #define SAI_SLOTACTIVE_5 0x00000020U | |||
| #define SAI_SLOTACTIVE_6 0x00000040U | |||
| #define SAI_SLOTACTIVE_7 0x00000080U | |||
| #define SAI_SLOTACTIVE_8 0x00000100U | |||
| #define SAI_SLOTACTIVE_9 0x00000200U | |||
| #define SAI_SLOTACTIVE_10 0x00000400U | |||
| #define SAI_SLOTACTIVE_11 0x00000800U | |||
| #define SAI_SLOTACTIVE_12 0x00001000U | |||
| #define SAI_SLOTACTIVE_13 0x00002000U | |||
| #define SAI_SLOTACTIVE_14 0x00004000U | |||
| #define SAI_SLOTACTIVE_15 0x00008000U | |||
| #define SAI_SLOTACTIVE_ALL 0x0000FFFFU | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -506,8 +529,8 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @defgroup SAI_Mono_Stereo_Mode SAI Mono Stereo Mode | |||
| * @{ | |||
| */ | |||
| #define SAI_STEREOMODE ((uint32_t)0x00000000U) | |||
| #define SAI_MONOMODE ((uint32_t)SAI_xCR1_MONO) | |||
| #define SAI_STEREOMODE 0x00000000U | |||
| #define SAI_MONOMODE SAI_xCR1_MONO | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -515,8 +538,8 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @defgroup SAI_TRIState_Management SAI TRIState Management | |||
| * @{ | |||
| */ | |||
| #define SAI_OUTPUT_NOTRELEASED ((uint32_t)0x00000000U) | |||
| #define SAI_OUTPUT_RELEASED ((uint32_t)SAI_xCR2_TRIS) | |||
| #define SAI_OUTPUT_NOTRELEASED 0x00000000U | |||
| #define SAI_OUTPUT_RELEASED SAI_xCR2_TRIS | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -524,11 +547,11 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @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)) | |||
| #define SAI_FIFOTHRESHOLD_EMPTY 0x00000000U | |||
| #define SAI_FIFOTHRESHOLD_1QF SAI_xCR2_FTH_0 | |||
| #define SAI_FIFOTHRESHOLD_HF SAI_xCR2_FTH_1 | |||
| #define SAI_FIFOTHRESHOLD_3QF (SAI_xCR2_FTH_1 | SAI_xCR2_FTH_0) | |||
| #define SAI_FIFOTHRESHOLD_FULL SAI_xCR2_FTH_2 | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -536,11 +559,11 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @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)) | |||
| #define SAI_NOCOMPANDING 0x00000000U | |||
| #define SAI_ULAW_1CPL_COMPANDING SAI_xCR2_COMP_1 | |||
| #define SAI_ALAW_1CPL_COMPANDING (SAI_xCR2_COMP_1 | SAI_xCR2_COMP_0) | |||
| #define SAI_ULAW_2CPL_COMPANDING (SAI_xCR2_COMP_1 | SAI_xCR2_CPL) | |||
| #define SAI_ALAW_2CPL_COMPANDING (SAI_xCR2_COMP_1 | SAI_xCR2_COMP_0 | SAI_xCR2_CPL) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -548,8 +571,8 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @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) | |||
| #define SAI_ZERO_VALUE 0x00000000U | |||
| #define SAI_LAST_SENT_VALUE SAI_xCR2_MUTEVAL | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -557,13 +580,13 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @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) | |||
| #define SAI_IT_OVRUDR SAI_xIMR_OVRUDRIE | |||
| #define SAI_IT_MUTEDET SAI_xIMR_MUTEDETIE | |||
| #define SAI_IT_WCKCFG SAI_xIMR_WCKCFGIE | |||
| #define SAI_IT_FREQ SAI_xIMR_FREQIE | |||
| #define SAI_IT_CNRDY SAI_xIMR_CNRDYIE | |||
| #define SAI_IT_AFSDET SAI_xIMR_AFSDETIE | |||
| #define SAI_IT_LFSDET SAI_xIMR_LFSDETIE | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -571,13 +594,13 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @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) | |||
| #define SAI_FLAG_OVRUDR SAI_xSR_OVRUDR | |||
| #define SAI_FLAG_MUTEDET SAI_xSR_MUTEDET | |||
| #define SAI_FLAG_WCKCFG SAI_xSR_WCKCFG | |||
| #define SAI_FLAG_FREQ SAI_xSR_FREQ | |||
| #define SAI_FLAG_CNRDY SAI_xSR_CNRDY | |||
| #define SAI_FLAG_AFSDET SAI_xSR_AFSDET | |||
| #define SAI_FLAG_LFSDET SAI_xSR_LFSDET | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -585,12 +608,12 @@ typedef struct __SAI_HandleTypeDef | |||
| /** @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) | |||
| #define SAI_FIFOSTATUS_EMPTY 0x00000000U | |||
| #define SAI_FIFOSTATUS_LESS1QUARTERFULL 0x00010000U | |||
| #define SAI_FIFOSTATUS_1QUARTERFULL 0x00020000U | |||
| #define SAI_FIFOSTATUS_HALFFULL 0x00030000U | |||
| #define SAI_FIFOSTATUS_3QUARTERFULL 0x00040000U | |||
| #define SAI_FIFOSTATUS_FULL 0x00050000U | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -600,19 +623,26 @@ typedef struct __SAI_HandleTypeDef | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup SAI_Exported_Macros SAI Exported Macros | |||
| * @brief macros to handle interrupts and specific configurations | |||
| * @{ | |||
| */ | |||
| * @brief macros to handle interrupts and specific configurations | |||
| * @{ | |||
| */ | |||
| /** @brief Reset SAI handle state. | |||
| * @param __HANDLE__ specifies the SAI Handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_SAI_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_SAI_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->State = HAL_SAI_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0U) | |||
| #else | |||
| #define __HAL_SAI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SAI_STATE_RESET) | |||
| #endif | |||
| /** @brief Enable or disable the specified SAI interrupts. | |||
| /** @brief Enable 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: | |||
| @@ -626,6 +656,20 @@ typedef struct __SAI_HandleTypeDef | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SAI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IMR |= (__INTERRUPT__)) | |||
| /** @brief 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_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IMR &= (~(__INTERRUPT__))) | |||
| /** @brief Check whether the specified SAI interrupt source is enabled or not. | |||
| @@ -674,10 +718,19 @@ typedef struct __SAI_HandleTypeDef | |||
| */ | |||
| #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) | |||
| /** | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -685,28 +738,33 @@ typedef struct __SAI_HandleTypeDef | |||
| #include "stm32h7xx_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); | |||
| HAL_StatusTypeDef HAL_SAI_DeInit(SAI_HandleTypeDef *hsai); | |||
| void HAL_SAI_MspInit(SAI_HandleTypeDef *hsai); | |||
| void HAL_SAI_MspDeInit(SAI_HandleTypeDef *hsai); | |||
| #if (USE_HAL_SAI_REGISTER_CALLBACKS == 1) | |||
| /* SAI callbacks register/unregister functions ********************************/ | |||
| HAL_StatusTypeDef HAL_SAI_RegisterCallback(SAI_HandleTypeDef *hsai, | |||
| HAL_SAI_CallbackIDTypeDef CallbackID, | |||
| pSAI_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_SAI_UnRegisterCallback(SAI_HandleTypeDef *hsai, | |||
| HAL_SAI_CallbackIDTypeDef CallbackID); | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| /* I/O operation functions ***************************************************/ | |||
| /** @addtogroup SAI_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| @@ -787,11 +845,10 @@ uint32_t HAL_SAI_GetError(SAI_HandleTypeDef *hsai); | |||
| #define IS_SAI_BLOCK_MCK_OVERSAMPLING(VALUE) (((VALUE) == SAI_MCK_OVERSAMPLING_DISABLE) || \ | |||
| ((VALUE) == SAI_MCK_OVERSAMPLING_ENABLE)) | |||
| #define IS_SAI_PDM_MIC_PAIRS_NUMBER(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 4U)) | |||
| #define IS_SAI_PDM_MIC_PAIRS_NUMBER(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 3U)) | |||
| #define IS_SAI_PDM_CLOCK_ENABLE(CLOCK) (((CLOCK) != 0U) && \ | |||
| (((CLOCK) & ~(SAI_PDM_CLOCK1_ENABLE | SAI_PDM_CLOCK2_ENABLE | \ | |||
| SAI_PDM_CLOCK3_ENABLE | SAI_PDM_CLOCK4_ENABLE)) == 0U)) | |||
| (((CLOCK) & ~(SAI_PDM_CLOCK1_ENABLE | SAI_PDM_CLOCK2_ENABLE)) == 0U)) | |||
| #define IS_SAI_BLOCK_MODE(MODE) (((MODE) == SAI_MODEMASTER_TX) || \ | |||
| ((MODE) == SAI_MODEMASTER_RX) || \ | |||
| @@ -818,7 +875,12 @@ uint32_t HAL_SAI_GetError(SAI_HandleTypeDef *hsai); | |||
| #define IS_SAI_BLOCK_SYNCHRO(SYNCHRO) (((SYNCHRO) == SAI_ASYNCHRONOUS) || \ | |||
| ((SYNCHRO) == SAI_SYNCHRONOUS) || \ | |||
| ((SYNCHRO) == SAI_SYNCHRONOUS_EXT_SAI1) || \ | |||
| ((SYNCHRO) == SAI_SYNCHRONOUS_EXT_SAI2)) | |||
| ((SYNCHRO) == SAI_SYNCHRONOUS_EXT_SAI2) || \ | |||
| ((SYNCHRO) == SAI_SYNCHRONOUS_EXT_SAI3) || \ | |||
| ((SYNCHRO) == SAI_SYNCHRONOUS_EXT_SAI4)) | |||
| #define IS_SAI_BLOCK_MCK_OUTPUT(VALUE) (((VALUE) == SAI_MCK_OUTPUT_ENABLE) || \ | |||
| ((VALUE) == SAI_MCK_OUTPUT_DISABLE)) | |||
| #define IS_SAI_BLOCK_OUTPUT_DRIVE(DRIVE) (((DRIVE) == SAI_OUTPUTDRIVE_DISABLE) || \ | |||
| ((DRIVE) == SAI_OUTPUTDRIVE_ENABLE)) | |||
| @@ -826,7 +888,7 @@ uint32_t HAL_SAI_GetError(SAI_HandleTypeDef *hsai); | |||
| #define IS_SAI_BLOCK_NODIVIDER(NODIVIDER) (((NODIVIDER) == SAI_MASTERDIVIDER_ENABLE) || \ | |||
| ((NODIVIDER) == SAI_MASTERDIVIDER_DISABLE)) | |||
| #define IS_SAI_BLOCK_MUTE_COUNTER(COUNTER) ((COUNTER) <= 63) | |||
| #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)) | |||
| @@ -851,13 +913,13 @@ uint32_t HAL_SAI_GetError(SAI_HandleTypeDef *hsai); | |||
| #define IS_SAI_SLOT_ACTIVE(ACTIVE) ((ACTIVE) <= SAI_SLOTACTIVE_ALL) | |||
| #define IS_SAI_BLOCK_SLOT_NUMBER(NUMBER) ((1 <= (NUMBER)) && ((NUMBER) <= 16)) | |||
| #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) <= 24) | |||
| #define IS_SAI_BLOCK_FIRSTBIT_OFFSET(OFFSET) ((OFFSET) <= 24U) | |||
| #define IS_SAI_BLOCK_FS_OFFSET(OFFSET) (((OFFSET) == SAI_FS_FIRSTBIT) || \ | |||
| ((OFFSET) == SAI_FS_BEFOREFIRSTBIT)) | |||
| @@ -868,11 +930,11 @@ uint32_t HAL_SAI_GetError(SAI_HandleTypeDef *hsai); | |||
| #define IS_SAI_BLOCK_FS_DEFINITION(DEFINITION) (((DEFINITION) == SAI_FS_STARTFRAME) || \ | |||
| ((DEFINITION) == SAI_FS_CHANNEL_IDENTIFICATION)) | |||
| #define IS_SAI_BLOCK_MASTER_DIVIDER(DIVIDER) ((DIVIDER) <= 63) | |||
| #define IS_SAI_BLOCK_MASTER_DIVIDER(DIVIDER) ((DIVIDER) <= 63U) | |||
| #define IS_SAI_BLOCK_FRAME_LENGTH(LENGTH) ((8 <= (LENGTH)) && ((LENGTH) <= 256)) | |||
| #define IS_SAI_BLOCK_FRAME_LENGTH(LENGTH) ((8U <= (LENGTH)) && ((LENGTH) <= 256U)) | |||
| #define IS_SAI_BLOCK_ACTIVE_FRAME(LENGTH) ((1 <= (LENGTH)) && ((LENGTH) <= 128)) | |||
| #define IS_SAI_BLOCK_ACTIVE_FRAME(LENGTH) ((1U <= (LENGTH)) && ((LENGTH) <= 128U)) | |||
| /** | |||
| * @} | |||
| @@ -899,6 +961,6 @@ uint32_t HAL_SAI_GetError(SAI_HandleTypeDef *hsai); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_SAI_H */ | |||
| #endif /* STM32H7xx_HAL_SAI_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_sai_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of SAI HAL extended module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_SAI_EX_H | |||
| #define __STM32H7xx_HAL_SAI_EX_H | |||
| #ifndef STM32H7xx_HAL_SAI_EX_H | |||
| #define STM32H7xx_HAL_SAI_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -55,7 +37,6 @@ | |||
| */ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /** @defgroup SAIEx_Exported_Types SAIEx Exported Types | |||
| * @{ | |||
| */ | |||
| @@ -66,14 +47,14 @@ | |||
| typedef struct | |||
| { | |||
| uint32_t MicPair; /*!< Specifies which pair of microphones is selected. | |||
| This parameter must be a number between Min_Data = 1 and Max_Data = 4. */ | |||
| This parameter must be a number between Min_Data = 1 and Max_Data = 3. */ | |||
| uint32_t LeftDelay; /*!< Specifies the delay in PDM clock unit to apply on left microphone. | |||
| This parameter must be a number between Min_Data = 0 and Max_Data = 7. */ | |||
| uint32_t RightDelay; /*!< Specifies the delay in PDM clock unit to apply on right microphone. | |||
| This parameter must be a number between Min_Data = 0 and Max_Data = 7. */ | |||
| }SAIEx_PdmMicDelayParamTypeDef; | |||
| } SAIEx_PdmMicDelayParamTypeDef; | |||
| /** | |||
| * @} | |||
| @@ -82,7 +63,6 @@ typedef struct | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /* Exported macros -----------------------------------------------------------*/ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup SAIEx_Exported_Functions SAIEx Extended Exported Functions | |||
| * @{ | |||
| */ | |||
| @@ -90,9 +70,7 @@ typedef struct | |||
| /** @addtogroup SAIEx_Exported_Functions_Group1 Peripheral Control functions | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_SAIEx_ConfigPdmMicDelay(SAI_HandleTypeDef *hsai, SAIEx_PdmMicDelayParamTypeDef *pdmMicDelay); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -102,13 +80,10 @@ HAL_StatusTypeDef HAL_SAIEx_ConfigPdmMicDelay(SAI_HandleTypeDef *hsai, SAIEx_Pdm | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @addtogroup SAIEx_Private_Macros SAIEx Extended Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_SAI_PDM_MIC_DELAY(VALUE) ((VALUE) <= 7U) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -125,6 +100,6 @@ HAL_StatusTypeDef HAL_SAIEx_ConfigPdmMicDelay(SAI_HandleTypeDef *hsai, SAIEx_Pdm | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_SAI_EX_H */ | |||
| #endif /* STM32H7xx_HAL_SAI_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_sd.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of SD HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_SD_H | |||
| #define __STM32H7xx_HAL_SD_H | |||
| #ifndef STM32H7xx_HAL_SD_H | |||
| #define STM32H7xx_HAL_SD_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -45,13 +27,15 @@ | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_ll_sdmmc.h" | |||
| #if defined (DLYB_SDMMC1) || defined (DLYB_SDMMC2) || defined (DLYB_SDMMC3) | |||
| #include "stm32h7xx_ll_delayblock.h" | |||
| #endif /* (DLYB_SDMMC1) || (DLYB_SDMMC2) */ | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| /** @addtogroup SD | |||
| /** @defgroup SD SD | |||
| * @brief SD HAL module driver | |||
| * @{ | |||
| */ | |||
| @@ -71,7 +55,7 @@ typedef enum | |||
| HAL_SD_STATE_TIMEOUT = ((uint32_t)0x00000002U), /*!< SD Timeout state */ | |||
| HAL_SD_STATE_BUSY = ((uint32_t)0x00000003U), /*!< SD process ongoing */ | |||
| HAL_SD_STATE_PROGRAMMING = ((uint32_t)0x00000004U), /*!< SD Programming State */ | |||
| HAL_SD_STATE_RECEIVING = ((uint32_t)0x00000005U), /*!< SD Receinving State */ | |||
| HAL_SD_STATE_RECEIVING = ((uint32_t)0x00000005U), /*!< SD Receiving State */ | |||
| HAL_SD_STATE_TRANSFER = ((uint32_t)0x00000006U), /*!< SD Transfert State */ | |||
| HAL_SD_STATE_ERROR = ((uint32_t)0x0000000FU) /*!< SD is in error state */ | |||
| }HAL_SD_StateTypeDef; | |||
| @@ -82,18 +66,17 @@ typedef enum | |||
| /** @defgroup SD_Exported_Types_Group2 SD Card State enumeration structure | |||
| * @{ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_SD_CARD_READY = ((uint32_t)0x00000001U), /*!< Card state is ready */ | |||
| HAL_SD_CARD_IDENTIFICATION = ((uint32_t)0x00000002U), /*!< Card is in identification state */ | |||
| HAL_SD_CARD_STANDBY = ((uint32_t)0x00000003U), /*!< Card is in standby state */ | |||
| HAL_SD_CARD_TRANSFER = ((uint32_t)0x00000004U), /*!< Card is in transfer state */ | |||
| HAL_SD_CARD_SENDING = ((uint32_t)0x00000005U), /*!< Card is sending an operation */ | |||
| HAL_SD_CARD_RECEIVING = ((uint32_t)0x00000006U), /*!< Card is receiving operation information */ | |||
| HAL_SD_CARD_PROGRAMMING = ((uint32_t)0x00000007U), /*!< Card is in programming state */ | |||
| HAL_SD_CARD_DISCONNECTED = ((uint32_t)0x00000008U), /*!< Card is disconnected */ | |||
| HAL_SD_CARD_ERROR = ((uint32_t)0x000000FFU) /*!< Card response Error */ | |||
| }HAL_SD_CardStateTypedef; | |||
| typedef uint32_t HAL_SD_CardStateTypedef; | |||
| #define HAL_SD_CARD_READY 0x00000001U /*!< Card state is ready */ | |||
| #define HAL_SD_CARD_IDENTIFICATION 0x00000002U /*!< Card is in identification state */ | |||
| #define HAL_SD_CARD_STANDBY 0x00000003U /*!< Card is in standby state */ | |||
| #define HAL_SD_CARD_TRANSFER 0x00000004U /*!< Card is in transfer state */ | |||
| #define HAL_SD_CARD_SENDING 0x00000005U /*!< Card is sending an operation */ | |||
| #define HAL_SD_CARD_RECEIVING 0x00000006U /*!< Card is receiving operation information */ | |||
| #define HAL_SD_CARD_PROGRAMMING 0x00000007U /*!< Card is in programming state */ | |||
| #define HAL_SD_CARD_DISCONNECTED 0x00000008U /*!< Card is disconnected */ | |||
| #define HAL_SD_CARD_ERROR 0x000000FFU /*!< Card response Error */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -132,8 +115,11 @@ typedef struct | |||
| /** | |||
| * @brief SD handle Structure definition | |||
| */ | |||
| #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U) | |||
| typedef struct __SD_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_SD_REGISTER_CALLBACKS */ | |||
| { | |||
| SD_TypeDef *Instance; /*!< SD registers base address */ | |||
| @@ -141,11 +127,11 @@ typedef struct | |||
| HAL_LockTypeDef Lock; /*!< SD locking object */ | |||
| uint32_t *pTxBuffPtr; /*!< Pointer to SD Tx transfer Buffer */ | |||
| uint8_t *pTxBuffPtr; /*!< Pointer to SD Tx transfer Buffer */ | |||
| uint32_t TxXferSize; /*!< SD Tx Transfer size */ | |||
| uint32_t *pRxBuffPtr; /*!< Pointer to SD Rx transfer Buffer */ | |||
| uint8_t *pRxBuffPtr; /*!< Pointer to SD Rx transfer Buffer */ | |||
| uint32_t RxXferSize; /*!< SD Rx Transfer size */ | |||
| @@ -161,9 +147,25 @@ typedef struct | |||
| uint32_t CID[4]; /*!< SD card identification number table */ | |||
| #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U) | |||
| void (* TxCpltCallback) (struct __SD_HandleTypeDef *hsd); | |||
| void (* RxCpltCallback) (struct __SD_HandleTypeDef *hsd); | |||
| void (* ErrorCallback) (struct __SD_HandleTypeDef *hsd); | |||
| void (* AbortCpltCallback) (struct __SD_HandleTypeDef *hsd); | |||
| void (* Read_DMADblBuf0CpltCallback) (struct __SD_HandleTypeDef *hsd); | |||
| void (* Read_DMADblBuf1CpltCallback) (struct __SD_HandleTypeDef *hsd); | |||
| void (* Write_DMADblBuf0CpltCallback) (struct __SD_HandleTypeDef *hsd); | |||
| void (* Write_DMADblBuf1CpltCallback) (struct __SD_HandleTypeDef *hsd); | |||
| #if (USE_SD_TRANSCEIVER != 0U) | |||
| void (* DriveTransceiver_1_8V_Callback) (FlagStatus status); | |||
| #endif /* USE_SD_TRANSCEIVER */ | |||
| void (* MspInitCallback) (struct __SD_HandleTypeDef *hsd); | |||
| void (* MspDeInitCallback) (struct __SD_HandleTypeDef *hsd); | |||
| #endif /* USE_HAL_SD_REGISTER_CALLBACKS */ | |||
| }SD_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -202,7 +204,7 @@ typedef struct | |||
| __IO uint8_t WriteBlockPaPartial; /*!< Partial blocks for write allowed */ | |||
| __IO uint8_t Reserved3; /*!< Reserved */ | |||
| __IO uint8_t ContentProtectAppli; /*!< Content protection application */ | |||
| __IO uint8_t FileFormatGrouop; /*!< File format group */ | |||
| __IO uint8_t FileFormatGroup; /*!< File format group */ | |||
| __IO uint8_t CopyFlag; /*!< Copy flag (OTP) */ | |||
| __IO uint8_t PermWrProtect; /*!< Permanent write protection */ | |||
| __IO uint8_t TempWrProtect; /*!< Temporary write protection */ | |||
| @@ -251,12 +253,47 @@ typedef struct | |||
| __IO uint16_t EraseSize; /*!< Determines the number of AUs to be erased in one operation */ | |||
| __IO uint8_t EraseTimeout; /*!< Determines the timeout for any number of AU erase */ | |||
| __IO uint8_t EraseOffset; /*!< Carries information about the erase offset */ | |||
| __IO uint8_t UhsSpeedGrade; /*!< Carries information about the speed grade of UHS card */ | |||
| __IO uint8_t UhsAllocationUnitSize; /*!< Carries information about the UHS card's allocation unit size */ | |||
| __IO uint8_t VideoSpeedClass; /*!< Carries information about the Video Speed Class of UHS card */ | |||
| }HAL_SD_CardStatusTypedef; | |||
| /** | |||
| * @} | |||
| */ | |||
| #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U) | |||
| /** @defgroup SD_Exported_Types_Group7 SD Callback ID enumeration definition | |||
| * @{ | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_SD_TX_CPLT_CB_ID = 0x00U, /*!< SD Tx Complete Callback ID */ | |||
| HAL_SD_RX_CPLT_CB_ID = 0x01U, /*!< SD Rx Complete Callback ID */ | |||
| HAL_SD_ERROR_CB_ID = 0x02U, /*!< SD Error Callback ID */ | |||
| HAL_SD_ABORT_CB_ID = 0x03U, /*!< SD Abort Callback ID */ | |||
| HAL_SD_READ_DMA_DBL_BUF0_CPLT_CB_ID = 0x04U, /*!< SD Rx DMA Double Buffer 0 Complete Callback ID */ | |||
| HAL_SD_READ_DMA_DBL_BUF1_CPLT_CB_ID = 0x05U, /*!< SD Rx DMA Double Buffer 1 Complete Callback ID */ | |||
| HAL_SD_WRITE_DMA_DBL_BUF0_CPLT_CB_ID = 0x06U, /*!< SD Tx DMA Double Buffer 0 Complete Callback ID */ | |||
| HAL_SD_WRITE_DMA_DBL_BUF1_CPLT_CB_ID = 0x07U, /*!< SD Tx DMA Double Buffer 1 Complete Callback ID */ | |||
| HAL_SD_MSP_INIT_CB_ID = 0x10U, /*!< SD MspInit Callback ID */ | |||
| HAL_SD_MSP_DEINIT_CB_ID = 0x11U /*!< SD MspDeInit Callback ID */ | |||
| }HAL_SD_CallbackIDTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SD_Exported_Types_Group8 SD Callback pointer definition | |||
| * @{ | |||
| */ | |||
| typedef void (*pSD_CallbackTypeDef) (SD_HandleTypeDef *hsd); | |||
| #if (USE_SD_TRANSCEIVER != 0U) | |||
| typedef void (*pSD_TransceiverCallbackTypeDef)(FlagStatus status); | |||
| #endif /* USE_SD_TRANSCEIVER */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* USE_HAL_SD_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -306,8 +343,11 @@ typedef struct | |||
| #define HAL_SD_ERROR_UNSUPPORTED_FEATURE SDMMC_ERROR_UNSUPPORTED_FEATURE /*!< Error when feature is not insupported */ | |||
| #define HAL_SD_ERROR_BUSY SDMMC_ERROR_BUSY /*!< Error when transfer process is busy */ | |||
| #define HAL_SD_ERROR_DMA SDMMC_ERROR_DMA /*!< Error while DMA transfer */ | |||
| #define HAL_SD_ERROR_TIMEOUT SDMMC_ERROR_TIMEOUT /*!< Timeout Error */ | |||
| #define HAL_SD_ERROR_TIMEOUT SDMMC_ERROR_TIMEOUT /*!< Timeout error */ | |||
| #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U) | |||
| #define HAL_SD_ERROR_INVALID_CALLBACK SDMMC_ERROR_INVALID_PARAMETER /*!< Invalid callback error */ | |||
| #endif /* USE_HAL_SD_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -361,6 +401,19 @@ typedef struct | |||
| * @brief macros to handle interrupts and specific clock configurations | |||
| * @{ | |||
| */ | |||
| /** @brief Reset SD handle state. | |||
| * @param __HANDLE__ : SD handle. | |||
| * @retval None | |||
| */ | |||
| #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U) | |||
| #define __HAL_SD_RESET_HANDLE_STATE(__HANDLE__) do { \ | |||
| (__HANDLE__)->State = HAL_SD_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_SD_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SD_STATE_RESET) | |||
| #endif /* USE_HAL_SD_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @brief Enable the SD device interrupt. | |||
| @@ -564,7 +617,7 @@ typedef struct | |||
| * @} | |||
| */ | |||
| /* Include SD HAL Extension module */ | |||
| /* Include SD HAL Extension module */ | |||
| #include "stm32h7xx_hal_sd_ex.h" | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| @@ -580,7 +633,6 @@ HAL_StatusTypeDef HAL_SD_InitCard(SD_HandleTypeDef *hsd); | |||
| HAL_StatusTypeDef HAL_SD_DeInit (SD_HandleTypeDef *hsd); | |||
| void HAL_SD_MspInit(SD_HandleTypeDef *hsd); | |||
| void HAL_SD_MspDeInit(SD_HandleTypeDef *hsd); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -607,8 +659,21 @@ void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd); | |||
| void HAL_SD_ErrorCallback(SD_HandleTypeDef *hsd); | |||
| void HAL_SD_AbortCallback(SD_HandleTypeDef *hsd); | |||
| #if (USE_SD_TRANSCEIVER != 0U) | |||
| /* Callback to switch in 1.8V mode */ | |||
| void HAL_SD_DriveTransciver_1_8V_Callback(FlagStatus status); | |||
| void HAL_SD_DriveTransceiver_1_8V_Callback(FlagStatus status); | |||
| #endif /* USE_SD_TRANSCEIVER */ | |||
| #if defined (USE_HAL_SD_REGISTER_CALLBACKS) && (USE_HAL_SD_REGISTER_CALLBACKS == 1U) | |||
| /* SD callback registering/unregistering */ | |||
| HAL_StatusTypeDef HAL_SD_RegisterCallback (SD_HandleTypeDef *hsd, HAL_SD_CallbackIDTypeDef CallbackID, pSD_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_SD_UnRegisterCallback(SD_HandleTypeDef *hsd, HAL_SD_CallbackIDTypeDef CallbackID); | |||
| #if (USE_SD_TRANSCEIVER != 0U) | |||
| HAL_StatusTypeDef HAL_SD_RegisterTransceiverCallback (SD_HandleTypeDef *hsd, pSD_TransceiverCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_SD_UnRegisterTransceiverCallback(SD_HandleTypeDef *hsd); | |||
| #endif /* USE_SD_TRANSCEIVER */ | |||
| #endif /* USE_HAL_SD_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| @@ -618,6 +683,7 @@ void HAL_SD_DriveTransciver_1_8V_Callback(FlagStatus status); | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_SD_ConfigWideBusOperation(SD_HandleTypeDef *hsd, uint32_t WideMode); | |||
| HAL_StatusTypeDef HAL_SD_ConfigSpeedBusOperation(SD_HandleTypeDef *hsd, uint32_t SpeedMode); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -625,7 +691,6 @@ HAL_StatusTypeDef HAL_SD_ConfigWideBusOperation(SD_HandleTypeDef *hsd, uint32_t | |||
| /** @defgroup SD_Exported_Functions_Group4 SD card related functions | |||
| * @{ | |||
| */ | |||
| HAL_StatusTypeDef HAL_SD_SendSDStatus(SD_HandleTypeDef *hsd, uint32_t *pSDstatus); | |||
| HAL_SD_CardStateTypedef HAL_SD_GetCardState(SD_HandleTypeDef *hsd); | |||
| HAL_StatusTypeDef HAL_SD_GetCardCID(SD_HandleTypeDef *hsd, HAL_SD_CardCIDTypedef *pCID); | |||
| HAL_StatusTypeDef HAL_SD_GetCardCSD(SD_HandleTypeDef *hsd, HAL_SD_CardCSDTypedef *pCSD); | |||
| @@ -734,6 +799,6 @@ HAL_StatusTypeDef HAL_SD_Abort_IT(SD_HandleTypeDef *hsd); | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_SD_H */ | |||
| #endif /* STM32H7xx_HAL_SD_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_sd_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of SD HAL extended module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_SD_EX_H | |||
| #define __STM32H7xx_HAL_SD_EX_H | |||
| #ifndef STM32H7xx_HAL_SD_EX_H | |||
| #define STM32H7xx_HAL_SD_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -126,6 +108,6 @@ void HAL_SDEx_Write_DMADoubleBuffer1CpltCallback(SD_HandleTypeDef *hsd); | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_SDEx_H */ | |||
| #endif /* stm32h7xx_HAL_SDEx_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,50 +2,31 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_sdram.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of SDRAM HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_SDRAM_H | |||
| #define __STM32H7xx_HAL_SDRAM_H | |||
| #ifndef STM32H7xx_HAL_SDRAM_H | |||
| #define STM32H7xx_HAL_SDRAM_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_ll_fmc.h" | |||
| #include "stm32h7xx_hal_mdma.h" | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| @@ -73,12 +54,16 @@ typedef enum | |||
| HAL_SDRAM_STATE_WRITE_PROTECTED = 0x04U, /*!< SDRAM device write protected */ | |||
| HAL_SDRAM_STATE_PRECHARGED = 0x05U /*!< SDRAM device precharged */ | |||
| }HAL_SDRAM_StateTypeDef; | |||
| } HAL_SDRAM_StateTypeDef; | |||
| /** | |||
| * @brief SDRAM handle Structure definition | |||
| */ | |||
| #if (USE_HAL_SDRAM_REGISTER_CALLBACKS == 1) | |||
| typedef struct __SDRAM_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_SDRAM_REGISTER_CALLBACKS */ | |||
| { | |||
| FMC_SDRAM_TypeDef *Instance; /*!< Register base address */ | |||
| @@ -88,9 +73,36 @@ typedef struct | |||
| HAL_LockTypeDef Lock; /*!< SDRAM locking object */ | |||
| MDMA_HandleTypeDef *hmdma; /*!< Pointer MDMA handler */ | |||
| MDMA_HandleTypeDef *hmdma; /*!< Pointer DMA handler */ | |||
| #if (USE_HAL_SDRAM_REGISTER_CALLBACKS == 1) | |||
| void (* MspInitCallback) ( struct __SDRAM_HandleTypeDef * hsdram); /*!< SDRAM Msp Init callback */ | |||
| void (* MspDeInitCallback) ( struct __SDRAM_HandleTypeDef * hsdram); /*!< SDRAM Msp DeInit callback */ | |||
| void (* RefreshErrorCallback) ( struct __SDRAM_HandleTypeDef * hsdram); /*!< SDRAM Refresh Error callback */ | |||
| void (* DmaXferCpltCallback) ( MDMA_HandleTypeDef * hmdma); /*!< SDRAM DMA Xfer Complete callback */ | |||
| void (* DmaXferErrorCallback) ( MDMA_HandleTypeDef * hmdma); /*!< SDRAM DMA Xfer Error callback */ | |||
| #endif | |||
| } SDRAM_HandleTypeDef; | |||
| #if (USE_HAL_SDRAM_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL SDRAM Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_SDRAM_MSP_INIT_CB_ID = 0x00U, /*!< SDRAM MspInit Callback ID */ | |||
| HAL_SDRAM_MSP_DEINIT_CB_ID = 0x01U, /*!< SDRAM MspDeInit Callback ID */ | |||
| HAL_SDRAM_REFRESH_ERR_CB_ID = 0x02U, /*!< SDRAM Refresh Error Callback ID */ | |||
| HAL_SDRAM_DMA_XFER_CPLT_CB_ID = 0x03U, /*!< SDRAM DMA Xfer Complete Callback ID */ | |||
| HAL_SDRAM_DMA_XFER_ERR_CB_ID = 0x04U /*!< SDRAM DMA Xfer Error Callback ID */ | |||
| }HAL_SDRAM_CallbackIDTypeDef; | |||
| }SDRAM_HandleTypeDef; | |||
| /** | |||
| * @brief HAL SDRAM Callback pointer definition | |||
| */ | |||
| typedef void (*pSDRAM_CallbackTypeDef)(SDRAM_HandleTypeDef *hsdram); | |||
| typedef void (*pSDRAM_DmaCallbackTypeDef)(MDMA_HandleTypeDef *hmdma); | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -103,11 +115,18 @@ typedef struct | |||
| */ | |||
| /** @brief Reset SDRAM handle state | |||
| * @param __HANDLE__: specifies the SDRAM handle. | |||
| * @param __HANDLE__ specifies the SDRAM handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_SDRAM_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_SDRAM_RESET_HANDLE_STATE(__HANDLE__) do { \ | |||
| (__HANDLE__)->State = HAL_SDRAM_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_SDRAM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SDRAM_STATE_RESET) | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -147,9 +166,17 @@ HAL_StatusTypeDef HAL_SDRAM_Read_16b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAdd | |||
| 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_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); | |||
| #if (USE_HAL_SDRAM_REGISTER_CALLBACKS == 1) | |||
| /* SDRAM callback registering/unregistering */ | |||
| HAL_StatusTypeDef HAL_SDRAM_RegisterCallback(SDRAM_HandleTypeDef *hsdram, HAL_SDRAM_CallbackIDTypeDef CallbackId, pSDRAM_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_SDRAM_UnRegisterCallback(SDRAM_HandleTypeDef *hsdram, HAL_SDRAM_CallbackIDTypeDef CallbackId); | |||
| HAL_StatusTypeDef HAL_SDRAM_RegisterDmaCallback(SDRAM_HandleTypeDef *hsdram, HAL_SDRAM_CallbackIDTypeDef CallbackId, pSDRAM_DmaCallbackTypeDef pCallback); | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -190,10 +217,11 @@ HAL_SDRAM_StateTypeDef HAL_SDRAM_GetState(SDRAM_HandleTypeDef *hsdram); | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_SDRAM_H */ | |||
| #endif /* STM32H7xx_HAL_SDRAM_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_smartcard_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of SMARTCARD HAL Extended module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_SMARTCARD_EX_H | |||
| #define __STM32H7xx_HAL_SMARTCARD_EX_H | |||
| #ifndef STM32H7xx_HAL_SMARTCARD_EX_H | |||
| #define STM32H7xx_HAL_SMARTCARD_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -73,46 +55,82 @@ | |||
| /** @defgroup SMARTCARDEx_Advanced_Features_Initialization_Type SMARTCARD advanced feature initialization type | |||
| * @{ | |||
| */ | |||
| #define SMARTCARD_ADVFEATURE_NO_INIT ((uint32_t)0x00000000) /*!< No advanced feature initialization */ | |||
| #define SMARTCARD_ADVFEATURE_TXINVERT_INIT ((uint32_t)0x00000001) /*!< TX pin active level inversion */ | |||
| #define SMARTCARD_ADVFEATURE_RXINVERT_INIT ((uint32_t)0x00000002) /*!< RX pin active level inversion */ | |||
| #define SMARTCARD_ADVFEATURE_DATAINVERT_INIT ((uint32_t)0x00000004) /*!< Binary data inversion */ | |||
| #define SMARTCARD_ADVFEATURE_SWAP_INIT ((uint32_t)0x00000008) /*!< TX/RX pins swap */ | |||
| #define SMARTCARD_ADVFEATURE_RXOVERRUNDISABLE_INIT ((uint32_t)0x00000010) /*!< RX overrun disable */ | |||
| #define SMARTCARD_ADVFEATURE_DMADISABLEONERROR_INIT ((uint32_t)0x00000020) /*!< DMA disable on Reception Error */ | |||
| #define SMARTCARD_ADVFEATURE_MSBFIRST_INIT ((uint32_t)0x00000080) /*!< Most significant bit sent/received first */ | |||
| #define SMARTCARD_ADVFEATURE_TXCOMPLETION ((uint32_t)0x00000100) /*!< TX completion indication before of after guard time */ | |||
| #define SMARTCARD_ADVFEATURE_NO_INIT 0x00000000U /*!< No advanced feature initialization */ | |||
| #define SMARTCARD_ADVFEATURE_TXINVERT_INIT 0x00000001U /*!< TX pin active level inversion */ | |||
| #define SMARTCARD_ADVFEATURE_RXINVERT_INIT 0x00000002U /*!< RX pin active level inversion */ | |||
| #define SMARTCARD_ADVFEATURE_DATAINVERT_INIT 0x00000004U /*!< Binary data inversion */ | |||
| #define SMARTCARD_ADVFEATURE_SWAP_INIT 0x00000008U /*!< TX/RX pins swap */ | |||
| #define SMARTCARD_ADVFEATURE_RXOVERRUNDISABLE_INIT 0x00000010U /*!< RX overrun disable */ | |||
| #define SMARTCARD_ADVFEATURE_DMADISABLEONERROR_INIT 0x00000020U /*!< DMA disable on Reception Error */ | |||
| #define SMARTCARD_ADVFEATURE_MSBFIRST_INIT 0x00000080U /*!< Most significant bit sent/received first */ | |||
| #define SMARTCARD_ADVFEATURE_TXCOMPLETION 0x00000100U /*!< TX completion indication before of after guard time */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SMARTCARDEx_FIFO_mode SMARTCARDEx FIFO mode | |||
| * @brief SMARTCARD FIFO mode | |||
| * @{ | |||
| */ | |||
| #define SMARTCARD_FIFOMODE_DISABLE 0x00000000U /*!< FIFO mode disable */ | |||
| #define SMARTCARD_FIFOMODE_ENABLE USART_CR1_FIFOEN /*!< FIFO mode enable */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SMARTCARDEx_TXFIFO_threshold_level SMARTCARDEx TXFIFO threshold level | |||
| * @brief SMARTCARD TXFIFO level | |||
| * @{ | |||
| */ | |||
| #define SMARTCARD_TXFIFO_THRESHOLD_1_8 0x00000000U /*!< TXFIFO reaches 1/8 of its depth */ | |||
| #define SMARTCARD_TXFIFO_THRESHOLD_1_4 USART_CR3_TXFTCFG_0 /*!< TXFIFO reaches 1/4 of its depth */ | |||
| #define SMARTCARD_TXFIFO_THRESHOLD_1_2 USART_CR3_TXFTCFG_1 /*!< TXFIFO reaches 1/2 of its depth */ | |||
| #define SMARTCARD_TXFIFO_THRESHOLD_3_4 (USART_CR3_TXFTCFG_0|USART_CR3_TXFTCFG_1) /*!< TXFIFO reaches 3/4 of its depth */ | |||
| #define SMARTCARD_TXFIFO_THRESHOLD_7_8 USART_CR3_TXFTCFG_2 /*!< TXFIFO reaches 7/8 of its depth */ | |||
| #define SMARTCARD_TXFIFO_THRESHOLD_8_8 (USART_CR3_TXFTCFG_2|USART_CR3_TXFTCFG_0) /*!< TXFIFO becomes empty */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SMARTCARDEx_RXFIFO_threshold_level SMARTCARDEx RXFIFO threshold level | |||
| * @brief SMARTCARD RXFIFO level | |||
| * @{ | |||
| */ | |||
| #define SMARTCARD_RXFIFO_THRESHOLD_1_8 0x00000000U /*!< RXFIFO FIFO reaches 1/8 of its depth */ | |||
| #define SMARTCARD_RXFIFO_THRESHOLD_1_4 USART_CR3_RXFTCFG_0 /*!< RXFIFO FIFO reaches 1/4 of its depth */ | |||
| #define SMARTCARD_RXFIFO_THRESHOLD_1_2 USART_CR3_RXFTCFG_1 /*!< RXFIFO FIFO reaches 1/2 of its depth */ | |||
| #define SMARTCARD_RXFIFO_THRESHOLD_3_4 (USART_CR3_RXFTCFG_0|USART_CR3_RXFTCFG_1) /*!< RXFIFO FIFO reaches 3/4 of its depth */ | |||
| #define SMARTCARD_RXFIFO_THRESHOLD_7_8 USART_CR3_RXFTCFG_2 /*!< RXFIFO FIFO reaches 7/8 of its depth */ | |||
| #define SMARTCARD_RXFIFO_THRESHOLD_8_8 (USART_CR3_RXFTCFG_2|USART_CR3_RXFTCFG_0) /*!< RXFIFO FIFO becomes full */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup SMARTCARDEx_Flags SMARTCARD Flags | |||
| * Elements values convention: 0xXXXX | |||
| * - 0xXXXX : Flag mask in the ISR register | |||
| * @{ | |||
| */ | |||
| #define SMARTCARD_FLAG_TCBGT USART_ISR_TCBGT /*!< SMARTCARD transmission complete before guard time completion */ | |||
| #define SMARTCARD_FLAG_REACK USART_ISR_REACK /*!< SMARTCARD receive enable acknowledge flag */ | |||
| #define SMARTCARD_FLAG_TEACK USART_ISR_TEACK /*!< SMARTCARD transmit enable acknowledge flag */ | |||
| #define SMARTCARD_FLAG_BUSY USART_ISR_BUSY /*!< SMARTCARD busy flag */ | |||
| #define SMARTCARD_FLAG_EOBF USART_ISR_EOBF /*!< SMARTCARD end of block flag */ | |||
| #define SMARTCARD_FLAG_RTOF USART_ISR_RTOF /*!< SMARTCARD receiver timeout flag */ | |||
| #define SMARTCARD_FLAG_TXE USART_ISR_TXE /*!< SMARTCARD transmit data register empty */ | |||
| #define SMARTCARD_FLAG_TC USART_ISR_TC /*!< SMARTCARD transmission complete */ | |||
| #define SMARTCARD_FLAG_RXNE USART_ISR_RXNE /*!< SMARTCARD read data register not empty */ | |||
| #define SMARTCARD_FLAG_IDLE USART_ISR_IDLE /*!< SMARTCARD idle line detection */ | |||
| #define SMARTCARD_FLAG_ORE USART_ISR_ORE /*!< SMARTCARD overrun error */ | |||
| #define SMARTCARD_FLAG_NE USART_ISR_NE /*!< SMARTCARD noise error */ | |||
| #define SMARTCARD_FLAG_FE USART_ISR_FE /*!< SMARTCARD frame error */ | |||
| #define SMARTCARD_FLAG_PE USART_ISR_PE /*!< SMARTCARD parity error */ | |||
| #define SMARTCARD_FLAG_TXFT USART_ISR_TXFT /*!< SMARTCARD TXFIFO threshold flag */ | |||
| #define SMARTCARD_FLAG_RXFT USART_ISR_RXFT /*!< SMARTCARD RXFIFO threshold flag */ | |||
| #define SMARTCARD_FLAG_RXFF USART_ISR_RXFF /*!< SMARTCARD RXFIFO Fullflag */ | |||
| #define SMARTCARD_FLAG_TXFE USART_ISR_TXFE /*!< SMARTCARD TXFIFO Empty flag */ | |||
| #define SMARTCARD_FLAG_TCBGT USART_ISR_TCBGT /*!< SMARTCARD transmission complete before guard time completion */ | |||
| #define SMARTCARD_FLAG_REACK USART_ISR_REACK /*!< SMARTCARD receive enable acknowledge flag */ | |||
| #define SMARTCARD_FLAG_TEACK USART_ISR_TEACK /*!< SMARTCARD transmit enable acknowledge flag */ | |||
| #define SMARTCARD_FLAG_BUSY USART_ISR_BUSY /*!< SMARTCARD busy flag */ | |||
| #define SMARTCARD_FLAG_EOBF USART_ISR_EOBF /*!< SMARTCARD end of block flag */ | |||
| #define SMARTCARD_FLAG_RTOF USART_ISR_RTOF /*!< SMARTCARD receiver timeout flag */ | |||
| #define SMARTCARD_FLAG_TXE USART_ISR_TXE_TXFNF /*!< SMARTCARD transmit data register empty */ | |||
| #define SMARTCARD_FLAG_TXFNF USART_ISR_TXE_TXFNF /*!< SMARTCARD TXFIFO not full */ | |||
| #define SMARTCARD_FLAG_TC USART_ISR_TC /*!< SMARTCARD transmission complete */ | |||
| #define SMARTCARD_FLAG_RXNE USART_ISR_RXNE_RXFNE /*!< SMARTCARD read data register not empty */ | |||
| #define SMARTCARD_FLAG_RXFNE USART_ISR_RXNE_RXFNE /*!< SMARTCARD RXFIFO not empty */ | |||
| #define SMARTCARD_FLAG_IDLE USART_ISR_IDLE /*!< SMARTCARD idle line detection */ | |||
| #define SMARTCARD_FLAG_ORE USART_ISR_ORE /*!< SMARTCARD overrun error */ | |||
| #define SMARTCARD_FLAG_NE USART_ISR_NE /*!< SMARTCARD noise error */ | |||
| #define SMARTCARD_FLAG_FE USART_ISR_FE /*!< SMARTCARD frame error */ | |||
| #define SMARTCARD_FLAG_PE USART_ISR_PE /*!< SMARTCARD parity error */ | |||
| #define SMARTCARD_FLAG_TXFE USART_ISR_TXFE /*!< SMARTCARD TXFIFO Empty flag */ | |||
| #define SMARTCARD_FLAG_RXFF USART_ISR_RXFF /*!< SMARTCARD RXFIFO Full flag */ | |||
| #define SMARTCARD_FLAG_RXFT USART_ISR_RXFT /*!< SMARTCARD RXFIFO threshold flag */ | |||
| #define SMARTCARD_FLAG_TXFT USART_ISR_TXFT /*!< SMARTCARD TXFIFO threshold flag */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -127,25 +145,27 @@ | |||
| * - ZZZZZ : Flag position in the ISR register(5 bits) | |||
| * @{ | |||
| */ | |||
| #define SMARTCARD_IT_PE ((uint16_t)0x0028) /*!< SMARTCARD parity error interruption */ | |||
| #define SMARTCARD_IT_TXE ((uint16_t)0x0727) /*!< SMARTCARD transmit data register empty interruption */ | |||
| #define SMARTCARD_IT_TC ((uint16_t)0x0626) /*!< SMARTCARD transmission complete interruption */ | |||
| #define SMARTCARD_IT_RXNE ((uint16_t)0x0525) /*!< SMARTCARD read data register not empty interruption */ | |||
| #define SMARTCARD_IT_IDLE ((uint16_t)0x0424) /*!< SMARTCARD idle line detection interruption */ | |||
| #define SMARTCARD_IT_ERR ((uint16_t)0x0060) /*!< SMARTCARD error interruption */ | |||
| #define SMARTCARD_IT_ORE ((uint16_t)0x0300) /*!< SMARTCARD overrun error interruption */ | |||
| #define SMARTCARD_IT_NE ((uint16_t)0x0200) /*!< SMARTCARD noise error interruption */ | |||
| #define SMARTCARD_IT_FE ((uint16_t)0x0100) /*!< SMARTCARD frame error interruption */ | |||
| #define SMARTCARD_IT_EOB ((uint16_t)0x0C3B) /*!< SMARTCARD end of block interruption */ | |||
| #define SMARTCARD_IT_RTO ((uint16_t)0x0B3A) /*!< SMARTCARD receiver timeout interruption */ | |||
| #define SMARTCARD_IT_RXFF ((uint16_t)0x183F) | |||
| #define SMARTCARD_IT_TXFE ((uint16_t)0x173E) | |||
| #define SMARTCARD_IT_RXFT ((uint16_t)0x187C) | |||
| #define SMARTCARD_IT_TXFT ((uint16_t)0x1B77) | |||
| #define SMARTCARD_IT_TCBGT ((uint16_t)0x1978) /*!< SMARTCARD transmission complete before guard time completion interruption */ | |||
| #define SMARTCARD_IT_PE 0x0028U /*!< SMARTCARD parity error interruption */ | |||
| #define SMARTCARD_IT_TXE 0x0727U /*!< SMARTCARD transmit data register empty interruption */ | |||
| #define SMARTCARD_IT_TXFNF 0x0727U /*!< SMARTCARD TX FIFO not full interruption */ | |||
| #define SMARTCARD_IT_TC 0x0626U /*!< SMARTCARD transmission complete interruption */ | |||
| #define SMARTCARD_IT_RXNE 0x0525U /*!< SMARTCARD read data register not empty interruption */ | |||
| #define SMARTCARD_IT_RXFNE 0x0525U /*!< SMARTCARD RXFIFO not empty interruption */ | |||
| #define SMARTCARD_IT_IDLE 0x0424U /*!< SMARTCARD idle line detection interruption */ | |||
| #define SMARTCARD_IT_ERR 0x0060U /*!< SMARTCARD error interruption */ | |||
| #define SMARTCARD_IT_ORE 0x0300U /*!< SMARTCARD overrun error interruption */ | |||
| #define SMARTCARD_IT_NE 0x0200U /*!< SMARTCARD noise error interruption */ | |||
| #define SMARTCARD_IT_FE 0x0100U /*!< SMARTCARD frame error interruption */ | |||
| #define SMARTCARD_IT_EOB 0x0C3BU /*!< SMARTCARD end of block interruption */ | |||
| #define SMARTCARD_IT_RTO 0x0B3AU /*!< SMARTCARD receiver timeout interruption */ | |||
| #define SMARTCARD_IT_TCBGT 0x1978U /*!< SMARTCARD transmission complete before guard time completion interruption */ | |||
| #define SMARTCARD_IT_RXFF 0x183FU /*!< SMARTCARD RXFIFO full interruption */ | |||
| #define SMARTCARD_IT_TXFE 0x173EU /*!< SMARTCARD TXFIFO empty interruption */ | |||
| #define SMARTCARD_IT_RXFT 0x1A7CU /*!< SMARTCARD RXFIFO threshold reached interruption */ | |||
| #define SMARTCARD_IT_TXFT 0x1B77U /*!< SMARTCARD TXFIFO threshold reached interruption */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -155,15 +175,14 @@ | |||
| */ | |||
| #define SMARTCARD_CLEAR_PEF USART_ICR_PECF /*!< SMARTCARD parity error clear flag */ | |||
| #define SMARTCARD_CLEAR_FEF USART_ICR_FECF /*!< SMARTCARD framing error clear flag */ | |||
| #define SMARTCARD_CLEAR_NEF USART_ICR_NCF /*!< SMARTCARD noise detected clear flag */ | |||
| #define SMARTCARD_CLEAR_NEF USART_ICR_NECF /*!< SMARTCARD noise error detected clear flag */ | |||
| #define SMARTCARD_CLEAR_OREF USART_ICR_ORECF /*!< SMARTCARD overrun error clear flag */ | |||
| #define SMARTCARD_CLEAR_IDLEF USART_ICR_IDLECF /*!< SMARTCARD idle line detected clear flag */ | |||
| #define SMARTCARD_CLEAR_TXFECF USART_ICR_TXFECF /*!< TXFIFO empty Clear Flag */ | |||
| #define SMARTCARD_CLEAR_TCF USART_ICR_TCCF /*!< SMARTCARD transmission complete clear flag */ | |||
| #define SMARTCARD_CLEAR_TCBGTF USART_ICR_TCBGTCF /*!< SMARTCARD transmission complete before guard time completion clear flag */ | |||
| #define SMARTCARD_CLEAR_RTOF USART_ICR_RTOCF /*!< SMARTCARD receiver time out clear flag */ | |||
| #define SMARTCARD_CLEAR_EOBF USART_ICR_EOBCF /*!< SMARTCARD end of block clear flag */ | |||
| #define SMARTCARD_CLEAR_TXFECF USART_ICR_TXFECF /*!< SMARTCARD TXFIFO empty clear flag */ | |||
| #define SMARTCARD_CLEAR_UDRCF USART_ICR_UDRCF /*!< SMARTCARD UnderRun Error Clear Flag */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -177,113 +196,11 @@ | |||
| * @{ | |||
| */ | |||
| /** @brief Report the SMARTCARD clock source. | |||
| * @param __HANDLE__: specifies the SMARTCARD Handle. | |||
| * @param __CLOCKSOURCE__: output variable. | |||
| * @retval the SMARTCARD clocking source, written in __CLOCKSOURCE__. | |||
| */ | |||
| #define SMARTCARD_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \ | |||
| do { \ | |||
| if((__HANDLE__)->Instance == USART1) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_USART1_SOURCE()) \ | |||
| { \ | |||
| case RCC_USART1CLKSOURCE_D2PCLK2: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_D2PCLK2; \ | |||
| break; \ | |||
| case RCC_USART1CLKSOURCE_PLL2: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PLL2Q; \ | |||
| break; \ | |||
| case RCC_USART1CLKSOURCE_PLL3: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PLL3Q; \ | |||
| break; \ | |||
| case RCC_USART1CLKSOURCE_HSI: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \ | |||
| break; \ | |||
| case RCC_USART1CLKSOURCE_CSI: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_CSI; \ | |||
| break; \ | |||
| case RCC_USART1CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| else if((__HANDLE__)->Instance == USART2) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_USART2_SOURCE()) \ | |||
| { \ | |||
| case RCC_USART2CLKSOURCE_D2PCLK1: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_D2PCLK1; \ | |||
| break; \ | |||
| case RCC_USART2CLKSOURCE_PLL2: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PLL2Q; \ | |||
| break; \ | |||
| case RCC_USART2CLKSOURCE_PLL3: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PLL3Q; \ | |||
| break; \ | |||
| case RCC_USART2CLKSOURCE_HSI: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \ | |||
| break; \ | |||
| case RCC_USART2CLKSOURCE_CSI: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_CSI; \ | |||
| break; \ | |||
| case RCC_USART2CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| else if((__HANDLE__)->Instance == USART3) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_USART3_SOURCE()) \ | |||
| { \ | |||
| case RCC_USART3CLKSOURCE_D2PCLK1: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_D2PCLK1; \ | |||
| break; \ | |||
| case RCC_USART3CLKSOURCE_PLL2: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PLL2Q; \ | |||
| break; \ | |||
| case RCC_USART3CLKSOURCE_PLL3: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PLL3Q; \ | |||
| break; \ | |||
| case RCC_USART3CLKSOURCE_HSI: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \ | |||
| break; \ | |||
| case RCC_USART3CLKSOURCE_CSI: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_CSI; \ | |||
| break; \ | |||
| case RCC_USART3CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| else if((__HANDLE__)->Instance == USART6) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_USART6_SOURCE()) \ | |||
| { \ | |||
| case RCC_USART6CLKSOURCE_D2PCLK2: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_D2PCLK2; \ | |||
| break; \ | |||
| case RCC_USART6CLKSOURCE_PLL2: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PLL2Q; \ | |||
| break; \ | |||
| case RCC_USART6CLKSOURCE_PLL3: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PLL3Q; \ | |||
| break; \ | |||
| case RCC_USART6CLKSOURCE_HSI: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \ | |||
| break; \ | |||
| case RCC_USART6CLKSOURCE_CSI: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_CSI; \ | |||
| break; \ | |||
| case RCC_USART6CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| } while(0) | |||
| /** @brief Set the Transmission Completion flag | |||
| * @param __HANDLE__: specifies the SMARTCARD Handle. | |||
| * @param __HANDLE__ specifies the SMARTCARD Handle. | |||
| * @note If TCBGT (Transmission Complete Before Guard Time) flag is not available or if | |||
| * AdvancedInit.TxCompletionIndication is not already filled, the latter is forced | |||
| * to SMARTCARD_TC (transmission completion indication when guard time has elapsed). | |||
| * @retval None | |||
| */ | |||
| #define SMARTCARD_TRANSMISSION_COMPLETION_SETTING(__HANDLE__) \ | |||
| @@ -296,24 +213,55 @@ | |||
| { \ | |||
| assert_param(IS_SMARTCARD_TRANSMISSION_COMPLETION((__HANDLE__)->AdvancedInit.TxCompletionIndication)); \ | |||
| } \ | |||
| } while(0) | |||
| } while(0U) | |||
| /** @brief Return the transmission completion flag. | |||
| * @param __HANDLE__: specifies the SMARTCARD Handle. | |||
| * @param __HANDLE__ specifies the SMARTCARD Handle. | |||
| * @note Based on AdvancedInit.TxCompletionIndication setting, return TC or TCBGT flag. | |||
| * When TCBGT flag (Transmission Complete Before Guard Time) is not available, TC flag is | |||
| * reported. | |||
| * @retval Transmission completion flag | |||
| */ | |||
| #define SMARTCARD_TRANSMISSION_COMPLETION_FLAG(__HANDLE__) \ | |||
| #define SMARTCARD_TRANSMISSION_COMPLETION_FLAG(__HANDLE__) \ | |||
| (((__HANDLE__)->AdvancedInit.TxCompletionIndication == SMARTCARD_TC) ? (SMARTCARD_FLAG_TC) : (SMARTCARD_FLAG_TCBGT)) | |||
| /** | |||
| * @brief Ensure that SMARTCARD frame transmission completion used flag is valid. | |||
| * @param __TXCOMPLETE__: SMARTCARD frame transmission completion used flag. | |||
| /** @brief Ensure that SMARTCARD frame transmission completion used flag is valid. | |||
| * @param __TXCOMPLETE__ SMARTCARD frame transmission completion used flag. | |||
| * @retval SET (__TXCOMPLETE__ is valid) or RESET (__TXCOMPLETE__ is invalid) | |||
| */ | |||
| #define IS_SMARTCARD_TRANSMISSION_COMPLETION(__TXCOMPLETE__) (((__TXCOMPLETE__) == SMARTCARD_TCBGT) ||\ | |||
| #define IS_SMARTCARD_TRANSMISSION_COMPLETION(__TXCOMPLETE__) (((__TXCOMPLETE__) == SMARTCARD_TCBGT) || \ | |||
| ((__TXCOMPLETE__) == SMARTCARD_TC)) | |||
| /** @brief Ensure that SMARTCARD FIFO mode is valid. | |||
| * @param __STATE__ SMARTCARD FIFO mode. | |||
| * @retval SET (__STATE__ is valid) or RESET (__STATE__ is invalid) | |||
| */ | |||
| #define IS_SMARTCARD_FIFOMODE_STATE(__STATE__) (((__STATE__) == SMARTCARD_FIFOMODE_DISABLE ) || \ | |||
| ((__STATE__) == SMARTCARD_FIFOMODE_ENABLE)) | |||
| /** @brief Ensure that SMARTCARD TXFIFO threshold level is valid. | |||
| * @param __THRESHOLD__ SMARTCARD TXFIFO threshold level. | |||
| * @retval SET (__THRESHOLD__ is valid) or RESET (__THRESHOLD__ is invalid) | |||
| */ | |||
| #define IS_SMARTCARD_TXFIFO_THRESHOLD(__THRESHOLD__) (((__THRESHOLD__) == SMARTCARD_TXFIFO_THRESHOLD_1_8) || \ | |||
| ((__THRESHOLD__) == SMARTCARD_TXFIFO_THRESHOLD_1_4) || \ | |||
| ((__THRESHOLD__) == SMARTCARD_TXFIFO_THRESHOLD_1_2) || \ | |||
| ((__THRESHOLD__) == SMARTCARD_TXFIFO_THRESHOLD_3_4) || \ | |||
| ((__THRESHOLD__) == SMARTCARD_TXFIFO_THRESHOLD_7_8) || \ | |||
| ((__THRESHOLD__) == SMARTCARD_TXFIFO_THRESHOLD_8_8)) | |||
| /** @brief Ensure that SMARTCARD RXFIFO threshold level is valid. | |||
| * @param __THRESHOLD__ SMARTCARD RXFIFO threshold level. | |||
| * @retval SET (__THRESHOLD__ is valid) or RESET (__THRESHOLD__ is invalid) | |||
| */ | |||
| #define IS_SMARTCARD_RXFIFO_THRESHOLD(__THRESHOLD__) (((__THRESHOLD__) == SMARTCARD_RXFIFO_THRESHOLD_1_8) || \ | |||
| ((__THRESHOLD__) == SMARTCARD_RXFIFO_THRESHOLD_1_4) || \ | |||
| ((__THRESHOLD__) == SMARTCARD_RXFIFO_THRESHOLD_1_2) || \ | |||
| ((__THRESHOLD__) == SMARTCARD_RXFIFO_THRESHOLD_3_4) || \ | |||
| ((__THRESHOLD__) == SMARTCARD_RXFIFO_THRESHOLD_7_8) || \ | |||
| ((__THRESHOLD__) == SMARTCARD_RXFIFO_THRESHOLD_8_8)) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -340,10 +288,39 @@ HAL_StatusTypeDef HAL_SMARTCARDEx_DisableReceiverTimeOut(SMARTCARD_HandleTypeDef | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup SMARTCARDEx_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| /* IO operation functions *****************************************************/ | |||
| void HAL_SMARTCARDEx_RxFifoFullCallback(SMARTCARD_HandleTypeDef *hsmartcard); | |||
| void HAL_SMARTCARDEx_TxFifoEmptyCallback(SMARTCARD_HandleTypeDef *hsmartcard); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup SMARTCARDEx_Exported_Functions_Group3 | |||
| * @{ | |||
| */ | |||
| /* Peripheral Control functions ***********************************************/ | |||
| HAL_StatusTypeDef HAL_SMARTCARDEx_EnableFifoMode(SMARTCARD_HandleTypeDef *hsmartcard); | |||
| HAL_StatusTypeDef HAL_SMARTCARDEx_DisableFifoMode(SMARTCARD_HandleTypeDef *hsmartcard); | |||
| HAL_StatusTypeDef HAL_SMARTCARDEx_SetTxFifoThreshold(SMARTCARD_HandleTypeDef *hsmartcard, uint32_t Threshold); | |||
| HAL_StatusTypeDef HAL_SMARTCARDEx_SetRxFifoThreshold(SMARTCARD_HandleTypeDef *hsmartcard, uint32_t Threshold); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -356,6 +333,6 @@ HAL_StatusTypeDef HAL_SMARTCARDEx_DisableReceiverTimeOut(SMARTCARD_HandleTypeDef | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_SMARTCARD_EX_H */ | |||
| #endif /* STM32H7xx_HAL_SMARTCARD_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_smbus.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of SMBUS HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_SMBUS_H | |||
| #define __STM32H7xx_HAL_SMBUS_H | |||
| #ifndef STM32H7xx_HAL_SMBUS_H | |||
| #define STM32H7xx_HAL_SMBUS_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -99,7 +81,7 @@ typedef struct | |||
| This parameter can be a value of @ref SMBUS_peripheral_mode */ | |||
| uint32_t SMBusTimeout; /*!< Specifies the content of the 32 Bits SMBUS_TIMEOUT_register value. | |||
| (Enable bits and different timeout values) | |||
| (Enable bits and different timeout values) | |||
| This parameter calculated by referring to SMBUS initialization | |||
| section in Reference manual */ | |||
| } SMBUS_InitTypeDef; | |||
| @@ -138,6 +120,10 @@ typedef struct | |||
| #define HAL_SMBUS_ERROR_BUSTIMEOUT (0x00000020U) /*!< Bus Timeout error */ | |||
| #define HAL_SMBUS_ERROR_ALERT (0x00000040U) /*!< Alert error */ | |||
| #define HAL_SMBUS_ERROR_PECERR (0x00000080U) /*!< PEC error */ | |||
| #if (USE_HAL_SMBUS_REGISTER_CALLBACKS == 1) | |||
| #define HAL_SMBUS_ERROR_INVALID_CALLBACK (0x00000100U) /*!< Invalid Callback error */ | |||
| #endif /* USE_HAL_SMBUS_REGISTER_CALLBACKS */ | |||
| #define HAL_SMBUS_ERROR_INVALID_PARAM (0x00000200U) /*!< Invalid Parameters error */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -146,7 +132,7 @@ typedef struct | |||
| * @brief SMBUS handle Structure definition | |||
| * @{ | |||
| */ | |||
| typedef struct | |||
| typedef struct __SMBUS_HandleTypeDef | |||
| { | |||
| I2C_TypeDef *Instance; /*!< SMBUS registers base address */ | |||
| @@ -168,7 +154,47 @@ typedef struct | |||
| __IO uint32_t ErrorCode; /*!< SMBUS Error code */ | |||
| }SMBUS_HandleTypeDef; | |||
| #if (USE_HAL_SMBUS_REGISTER_CALLBACKS == 1) | |||
| void (* MasterTxCpltCallback)(struct __SMBUS_HandleTypeDef *hsmbus); /*!< SMBUS Master Tx Transfer completed callback */ | |||
| void (* MasterRxCpltCallback)(struct __SMBUS_HandleTypeDef *hsmbus); /*!< SMBUS Master Rx Transfer completed callback */ | |||
| void (* SlaveTxCpltCallback)(struct __SMBUS_HandleTypeDef *hsmbus); /*!< SMBUS Slave Tx Transfer completed callback */ | |||
| void (* SlaveRxCpltCallback)(struct __SMBUS_HandleTypeDef *hsmbus); /*!< SMBUS Slave Rx Transfer completed callback */ | |||
| void (* ListenCpltCallback)(struct __SMBUS_HandleTypeDef *hsmbus); /*!< SMBUS Listen Complete callback */ | |||
| void (* ErrorCallback)(struct __SMBUS_HandleTypeDef *hsmbus); /*!< SMBUS Error callback */ | |||
| void (* AddrCallback)(struct __SMBUS_HandleTypeDef *hsmbus, uint8_t TransferDirection, uint16_t AddrMatchCode); /*!< SMBUS Slave Address Match callback */ | |||
| void (* MspInitCallback)(struct __SMBUS_HandleTypeDef *hsmbus); /*!< SMBUS Msp Init callback */ | |||
| void (* MspDeInitCallback)(struct __SMBUS_HandleTypeDef *hsmbus); /*!< SMBUS Msp DeInit callback */ | |||
| #endif /* USE_HAL_SMBUS_REGISTER_CALLBACKS */ | |||
| } SMBUS_HandleTypeDef; | |||
| #if (USE_HAL_SMBUS_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL SMBUS Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_SMBUS_MASTER_TX_COMPLETE_CB_ID = 0x00U, /*!< SMBUS Master Tx Transfer completed callback ID */ | |||
| HAL_SMBUS_MASTER_RX_COMPLETE_CB_ID = 0x01U, /*!< SMBUS Master Rx Transfer completed callback ID */ | |||
| HAL_SMBUS_SLAVE_TX_COMPLETE_CB_ID = 0x02U, /*!< SMBUS Slave Tx Transfer completed callback ID */ | |||
| HAL_SMBUS_SLAVE_RX_COMPLETE_CB_ID = 0x03U, /*!< SMBUS Slave Rx Transfer completed callback ID */ | |||
| HAL_SMBUS_LISTEN_COMPLETE_CB_ID = 0x04U, /*!< SMBUS Listen Complete callback ID */ | |||
| HAL_SMBUS_ERROR_CB_ID = 0x05U, /*!< SMBUS Error callback ID */ | |||
| HAL_SMBUS_MSPINIT_CB_ID = 0x06U, /*!< SMBUS Msp Init callback ID */ | |||
| HAL_SMBUS_MSPDEINIT_CB_ID = 0x07U /*!< SMBUS Msp DeInit callback ID */ | |||
| } HAL_SMBUS_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL SMBUS Callback pointer definition | |||
| */ | |||
| typedef void (*pSMBUS_CallbackTypeDef)(SMBUS_HandleTypeDef *hsmbus); /*!< pointer to an SMBUS callback function */ | |||
| typedef void (*pSMBUS_AddrCallbackTypeDef)(SMBUS_HandleTypeDef *hsmbus, uint8_t TransferDirection, uint16_t AddrMatchCode); /*!< pointer to an SMBUS Address Match callback function */ | |||
| #endif /* USE_HAL_SMBUS_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -210,7 +236,7 @@ typedef struct | |||
| * @} | |||
| */ | |||
| /** @defgroup SMBUS_own_address2_masks SMBUS own address2 masks | |||
| /** @defgroup SMBUS_own_address2_masks SMBUS ownaddress2 masks | |||
| * @{ | |||
| */ | |||
| @@ -372,117 +398,125 @@ typedef struct | |||
| */ | |||
| /** @brief Reset SMBUS handle state. | |||
| * @param __HANDLE__: specifies the SMBUS Handle. | |||
| * @param __HANDLE__ specifies the SMBUS Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SMBUS_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SMBUS_STATE_RESET) | |||
| #if (USE_HAL_SMBUS_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_SMBUS_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->State = HAL_SMBUS_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_SMBUS_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SMBUS_STATE_RESET) | |||
| #endif | |||
| /** @brief Enable the specified SMBUS interrupts. | |||
| * @param __HANDLE__: specifies the SMBUS Handle. | |||
| * @param __INTERRUPT__: specifies the interrupt source to enable. | |||
| * @param __HANDLE__ specifies the SMBUS Handle. | |||
| * @param __INTERRUPT__ specifies the interrupt source to enable. | |||
| * This parameter can be one of the following values: | |||
| * @arg SMBUS_IT_ERRI: Errors interrupt enable | |||
| * @arg SMBUS_IT_TCI: Transfer complete interrupt enable | |||
| * @arg SMBUS_IT_STOPI: STOP detection interrupt enable | |||
| * @arg SMBUS_IT_NACKI: NACK received interrupt enable | |||
| * @arg SMBUS_IT_ADDRI: Address match interrupt enable | |||
| * @arg SMBUS_IT_RXI: RX interrupt enable | |||
| * @arg SMBUS_IT_TXI: TX interrupt enable | |||
| * @arg @ref SMBUS_IT_ERRI Errors interrupt enable | |||
| * @arg @ref SMBUS_IT_TCI Transfer complete interrupt enable | |||
| * @arg @ref SMBUS_IT_STOPI STOP detection interrupt enable | |||
| * @arg @ref SMBUS_IT_NACKI NACK received interrupt enable | |||
| * @arg @ref SMBUS_IT_ADDRI Address match interrupt enable | |||
| * @arg @ref SMBUS_IT_RXI RX interrupt enable | |||
| * @arg @ref SMBUS_IT_TXI TX interrupt enable | |||
| * | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SMBUS_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR1 |= (__INTERRUPT__)) | |||
| /** @brief Disable the specified SMBUS interrupts. | |||
| * @param __HANDLE__: specifies the SMBUS Handle. | |||
| * @param __INTERRUPT__: specifies the interrupt source to disable. | |||
| * @param __HANDLE__ specifies the SMBUS Handle. | |||
| * @param __INTERRUPT__ specifies the interrupt source to disable. | |||
| * This parameter can be one of the following values: | |||
| * @arg SMBUS_IT_ERRI: Errors interrupt enable | |||
| * @arg SMBUS_IT_TCI: Transfer complete interrupt enable | |||
| * @arg SMBUS_IT_STOPI: STOP detection interrupt enable | |||
| * @arg SMBUS_IT_NACKI: NACK received interrupt enable | |||
| * @arg SMBUS_IT_ADDRI: Address match interrupt enable | |||
| * @arg SMBUS_IT_RXI: RX interrupt enable | |||
| * @arg SMBUS_IT_TXI: TX interrupt enable | |||
| * @arg @ref SMBUS_IT_ERRI Errors interrupt enable | |||
| * @arg @ref SMBUS_IT_TCI Transfer complete interrupt enable | |||
| * @arg @ref SMBUS_IT_STOPI STOP detection interrupt enable | |||
| * @arg @ref SMBUS_IT_NACKI NACK received interrupt enable | |||
| * @arg @ref SMBUS_IT_ADDRI Address match interrupt enable | |||
| * @arg @ref SMBUS_IT_RXI RX interrupt enable | |||
| * @arg @ref SMBUS_IT_TXI TX interrupt enable | |||
| * | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SMBUS_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR1 &= (~(__INTERRUPT__))) | |||
| /** @brief Check whether the specified SMBUS interrupt source is enabled or not. | |||
| * @param __HANDLE__: specifies the SMBUS Handle. | |||
| * @param __INTERRUPT__: specifies the SMBUS interrupt source to check. | |||
| * @param __HANDLE__ specifies the SMBUS Handle. | |||
| * @param __INTERRUPT__ specifies the SMBUS interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg SMBUS_IT_ERRI: Errors interrupt enable | |||
| * @arg SMBUS_IT_TCI: Transfer complete interrupt enable | |||
| * @arg SMBUS_IT_STOPI: STOP detection interrupt enable | |||
| * @arg SMBUS_IT_NACKI: NACK received interrupt enable | |||
| * @arg SMBUS_IT_ADDRI: Address match interrupt enable | |||
| * @arg SMBUS_IT_RXI: RX interrupt enable | |||
| * @arg SMBUS_IT_TXI: TX interrupt enable | |||
| * @arg @ref SMBUS_IT_ERRI Errors interrupt enable | |||
| * @arg @ref SMBUS_IT_TCI Transfer complete interrupt enable | |||
| * @arg @ref SMBUS_IT_STOPI STOP detection interrupt enable | |||
| * @arg @ref SMBUS_IT_NACKI NACK received interrupt enable | |||
| * @arg @ref SMBUS_IT_ADDRI Address match interrupt enable | |||
| * @arg @ref SMBUS_IT_RXI RX interrupt enable | |||
| * @arg @ref SMBUS_IT_TXI TX interrupt enable | |||
| * | |||
| * @retval The new state of __IT__ (TRUE or FALSE). | |||
| * @retval The new state of __IT__ (SET or RESET). | |||
| */ | |||
| #define __HAL_SMBUS_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR1 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) | |||
| /** @brief Check whether the specified SMBUS flag is set or not. | |||
| * @param __HANDLE__: specifies the SMBUS Handle. | |||
| * @param __FLAG__: specifies the flag to check. | |||
| * @param __HANDLE__ specifies the SMBUS Handle. | |||
| * @param __FLAG__ specifies the flag to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg SMBUS_FLAG_TXE: Transmit data register empty | |||
| * @arg SMBUS_FLAG_TXIS: Transmit interrupt status | |||
| * @arg SMBUS_FLAG_RXNE: Receive data register not empty | |||
| * @arg SMBUS_FLAG_ADDR: Address matched (slave mode) | |||
| * @arg SMBUS_FLAG_AF: NACK received flag | |||
| * @arg SMBUS_FLAG_STOPF: STOP detection flag | |||
| * @arg SMBUS_FLAG_TC: Transfer complete (master mode) | |||
| * @arg SMBUS_FLAG_TCR: Transfer complete reload | |||
| * @arg SMBUS_FLAG_BERR: Bus error | |||
| * @arg SMBUS_FLAG_ARLO: Arbitration lost | |||
| * @arg SMBUS_FLAG_OVR: Overrun/Underrun | |||
| * @arg SMBUS_FLAG_PECERR: PEC error in reception | |||
| * @arg SMBUS_FLAG_TIMEOUT: Timeout or Tlow detection flag | |||
| * @arg SMBUS_FLAG_ALERT: SMBus alert | |||
| * @arg SMBUS_FLAG_BUSY: Bus busy | |||
| * @arg SMBUS_FLAG_DIR: Transfer direction (slave mode) | |||
| * @arg @ref SMBUS_FLAG_TXE Transmit data register empty | |||
| * @arg @ref SMBUS_FLAG_TXIS Transmit interrupt status | |||
| * @arg @ref SMBUS_FLAG_RXNE Receive data register not empty | |||
| * @arg @ref SMBUS_FLAG_ADDR Address matched (slave mode) | |||
| * @arg @ref SMBUS_FLAG_AF NACK received flag | |||
| * @arg @ref SMBUS_FLAG_STOPF STOP detection flag | |||
| * @arg @ref SMBUS_FLAG_TC Transfer complete (master mode) | |||
| * @arg @ref SMBUS_FLAG_TCR Transfer complete reload | |||
| * @arg @ref SMBUS_FLAG_BERR Bus error | |||
| * @arg @ref SMBUS_FLAG_ARLO Arbitration lost | |||
| * @arg @ref SMBUS_FLAG_OVR Overrun/Underrun | |||
| * @arg @ref SMBUS_FLAG_PECERR PEC error in reception | |||
| * @arg @ref SMBUS_FLAG_TIMEOUT Timeout or Tlow detection flag | |||
| * @arg @ref SMBUS_FLAG_ALERT SMBus alert | |||
| * @arg @ref SMBUS_FLAG_BUSY Bus busy | |||
| * @arg @ref SMBUS_FLAG_DIR Transfer direction (slave mode) | |||
| * | |||
| * @retval The new state of __FLAG__ (TRUE or FALSE). | |||
| * @retval The new state of __FLAG__ (SET or RESET). | |||
| */ | |||
| #define SMBUS_FLAG_MASK (0x0001FFFFU) | |||
| #define __HAL_SMBUS_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__) & SMBUS_FLAG_MASK)) == ((__FLAG__) & SMBUS_FLAG_MASK))) | |||
| #define __HAL_SMBUS_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__) & SMBUS_FLAG_MASK)) == ((__FLAG__) & SMBUS_FLAG_MASK)) ? SET : RESET) | |||
| /** @brief Clear the SMBUS pending flags which are cleared by writing 1 in a specific bit. | |||
| * @param __HANDLE__: specifies the SMBUS Handle. | |||
| * @param __FLAG__: specifies the flag to clear. | |||
| * @param __HANDLE__ specifies the SMBUS Handle. | |||
| * @param __FLAG__ specifies the flag to clear. | |||
| * This parameter can be any combination of the following values: | |||
| * @arg SMBUS_FLAG_ADDR: Address matched (slave mode) | |||
| * @arg SMBUS_FLAG_AF: NACK received flag | |||
| * @arg SMBUS_FLAG_STOPF: STOP detection flag | |||
| * @arg SMBUS_FLAG_BERR: Bus error | |||
| * @arg SMBUS_FLAG_ARLO: Arbitration lost | |||
| * @arg SMBUS_FLAG_OVR: Overrun/Underrun | |||
| * @arg SMBUS_FLAG_PECERR: PEC error in reception | |||
| * @arg SMBUS_FLAG_TIMEOUT: Timeout or Tlow detection flag | |||
| * @arg SMBUS_FLAG_ALERT: SMBus alert | |||
| * @arg @ref SMBUS_FLAG_ADDR Address matched (slave mode) | |||
| * @arg @ref SMBUS_FLAG_AF NACK received flag | |||
| * @arg @ref SMBUS_FLAG_STOPF STOP detection flag | |||
| * @arg @ref SMBUS_FLAG_BERR Bus error | |||
| * @arg @ref SMBUS_FLAG_ARLO Arbitration lost | |||
| * @arg @ref SMBUS_FLAG_OVR Overrun/Underrun | |||
| * @arg @ref SMBUS_FLAG_PECERR PEC error in reception | |||
| * @arg @ref SMBUS_FLAG_TIMEOUT Timeout or Tlow detection flag | |||
| * @arg @ref SMBUS_FLAG_ALERT SMBus alert | |||
| * | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SMBUS_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) | |||
| /** @brief Enable the specified SMBUS peripheral. | |||
| * @param __HANDLE__: specifies the SMBUS Handle. | |||
| * @param __HANDLE__ specifies the SMBUS Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SMBUS_ENABLE(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR1, I2C_CR1_PE)) | |||
| /** @brief Disable the specified SMBUS peripheral. | |||
| * @param __HANDLE__: specifies the SMBUS Handle. | |||
| * @param __HANDLE__ specifies the SMBUS Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SMBUS_DISABLE(__HANDLE__) (CLEAR_BIT((__HANDLE__)->Instance->CR1, I2C_CR1_PE)) | |||
| /** @brief Generate a Non-Acknowledge SMBUS peripheral in Slave mode. | |||
| * @param __HANDLE__: specifies the SMBUS Handle. | |||
| * @param __HANDLE__ specifies the SMBUS Handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SMBUS_GENERATE_NACK(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->CR2, I2C_CR2_NACK)) | |||
| @@ -502,6 +536,8 @@ typedef struct | |||
| #define IS_SMBUS_ANALOG_FILTER(FILTER) (((FILTER) == SMBUS_ANALOGFILTER_ENABLE) || \ | |||
| ((FILTER) == SMBUS_ANALOGFILTER_DISABLE)) | |||
| #define IS_SMBUS_DIGITAL_FILTER(FILTER) ((FILTER) <= 0x0000000FU) | |||
| #define IS_SMBUS_ADDRESSING_MODE(MODE) (((MODE) == SMBUS_ADDRESSINGMODE_7BIT) || \ | |||
| ((MODE) == SMBUS_ADDRESSINGMODE_10BIT)) | |||
| @@ -546,13 +582,13 @@ typedef struct | |||
| ((REQUEST) == SMBUS_NO_STARTSTOP)) | |||
| #define IS_SMBUS_TRANSFER_OPTIONS_REQUEST(REQUEST) (((REQUEST) == SMBUS_FIRST_FRAME) || \ | |||
| #define IS_SMBUS_TRANSFER_OPTIONS_REQUEST(REQUEST) (IS_SMBUS_TRANSFER_OTHER_OPTIONS_REQUEST(REQUEST) || \ | |||
| ((REQUEST) == SMBUS_FIRST_FRAME) || \ | |||
| ((REQUEST) == SMBUS_NEXT_FRAME) || \ | |||
| ((REQUEST) == SMBUS_FIRST_AND_LAST_FRAME_NO_PEC) || \ | |||
| ((REQUEST) == SMBUS_LAST_FRAME_NO_PEC) || \ | |||
| ((REQUEST) == SMBUS_FIRST_AND_LAST_FRAME_WITH_PEC) || \ | |||
| ((REQUEST) == SMBUS_LAST_FRAME_WITH_PEC) || \ | |||
| IS_SMBUS_TRANSFER_OTHER_OPTIONS_REQUEST(REQUEST)) | |||
| ((REQUEST) == SMBUS_LAST_FRAME_WITH_PEC)) | |||
| #define IS_SMBUS_TRANSFER_OTHER_OPTIONS_REQUEST(REQUEST) (((REQUEST) == SMBUS_OTHER_FRAME_NO_PEC) || \ | |||
| ((REQUEST) == SMBUS_OTHER_AND_LAST_FRAME_NO_PEC) || \ | |||
| @@ -565,14 +601,14 @@ typedef struct | |||
| #define SMBUS_GENERATE_START(__ADDMODE__,__ADDRESS__) (((__ADDMODE__) == SMBUS_ADDRESSINGMODE_7BIT) ? (uint32_t)((((uint32_t)(__ADDRESS__) & (I2C_CR2_SADD)) | (I2C_CR2_START) | (I2C_CR2_AUTOEND)) & (~I2C_CR2_RD_WRN)) : \ | |||
| (uint32_t)((((uint32_t)(__ADDRESS__) & (I2C_CR2_SADD)) | (I2C_CR2_ADD10) | (I2C_CR2_START)) & (~I2C_CR2_RD_WRN))) | |||
| #define SMBUS_GET_ADDR_MATCH(__HANDLE__) (((__HANDLE__)->Instance->ISR & I2C_ISR_ADDCODE) >> 17) | |||
| #define SMBUS_GET_DIR(__HANDLE__) (((__HANDLE__)->Instance->ISR & I2C_ISR_DIR) >> 16) | |||
| #define SMBUS_GET_STOP_MODE(__HANDLE__) ((__HANDLE__)->Instance->CR2 & I2C_CR2_AUTOEND) | |||
| #define SMBUS_GET_PEC_MODE(__HANDLE__) ((__HANDLE__)->Instance->CR2 & I2C_CR2_PECBYTE) | |||
| #define SMBUS_GET_ALERT_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CR1 & I2C_CR1_ALERTEN) | |||
| #define SMBUS_GET_ADDR_MATCH(__HANDLE__) (((__HANDLE__)->Instance->ISR & I2C_ISR_ADDCODE) >> 17U) | |||
| #define SMBUS_GET_DIR(__HANDLE__) (((__HANDLE__)->Instance->ISR & I2C_ISR_DIR) >> 16U) | |||
| #define SMBUS_GET_STOP_MODE(__HANDLE__) ((__HANDLE__)->Instance->CR2 & I2C_CR2_AUTOEND) | |||
| #define SMBUS_GET_PEC_MODE(__HANDLE__) ((__HANDLE__)->Instance->CR2 & I2C_CR2_PECBYTE) | |||
| #define SMBUS_GET_ALERT_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CR1 & I2C_CR1_ALERTEN) | |||
| #define SMBUS_GET_ISR_REG(__HANDLE__) ((__HANDLE__)->Instance->ISR) | |||
| #define SMBUS_CHECK_FLAG(__ISR__, __FLAG__) ((((__ISR__) & ((__FLAG__) & SMBUS_FLAG_MASK)) == ((__FLAG__) & SMBUS_FLAG_MASK))) | |||
| #define SMBUS_CHECK_FLAG(__ISR__, __FLAG__) ((((__ISR__) & ((__FLAG__) & SMBUS_FLAG_MASK)) == ((__FLAG__) & SMBUS_FLAG_MASK)) ? SET : RESET) | |||
| #define SMBUS_CHECK_IT_SOURCE(__CR1__, __IT__) ((((__CR1__) & (__IT__)) == (__IT__)) ? SET : RESET) | |||
| #define IS_SMBUS_OWN_ADDRESS1(ADDRESS1) ((ADDRESS1) <= 0x000003FFU) | |||
| #define IS_SMBUS_OWN_ADDRESS2(ADDRESS2) ((ADDRESS2) <= (uint16_t)0x00FFU) | |||
| @@ -590,12 +626,22 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| /* Initialization and de-initialization functions **********************************/ | |||
| /* Initialization and de-initialization functions ****************************/ | |||
| HAL_StatusTypeDef HAL_SMBUS_Init(SMBUS_HandleTypeDef *hsmbus); | |||
| HAL_StatusTypeDef HAL_SMBUS_DeInit (SMBUS_HandleTypeDef *hsmbus); | |||
| HAL_StatusTypeDef HAL_SMBUS_DeInit(SMBUS_HandleTypeDef *hsmbus); | |||
| void HAL_SMBUS_MspInit(SMBUS_HandleTypeDef *hsmbus); | |||
| void HAL_SMBUS_MspDeInit(SMBUS_HandleTypeDef *hsmbus); | |||
| HAL_StatusTypeDef HAL_SMBUS_ConfigAnalogFilter(SMBUS_HandleTypeDef *hsmbus, uint32_t AnalogFilter); | |||
| HAL_StatusTypeDef HAL_SMBUS_ConfigDigitalFilter(SMBUS_HandleTypeDef *hsmbus, uint32_t DigitalFilter); | |||
| /* Callbacks Register/UnRegister functions ***********************************/ | |||
| #if (USE_HAL_SMBUS_REGISTER_CALLBACKS == 1) | |||
| HAL_StatusTypeDef HAL_SMBUS_RegisterCallback(SMBUS_HandleTypeDef *hsmbus, HAL_SMBUS_CallbackIDTypeDef CallbackID, pSMBUS_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_SMBUS_UnRegisterCallback(SMBUS_HandleTypeDef *hsmbus, HAL_SMBUS_CallbackIDTypeDef CallbackID); | |||
| HAL_StatusTypeDef HAL_SMBUS_RegisterAddrCallback(SMBUS_HandleTypeDef *hsmbus, pSMBUS_AddrCallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_SMBUS_UnRegisterAddrCallback(SMBUS_HandleTypeDef *hsmbus); | |||
| #endif /* USE_HAL_SMBUS_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -686,11 +732,12 @@ uint32_t HAL_SMBUS_GetError(SMBUS_HandleTypeDef *hsmbus); | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_SMBUS_H */ | |||
| #endif /* STM32H7xx_HAL_SMBUS_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_spdifrx.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of SPDIFRX HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_SPDIFRX_H | |||
| #define __STM32H7xx_HAL_SPDIFRX_H | |||
| #ifndef STM32H7xx_HAL_SPDIFRX_H | |||
| #define STM32H7xx_HAL_SPDIFRX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -46,6 +28,7 @@ | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_hal_def.h" | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| */ | |||
| @@ -84,17 +67,17 @@ typedef struct | |||
| 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 */ | |||
| 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 */ | |||
| 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 */ | |||
| 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 */ | |||
| FunctionalState SymbolClockGen; /*!< Enable/Disable the SPDIFRX Symbol Clock generation. | |||
| This parameter can be a value of @ref SPDIFRX_PE_Mask */ | |||
| FunctionalState SymbolClockGen; /*!< Enable/Disable the SPDIFRX Symbol Clock generation. | |||
| This parameter can be set to Enable or Disable */ | |||
| FunctionalState BackupSymbolClockGen; /*!< Enable/Disable the SPDIFRX Backup Symbol Clock generation. | |||
| @@ -142,7 +125,11 @@ typedef enum | |||
| /** | |||
| * @brief SPDIFRX handle Structure definition | |||
| */ | |||
| #if (USE_HAL_SPDIFRX_REGISTER_CALLBACKS == 1) | |||
| typedef struct __SPDIFRX_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif | |||
| { | |||
| SPDIFRX_TypeDef *Instance; /* SPDIFRX registers base address */ | |||
| @@ -178,13 +165,44 @@ typedef struct | |||
| __IO HAL_SPDIFRX_StateTypeDef State; /* SPDIFRX communication state */ | |||
| __IO uint32_t ErrorCode; /* SPDIFRX Error code */ | |||
| __IO uint32_t ErrorCode; /* SPDIFRX Error code */ | |||
| #if (USE_HAL_SPDIFRX_REGISTER_CALLBACKS == 1) | |||
| void (*RxHalfCpltCallback)(struct __SPDIFRX_HandleTypeDef *hspdif); /*!< SPDIFRX Data flow half completed callback */ | |||
| void (*RxCpltCallback)(struct __SPDIFRX_HandleTypeDef *hspdif); /*!< SPDIFRX Data flow completed callback */ | |||
| void (*CxHalfCpltCallback)(struct __SPDIFRX_HandleTypeDef *hspdif); /*!< SPDIFRX Control flow half completed callback */ | |||
| void (*CxCpltCallback)(struct __SPDIFRX_HandleTypeDef *hspdif); /*!< SPDIFRX Control flow completed callback */ | |||
| void (*ErrorCallback)(struct __SPDIFRX_HandleTypeDef *hspdif); /*!< SPDIFRX error callback */ | |||
| void (* MspInitCallback)( struct __SPDIFRX_HandleTypeDef * hspdif); /*!< SPDIFRX Msp Init callback */ | |||
| void (* MspDeInitCallback)( struct __SPDIFRX_HandleTypeDef * hspdif); /*!< SPDIFRX Msp DeInit callback */ | |||
| #endif /* USE_HAL_SPDIFRX_REGISTER_CALLBACKS */ | |||
| } SPDIFRX_HandleTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| #if (USE_HAL_SPDIFRX_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL SPDIFRX Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_SPDIFRX_RX_HALF_CB_ID = 0x00U, /*!< SPDIFRX Data flow half completed callback ID */ | |||
| HAL_SPDIFRX_RX_CPLT_CB_ID = 0x01U, /*!< SPDIFRX Data flow completed callback */ | |||
| HAL_SPDIFRX_CX_HALF_CB_ID = 0x02U, /*!< SPDIFRX Control flow half completed callback */ | |||
| HAL_SPDIFRX_CX_CPLT_CB_ID = 0x03U, /*!< SPDIFRX Control flow completed callback */ | |||
| HAL_SPDIFRX_ERROR_CB_ID = 0x04U, /*!< SPDIFRX error callback */ | |||
| HAL_SPDIFRX_MSPINIT_CB_ID = 0x05U, /*!< SPDIFRX Msp Init callback ID */ | |||
| HAL_SPDIFRX_MSPDEINIT_CB_ID = 0x06U /*!< SPDIFRX Msp DeInit callback ID */ | |||
| }HAL_SPDIFRX_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL SPDIFRX Callback pointer definition | |||
| */ | |||
| typedef void (*pSPDIFRX_CallbackTypeDef)(SPDIFRX_HandleTypeDef * hspdif); /*!< pointer to an SPDIFRX callback function */ | |||
| #endif /* USE_HAL_SPDIFRX_REGISTER_CALLBACKS */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup SPDIFRX_Exported_Constants SPDIFRX Exported Constants | |||
| * @{ | |||
| @@ -198,6 +216,9 @@ typedef struct | |||
| #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 */ | |||
| #if (USE_HAL_SPDIFRX_REGISTER_CALLBACKS == 1) | |||
| #define HAL_SPDIFRX_ERROR_INVALID_CALLBACK ((uint32_t)0x00000020U) /*!< Invalid Callback error */ | |||
| #endif /* USE_HAL_SPDIFRX_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -205,10 +226,10 @@ typedef struct | |||
| /** @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) | |||
| #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) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -216,10 +237,10 @@ typedef struct | |||
| /** @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) | |||
| #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) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -227,8 +248,8 @@ typedef struct | |||
| /** @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) | |||
| #define SPDIFRX_WAITFORACTIVITY_OFF ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_WAITFORACTIVITY_ON ((uint32_t)SPDIFRX_CR_WFA) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -236,8 +257,8 @@ typedef struct | |||
| /** @defgroup SPDIFRX_PT_Mask SPDIFRX Preamble Type Mask | |||
| * @{ | |||
| */ | |||
| #define SPDIFRX_PREAMBLETYPEMASK_OFF ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_PREAMBLETYPEMASK_ON ((uint32_t)SPDIFRX_CR_PTMSK) | |||
| #define SPDIFRX_PREAMBLETYPEMASK_OFF ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_PREAMBLETYPEMASK_ON ((uint32_t)SPDIFRX_CR_PTMSK) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -245,8 +266,8 @@ typedef struct | |||
| /** @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*/ | |||
| #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*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -254,8 +275,8 @@ typedef struct | |||
| /** @defgroup SPDIFRX_V_Mask SPDIFRX Validity Mask | |||
| * @{ | |||
| */ | |||
| #define SPDIFRX_VALIDITYMASK_OFF ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_VALIDITYMASK_ON ((uint32_t)SPDIFRX_CR_VMSK) | |||
| #define SPDIFRX_VALIDITYMASK_OFF ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_VALIDITYMASK_ON ((uint32_t)SPDIFRX_CR_VMSK) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -263,8 +284,8 @@ typedef struct | |||
| /** @defgroup SPDIFRX_PE_Mask SPDIFRX Parity Error Mask | |||
| * @{ | |||
| */ | |||
| #define SPDIFRX_PARITYERRORMASK_OFF ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_PARITYERRORMASK_ON ((uint32_t)SPDIFRX_CR_PMSK) | |||
| #define SPDIFRX_PARITYERRORMASK_OFF ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_PARITYERRORMASK_ON ((uint32_t)SPDIFRX_CR_PMSK) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -272,8 +293,8 @@ typedef struct | |||
| /** @defgroup SPDIFRX_Channel_Selection SPDIFRX Channel Selection | |||
| * @{ | |||
| */ | |||
| #define SPDIFRX_CHANNEL_A ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_CHANNEL_B ((uint32_t)SPDIFRX_CR_CHSEL) | |||
| #define SPDIFRX_CHANNEL_A ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_CHANNEL_B ((uint32_t)SPDIFRX_CR_CHSEL) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -281,9 +302,9 @@ typedef struct | |||
| /** @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) | |||
| #define SPDIFRX_DATAFORMAT_LSB ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_DATAFORMAT_MSB ((uint32_t)0x00000010U) | |||
| #define SPDIFRX_DATAFORMAT_32BITS ((uint32_t)0x00000020U) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -291,8 +312,8 @@ typedef struct | |||
| /** @defgroup SPDIFRX_Stereo_Mode SPDIFRX Stereo Mode | |||
| * @{ | |||
| */ | |||
| #define SPDIFRX_STEREOMODE_DISABLE ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_STEREOMODE_ENABLE ((uint32_t)SPDIFRX_CR_RXSTEO) | |||
| #define SPDIFRX_STEREOMODE_DISABLE ((uint32_t)0x00000000U) | |||
| #define SPDIFRX_STEREOMODE_ENABLE ((uint32_t)SPDIFRX_CR_RXSTEO) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -311,13 +332,13 @@ typedef struct | |||
| /** @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 ) | |||
| #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 ) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -325,15 +346,15 @@ typedef struct | |||
| /** @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) | |||
| #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) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -348,34 +369,42 @@ typedef struct | |||
| */ | |||
| /** @brief Reset SPDIFRX handle state | |||
| * @param __HANDLE__: SPDIFRX handle. | |||
| * @param __HANDLE__ SPDIFRX handle. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SPDIFRX_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = (uint16_t)SPDIFRX_CR_SPDIFEN) | |||
| #if (USE_HAL_SPDIFRX_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_SPDIFRX_RESET_HANDLE_STATE(__HANDLE__) do{\ | |||
| (__HANDLE__)->State = HAL_SPDIFRX_STATE_RESET;\ | |||
| (__HANDLE__)->MspInitCallback = NULL;\ | |||
| (__HANDLE__)->MspDeInitCallback = NULL;\ | |||
| }while(0) | |||
| #else | |||
| #define __HAL_SPDIFRX_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SPDIFRX_STATE_RESET) | |||
| #endif /* USE_HAL_SPDIFRX_REGISTER_CALLBACKS */ | |||
| /** @brief Disable the specified SPDIFRX peripheral (IDLE State). | |||
| * @param __HANDLE__: specifies the SPDIFRX Handle. | |||
| * @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. | |||
| * @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. | |||
| * @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. | |||
| * @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 | |||
| @@ -390,8 +419,8 @@ typedef struct | |||
| #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. | |||
| * @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 | |||
| @@ -405,8 +434,8 @@ typedef struct | |||
| #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. | |||
| * @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 | |||
| @@ -419,11 +448,11 @@ typedef struct | |||
| * @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__)) | |||
| #define __HAL_SPDIFRX_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__)) ? SET : RESET) | |||
| /** @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 | |||
| * @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 | |||
| @@ -452,6 +481,12 @@ 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); | |||
| /* Callbacks Register/UnRegister functions ***********************************/ | |||
| #if (USE_HAL_SPDIFRX_REGISTER_CALLBACKS == 1) | |||
| HAL_StatusTypeDef HAL_SPDIFRX_RegisterCallback(SPDIFRX_HandleTypeDef *hspdif, HAL_SPDIFRX_CallbackIDTypeDef CallbackID, pSPDIFRX_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_SPDIFRX_UnRegisterCallback(SPDIFRX_HandleTypeDef *hspdif, HAL_SPDIFRX_CallbackIDTypeDef CallbackID); | |||
| #endif /* USE_HAL_SPDIFRX_REGISTER_CALLBACKS */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -462,17 +497,16 @@ HAL_StatusTypeDef HAL_SPDIFRX_SetDataFormat(SPDIFRX_HandleTypeDef *hspdif, SPDIF | |||
| /* 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); | |||
| HAL_StatusTypeDef HAL_SPDIFRX_ReceiveCtrlFlow(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); | |||
| /* Non-Blocking mode: Interrupt */ | |||
| HAL_StatusTypeDef HAL_SPDIFRX_ReceiveCtrlFlow_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_ReceiveCtrlFlow_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) *******************/ | |||
| @@ -489,8 +523,8 @@ void HAL_SPDIFRX_CxCpltCallback(SPDIFRX_HandleTypeDef *hspdif); | |||
| * @{ | |||
| */ | |||
| /* Peripheral Control and State functions ************************************/ | |||
| HAL_SPDIFRX_StateTypeDef HAL_SPDIFRX_GetState(SPDIFRX_HandleTypeDef *hspdif); | |||
| uint32_t HAL_SPDIFRX_GetError(SPDIFRX_HandleTypeDef *hspdif); | |||
| HAL_SPDIFRX_StateTypeDef HAL_SPDIFRX_GetState(SPDIFRX_HandleTypeDef const * const hspdif); | |||
| uint32_t HAL_SPDIFRX_GetError(SPDIFRX_HandleTypeDef const * const hspdif); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -539,6 +573,7 @@ uint32_t HAL_SPDIFRX_GetError(SPDIFRX_HandleTypeDef *hspdif); | |||
| #define IS_CHANNEL_STATUS_MASK(VAL) (((VAL) == SPDIFRX_CHANNELSTATUS_ON) || \ | |||
| ((VAL) == SPDIFRX_CHANNELSTATUS_OFF)) | |||
| #define IS_SYMBOL_CLOCK_GEN(VAL) (((VAL) == ENABLE) || ((VAL) == DISABLE)) | |||
| /** | |||
| * @} | |||
| @@ -560,6 +595,7 @@ uint32_t HAL_SPDIFRX_GetError(SPDIFRX_HandleTypeDef *hspdif); | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_spi_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of SPI HAL Extended module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_SPI_EX_H | |||
| #define __STM32H7xx_HAL_SPI_EX_H | |||
| #ifndef STM32H7xx_HAL_SPI_EX_H | |||
| #define STM32H7xx_HAL_SPI_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -90,6 +72,6 @@ HAL_StatusTypeDef HAL_SPIEx_ConfigureUnderrun(SPI_HandleTypeDef *hspi, uint32_t | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_SPI_EX_H */ | |||
| #endif /* STM32H7xx_HAL_SPI_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,50 +2,31 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_sram.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of SRAM HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_SRAM_H | |||
| #define __STM32H7xx_HAL_SRAM_H | |||
| #ifndef STM32H7xx_HAL_SRAM_H | |||
| #define STM32H7xx_HAL_SRAM_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx_ll_fmc.h" | |||
| #include "stm32h7xx_hal_mdma.h" | |||
| /** @addtogroup STM32H7xx_HAL_Driver | |||
| * @{ | |||
| @@ -70,12 +51,16 @@ typedef enum | |||
| HAL_SRAM_STATE_ERROR = 0x03U, /*!< SRAM error state */ | |||
| HAL_SRAM_STATE_PROTECTED = 0x04U /*!< SRAM peripheral NORSRAM device write protected */ | |||
| }HAL_SRAM_StateTypeDef; | |||
| } HAL_SRAM_StateTypeDef; | |||
| /** | |||
| * @brief SRAM handle Structure definition | |||
| */ | |||
| #if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1) | |||
| typedef struct __SRAM_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_SRAM_REGISTER_CALLBACKS */ | |||
| { | |||
| FMC_NORSRAM_TypeDef *Instance; /*!< Register base address */ | |||
| @@ -89,8 +74,32 @@ typedef struct | |||
| MDMA_HandleTypeDef *hmdma; /*!< Pointer DMA handler */ | |||
| }SRAM_HandleTypeDef; | |||
| #if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1) | |||
| void (* MspInitCallback) ( struct __SRAM_HandleTypeDef * hsram); /*!< SRAM Msp Init callback */ | |||
| void (* MspDeInitCallback) ( struct __SRAM_HandleTypeDef * hsram); /*!< SRAM Msp DeInit callback */ | |||
| void (* DmaXferCpltCallback) ( MDMA_HandleTypeDef * hmdma); /*!< SRAM DMA Xfer Complete callback */ | |||
| void (* DmaXferErrorCallback) ( MDMA_HandleTypeDef * hmdma); /*!< SRAM DMA Xfer Error callback */ | |||
| #endif | |||
| } SRAM_HandleTypeDef; | |||
| #if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL SRAM Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_SRAM_MSP_INIT_CB_ID = 0x00U, /*!< SRAM MspInit Callback ID */ | |||
| HAL_SRAM_MSP_DEINIT_CB_ID = 0x01U, /*!< SRAM MspDeInit Callback ID */ | |||
| HAL_SRAM_DMA_XFER_CPLT_CB_ID = 0x02U, /*!< SRAM DMA Xfer Complete Callback ID */ | |||
| HAL_SRAM_DMA_XFER_ERR_CB_ID = 0x03U /*!< SRAM DMA Xfer Complete Callback ID */ | |||
| }HAL_SRAM_CallbackIDTypeDef; | |||
| /** | |||
| * @brief HAL SRAM Callback pointer definition | |||
| */ | |||
| typedef void (*pSRAM_CallbackTypeDef)(SRAM_HandleTypeDef *hsram); | |||
| typedef void (*pSRAM_DmaCallbackTypeDef)(MDMA_HandleTypeDef *hmdma); | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -103,10 +112,18 @@ typedef struct | |||
| */ | |||
| /** @brief Reset SRAM handle state | |||
| * @param __HANDLE__: SRAM handle | |||
| * @param __HANDLE__ SRAM handle | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_SRAM_RESET_HANDLE_STATE(__HANDLE__) do { \ | |||
| (__HANDLE__)->State = HAL_SRAM_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_SRAM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SRAM_STATE_RESET) | |||
| #endif | |||
| /** | |||
| * @} | |||
| @@ -148,6 +165,13 @@ HAL_StatusTypeDef HAL_SRAM_Write_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddre | |||
| void HAL_SRAM_DMA_XferCpltCallback(MDMA_HandleTypeDef *hmdma); | |||
| void HAL_SRAM_DMA_XferErrorCallback(MDMA_HandleTypeDef *hmdma); | |||
| #if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1) | |||
| /* SRAM callback registering/unregistering */ | |||
| HAL_StatusTypeDef HAL_SRAM_RegisterCallback(SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId, pSRAM_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_SRAM_UnRegisterCallback(SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId); | |||
| HAL_StatusTypeDef HAL_SRAM_RegisterDmaCallback(SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId, pSRAM_DmaCallbackTypeDef pCallback); | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -187,10 +211,11 @@ HAL_SRAM_StateTypeDef HAL_SRAM_GetState(SRAM_HandleTypeDef *hsram); | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_SRAM_H */ | |||
| #endif /* STM32H7xx_HAL_SRAM_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_swpmi.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of SWPMI HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_SWPMI_H | |||
| #define __STM32H7xx_HAL_SWPMI_H | |||
| #ifndef STM32H7xx_HAL_SWPMI_H | |||
| #define STM32H7xx_HAL_SWPMI_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -50,6 +32,7 @@ | |||
| * @{ | |||
| */ | |||
| /** @addtogroup SWPMI | |||
| * @{ | |||
| */ | |||
| @@ -68,7 +51,7 @@ typedef struct | |||
| This parameter can be a value of @ref SWPMI_Voltage_Class */ | |||
| uint32_t BitRate; /*!< Specifies the SWPMI Bitrate. | |||
| This parameter must be a number between 0 and 63. | |||
| This parameter must be a number between 0 and 255U. | |||
| The Bitrate is computed using the following formula: | |||
| SWPMI_freq = SWPMI_clk / (((BitRate) + 1) * 4) | |||
| */ | |||
| @@ -100,36 +83,71 @@ typedef enum | |||
| /** | |||
| * @brief SWPMI handle Structure definition | |||
| */ | |||
| #if (USE_HAL_SWPMI_REGISTER_CALLBACKS == 1) | |||
| typedef struct __SWPMI_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif /* USE_HAL_SWPMI_REGISTER_CALLBACKS */ | |||
| { | |||
| SWPMI_TypeDef *Instance; /* SWPMI registers base address */ | |||
| SWPMI_TypeDef *Instance; /*!< SWPMI registers base address */ | |||
| SWPMI_InitTypeDef Init; /*!< SWPMI communication parameters */ | |||
| SWPMI_InitTypeDef Init; /* SWMPI communication parameters */ | |||
| uint32_t *pTxBuffPtr; /*!< Pointer to SWPMI Tx transfer Buffer */ | |||
| uint32_t *pTxBuffPtr; /* Pointer to SWPMI Tx transfer Buffer */ | |||
| uint32_t TxXferSize; /*!< SWPMI Tx Transfer size */ | |||
| uint32_t TxXferSize; /* SWPMI Tx Transfer size */ | |||
| uint32_t TxXferCount; /*!< SWPMI Tx Transfer Counter */ | |||
| uint32_t TxXferCount; /* SWPMI Tx Transfer Counter */ | |||
| uint32_t *pRxBuffPtr; /*!< Pointer to SWPMI Rx transfer Buffer */ | |||
| uint32_t *pRxBuffPtr; /* Pointer to SWPMI Rx transfer Buffer */ | |||
| uint32_t RxXferSize; /*!< SWPMI Rx Transfer size */ | |||
| uint32_t RxXferSize; /* SWPMI Rx Transfer size */ | |||
| uint32_t RxXferCount; /*!< SWPMI Rx Transfer Counter */ | |||
| uint32_t RxXferCount; /* SWPMI Rx Transfer Counter */ | |||
| DMA_HandleTypeDef *hdmatx; /*!< SWPMI Tx DMA Handle parameters */ | |||
| DMA_HandleTypeDef *hdmatx; /* SWPMI Tx DMA Handle parameters */ | |||
| DMA_HandleTypeDef *hdmarx; /*!< SWPMI Rx DMA Handle parameters */ | |||
| DMA_HandleTypeDef *hdmarx; /* SWPMI Rx DMA Handle parameters */ | |||
| HAL_LockTypeDef Lock; /*!< SWPMI object */ | |||
| HAL_LockTypeDef Lock; /* SWPMI object */ | |||
| __IO HAL_SWPMI_StateTypeDef State; /*!< SWPMI communication state */ | |||
| __IO HAL_SWPMI_StateTypeDef State; /* SWPMI communication state */ | |||
| __IO uint32_t ErrorCode; /*!< SWPMI Error code */ | |||
| __IO uint32_t ErrorCode; /* SWPMI Error code */ | |||
| #if (USE_HAL_SWPMI_REGISTER_CALLBACKS == 1) | |||
| void (*RxCpltCallback) (struct __SWPMI_HandleTypeDef *hswpmi); /*!< SWPMI receive complete callback */ | |||
| void (*RxHalfCpltCallback) (struct __SWPMI_HandleTypeDef *hswpmi); /*!< SWPMI receive half complete callback */ | |||
| void (*TxCpltCallback) (struct __SWPMI_HandleTypeDef *hswpmi); /*!< SWPMI transmit complete callback */ | |||
| void (*TxHalfCpltCallback) (struct __SWPMI_HandleTypeDef *hswpmi); /*!< SWPMI transmit half complete callback */ | |||
| void (*ErrorCallback) (struct __SWPMI_HandleTypeDef *hswpmi); /*!< SWPMI error callback */ | |||
| void (*MspInitCallback) (struct __SWPMI_HandleTypeDef *hswpmi); /*!< SWPMI MSP init callback */ | |||
| void (*MspDeInitCallback) (struct __SWPMI_HandleTypeDef *hswpmi); /*!< SWPMI MSP de-init callback */ | |||
| #endif | |||
| }SWPMI_HandleTypeDef; | |||
| #if (USE_HAL_SWPMI_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief SWPMI callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| HAL_SWPMI_RX_COMPLETE_CB_ID = 0x00U, /*!< SWPMI receive complete callback ID */ | |||
| HAL_SWPMI_RX_HALFCOMPLETE_CB_ID = 0x01U, /*!< SWPMI receive half complete callback ID */ | |||
| HAL_SWPMI_TX_COMPLETE_CB_ID = 0x02U, /*!< SWPMI transmit complete callback ID */ | |||
| HAL_SWPMI_TX_HALFCOMPLETE_CB_ID = 0x03U, /*!< SWPMI transmit half complete callback ID */ | |||
| HAL_SWPMI_ERROR_CB_ID = 0x04U, /*!< SWPMI error callback ID */ | |||
| HAL_SWPMI_MSPINIT_CB_ID = 0x05U, /*!< SWPMI MSP init callback ID */ | |||
| HAL_SWPMI_MSPDEINIT_CB_ID = 0x06U /*!< SWPMI MSP de-init callback ID */ | |||
| }HAL_SWPMI_CallbackIDTypeDef; | |||
| /** | |||
| * @brief SWPMI callback pointer definition | |||
| */ | |||
| typedef void (*pSWPMI_CallbackTypeDef)(SWPMI_HandleTypeDef *hswpmi); | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -143,11 +161,17 @@ typedef struct | |||
| * @defgroup SWPMI_Error_Code SWPMI Error Code Bitmap | |||
| * @{ | |||
| */ | |||
| #define HAL_SWPMI_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */ | |||
| #define HAL_SWPMI_ERROR_CRC ((uint32_t)0x00000004) /*!< frame error */ | |||
| #define HAL_SWPMI_ERROR_OVR ((uint32_t)0x00000008) /*!< Overrun error */ | |||
| #define HAL_SWPMI_ERROR_UDR ((uint32_t)0x0000000C) /*!< Underrun error */ | |||
| #define HAL_SWPMI_ERROR_DMA ((uint32_t)0x00000010) /*!< DMA transfer error */ | |||
| #define HAL_SWPMI_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */ | |||
| #define HAL_SWPMI_ERROR_CRC ((uint32_t)0x00000004) /*!< frame error */ | |||
| #define HAL_SWPMI_ERROR_OVR ((uint32_t)0x00000008) /*!< Overrun error */ | |||
| #define HAL_SWPMI_ERROR_UDR ((uint32_t)0x0000000C) /*!< Underrun error */ | |||
| #define HAL_SWPMI_ERROR_DMA ((uint32_t)0x00000010) /*!< DMA transfer error */ | |||
| #define HAL_SWPMI_ERROR_TIMEOUT ((uint32_t)0x00000020) /*!< Transfer timeout */ | |||
| #define HAL_SWPMI_ERROR_TXBEF_TIMEOUT ((uint32_t)0x00000040) /*!< End Tx buffer timeout */ | |||
| #define HAL_SWPMI_ERROR_TRANSCEIVER_NOT_READY ((uint32_t)0x00000080) /*!< Transceiver not ready */ | |||
| #if (USE_HAL_SWPMI_REGISTER_CALLBACKS == 1) | |||
| #define HAL_SWPMI_ERROR_INVALID_CALLBACK ((uint32_t)0x00000100) /*!< Invalid callback error */ | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -231,132 +255,151 @@ typedef struct | |||
| */ | |||
| /** @brief Reset SWPMI handle state. | |||
| * @param __HANDLE__: specifies the SWPMI Handle. | |||
| * @param __HANDLE__ specifies the SWPMI Handle. | |||
| * @retval None | |||
| */ | |||
| #if (USE_HAL_SWPMI_REGISTER_CALLBACKS == 1) | |||
| #define __HAL_SWPMI_RESET_HANDLE_STATE(__HANDLE__) do{ \ | |||
| (__HANDLE__)->State = HAL_SWPMI_STATE_RESET; \ | |||
| (__HANDLE__)->MspInitCallback = NULL; \ | |||
| (__HANDLE__)->MspDeInitCallback = NULL; \ | |||
| } while(0) | |||
| #else | |||
| #define __HAL_SWPMI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SWPMI_STATE_RESET) | |||
| #endif | |||
| /** | |||
| * @brief Enable the SWPMI peripheral. | |||
| * @param __HANDLE__: SWPMI handle | |||
| * @param __HANDLE__ SWPMI handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SWPMI_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, SWPMI_CR_SWPACT) | |||
| /** | |||
| * @brief Disable the SWPMI peripheral. | |||
| * @param __HANDLE__: SWPMI handle | |||
| * @param __HANDLE__ SWPMI handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SWPMI_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR, SWPMI_CR_SWPACT) | |||
| /** | |||
| * @brief Enable/Disable the SWPMI transceiver. | |||
| * @param __HANDLE__: SWPMI handle | |||
| * @brief Enable the SWPMI transceiver. | |||
| * @param __HANDLE__ SWPMI handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SWPMI_TRANSCEIVER_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, SWPMI_CR_SWPEN) | |||
| /** | |||
| * @brief Disable the SWPMI transceiver. | |||
| * @param __HANDLE__ SWPMI handle | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SWPMI_TRANSCEIVER_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR, SWPMI_CR_SWPEN) | |||
| /** @brief Check whether the specified SWPMI flag is set or not. | |||
| * @param __HANDLE__: specifies the SWPMI Handle. | |||
| * @param __HANDLE__ specifies the SWPMI Handle. | |||
| * @param __FLAG__: specifies the flag to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg SWPMI_FLAG_RXBFF : Receive buffer full flag. | |||
| * @arg SWPMI_FLAG_TXBEF : Transmit buffer empty flag. | |||
| * @arg SWPMI_FLAG_RXBERF : Receive CRC error flag. | |||
| * @arg SWPMI_FLAG_RXOVRF : Receive overrun error flag. | |||
| * @arg SWPMI_FLAG_TXUNRF : Transmit underrun error flag. | |||
| * @arg SWPMI_FLAG_RXNE : Receive data register not empty. | |||
| * @arg SWPMI_FLAG_TXE : Transmit data register empty. | |||
| * @arg SWPMI_FLAG_TCF : Transfer complete flag. | |||
| * @arg SWPMI_FLAG_SRF : Slave resume flag. | |||
| * @arg SWPMI_FLAG_SUSP : SUSPEND flag. | |||
| * @arg SWPMI_FLAG_DEACTF : DEACTIVATED flag. | |||
| * @arg SWPMI_FLAG_RXBFF Receive buffer full flag. | |||
| * @arg SWPMI_FLAG_TXBEF Transmit buffer empty flag. | |||
| * @arg SWPMI_FLAG_RXBERF Receive CRC error flag. | |||
| * @arg SWPMI_FLAG_RXOVRF Receive overrun error flag. | |||
| * @arg SWPMI_FLAG_TXUNRF Transmit underrun error flag. | |||
| * @arg SWPMI_FLAG_RXNE Receive data register not empty. | |||
| * @arg SWPMI_FLAG_TXE Transmit data register empty. | |||
| * @arg SWPMI_FLAG_TCF Transfer complete flag. | |||
| * @arg SWPMI_FLAG_SRF Slave resume flag. | |||
| * @arg SWPMI_FLAG_SUSP SUSPEND flag. | |||
| * @arg SWPMI_FLAG_DEACTF DEACTIVATED flag. | |||
| * @arg SWPMI_FLAG_RDYF Transceiver ready flag. | |||
| * @retval The new state of __FLAG__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_SWPMI_GET_FLAG(__HANDLE__, __FLAG__) (READ_BIT((__HANDLE__)->Instance->ISR, (__FLAG__)) == (__FLAG__)) | |||
| /** @brief Clear the specified SWPMI ISR flag. | |||
| * @param __HANDLE__: specifies the SWPMI Handle. | |||
| * @param __HANDLE__ specifies the SWPMI Handle. | |||
| * @param __FLAG__: specifies the flag to clear. | |||
| * This parameter can be one of the following values: | |||
| * @arg SWPMI_FLAG_RXBFF : Receive buffer full flag. | |||
| * @arg SWPMI_FLAG_TXBEF : Transmit buffer empty flag. | |||
| * @arg SWPMI_FLAG_RXBERF : Receive CRC error flag. | |||
| * @arg SWPMI_FLAG_RXOVRF : Receive overrun error flag. | |||
| * @arg SWPMI_FLAG_TXUNRF : Transmit underrun error flag. | |||
| * @arg SWPMI_FLAG_TCF : Transfer complete flag. | |||
| * @arg SWPMI_FLAG_SRF : Slave resume flag. | |||
| * @arg SWPMI_FLAG_RDYF: Transceiver ready flag | |||
| * @arg SWPMI_FLAG_RXBFF Receive buffer full flag. | |||
| * @arg SWPMI_FLAG_TXBEF Transmit buffer empty flag. | |||
| * @arg SWPMI_FLAG_RXBERF Receive CRC error flag. | |||
| * @arg SWPMI_FLAG_RXOVRF Receive overrun error flag. | |||
| * @arg SWPMI_FLAG_TXUNRF Transmit underrun error flag. | |||
| * @arg SWPMI_FLAG_TCF Transfer complete flag. | |||
| * @arg SWPMI_FLAG_SRF Slave resume flag. | |||
| * @arg SWPMI_FLAG_RDYF Transceiver ready flag. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SWPMI_CLEAR_FLAG(__HANDLE__, __FLAG__) WRITE_REG((__HANDLE__)->Instance->ICR, (__FLAG__)) | |||
| /** @brief Enable the specified SWPMI interrupt. | |||
| * @param __HANDLE__: specifies the SWPMI Handle. | |||
| * @param __INTERRUPT__: specifies the SWPMI interrupt source to enable. | |||
| * @param __HANDLE__ specifies the SWPMI Handle. | |||
| * @param __INTERRUPT__ specifies the SWPMI interrupt source to enable. | |||
| * This parameter can be one of the following values: | |||
| * @arg SWPMI_IT_SRIE : Slave resume interrupt. | |||
| * @arg SWPMI_IT_TCIE : Transmit complete interrupt. | |||
| * @arg SWPMI_IT_TIE : Transmit interrupt. | |||
| * @arg SWPMI_IT_RIE : Receive interrupt. | |||
| * @arg SWPMI_IT_TXUNRIE : Transmit underrun error interrupt. | |||
| * @arg SWPMI_IT_RXOVRIE : Receive overrun error interrupt. | |||
| * @arg SWPMI_IT_RXBEIE : Receive CRC error interrupt. | |||
| * @arg SWPMI_IT_TXBEIE : Transmit buffer empty interrupt. | |||
| * @arg SWPMI_IT_RXBFIE : Receive buffer full interrupt. | |||
| * @arg SWPMI_IT_RDYIE Transceiver ready interrupt. | |||
| * @arg SWPMI_IT_SRIE Slave resume interrupt. | |||
| * @arg SWPMI_IT_TCIE Transmit complete interrupt. | |||
| * @arg SWPMI_IT_TIE Transmit interrupt. | |||
| * @arg SWPMI_IT_RIE Receive interrupt. | |||
| * @arg SWPMI_IT_TXUNRIE Transmit underrun error interrupt. | |||
| * @arg SWPMI_IT_RXOVRIE Receive overrun error interrupt. | |||
| * @arg SWPMI_IT_RXBEIE Receive CRC error interrupt. | |||
| * @arg SWPMI_IT_TXBEIE Transmit buffer empty interrupt. | |||
| * @arg SWPMI_IT_RXBFIE Receive buffer full interrupt. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SWPMI_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->IER, (__INTERRUPT__)) | |||
| /** @brief Disable the specified SWPMI interrupt. | |||
| * @param __HANDLE__: specifies the SWPMI Handle. | |||
| * @param __INTERRUPT__: specifies the SWPMI interrupt source to disable. | |||
| * @param __HANDLE__ specifies the SWPMI Handle. | |||
| * @param __INTERRUPT__ specifies the SWPMI interrupt source to disable. | |||
| * This parameter can be one of the following values: | |||
| * @arg SWPMI_IT_SRIE : Slave resume interrupt. | |||
| * @arg SWPMI_IT_TCIE : Transmit complete interrupt. | |||
| * @arg SWPMI_IT_TIE : Transmit interrupt. | |||
| * @arg SWPMI_IT_RIE : Receive interrupt. | |||
| * @arg SWPMI_IT_TXUNRIE : Transmit underrun error interrupt. | |||
| * @arg SWPMI_IT_RXOVRIE : Receive overrun error interrupt. | |||
| * @arg SWPMI_IT_RXBEIE : Receive CRC error interrupt. | |||
| * @arg SWPMI_IT_TXBEIE : Transmit buffer empty interrupt. | |||
| * @arg SWPMI_IT_RXBFIE : Receive buffer full interrupt. | |||
| * @arg SWPMI_IT_RDYIE Transceiver ready interrupt. | |||
| * @arg SWPMI_IT_SRIE Slave resume interrupt. | |||
| * @arg SWPMI_IT_TCIE Transmit complete interrupt. | |||
| * @arg SWPMI_IT_TIE Transmit interrupt. | |||
| * @arg SWPMI_IT_RIE Receive interrupt. | |||
| * @arg SWPMI_IT_TXUNRIE Transmit underrun error interrupt. | |||
| * @arg SWPMI_IT_RXOVRIE Receive overrun error interrupt. | |||
| * @arg SWPMI_IT_RXBEIE Receive CRC error interrupt. | |||
| * @arg SWPMI_IT_TXBEIE Transmit buffer empty interrupt. | |||
| * @arg SWPMI_IT_RXBFIE Receive buffer full interrupt. | |||
| * @retval None | |||
| */ | |||
| #define __HAL_SWPMI_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->IER, (__INTERRUPT__)) | |||
| /** @brief Check whether the specified SWPMI interrupt has occurred or not. | |||
| * @param __HANDLE__: specifies the SWPMI Handle. | |||
| * @param __IT__: specifies the SWPMI interrupt to check. | |||
| * @param __HANDLE__ specifies the SWPMI Handle. | |||
| * @param __IT__ specifies the SWPMI interrupt to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg SWPMI_IT_SRIE : Slave resume interrupt. | |||
| * @arg SWPMI_IT_TCIE : Transmit complete interrupt. | |||
| * @arg SWPMI_IT_TIE : Transmit interrupt. | |||
| * @arg SWPMI_IT_RIE : Receive interrupt. | |||
| * @arg SWPMI_IT_TXUNRIE : Transmit underrun error interrupt. | |||
| * @arg SWPMI_IT_RXOVRIE : Receive overrun error interrupt. | |||
| * @arg SWPMI_IT_RXBERIE : Receive CRC error interrupt. | |||
| * @arg SWPMI_IT_TXBEIE : Transmit buffer empty interrupt. | |||
| * @arg SWPMI_IT_RXBFIE : Receive buffer full interrupt. | |||
| * @arg SWPMI_IT_RDYIE Transceiver ready interrupt. | |||
| * @arg SWPMI_IT_SRIE Slave resume interrupt. | |||
| * @arg SWPMI_IT_TCIE Transmit complete interrupt. | |||
| * @arg SWPMI_IT_TIE Transmit interrupt. | |||
| * @arg SWPMI_IT_RIE Receive interrupt. | |||
| * @arg SWPMI_IT_TXUNRIE Transmit underrun error interrupt. | |||
| * @arg SWPMI_IT_RXOVRIE Receive overrun error interrupt. | |||
| * @arg SWPMI_IT_RXBERIE Receive CRC error interrupt. | |||
| * @arg SWPMI_IT_TXBEIE Transmit buffer empty interrupt. | |||
| * @arg SWPMI_IT_RXBFIE Receive buffer full interrupt. | |||
| * @retval The new state of __IT__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_SWPMI_GET_IT(__HANDLE__, __IT__) (READ_BIT((__HANDLE__)->Instance->ISR,(__IT__)) == (__IT__)) | |||
| /** @brief Check whether the specified SWPMI interrupt source is enabled or not. | |||
| * @param __HANDLE__: specifies the SWPMI Handle. | |||
| * @param __IT__: specifies the SWPMI interrupt source to check. | |||
| * @param __HANDLE__ specifies the SWPMI Handle. | |||
| * @param __IT__ specifies the SWPMI interrupt source to check. | |||
| * This parameter can be one of the following values: | |||
| * @arg SWPMI_IT_SRIE : Slave resume interrupt. | |||
| * @arg SWPMI_IT_TCIE : Transmit complete interrupt. | |||
| * @arg SWPMI_IT_TIE : Transmit interrupt. | |||
| * @arg SWPMI_IT_RIE : Receive interrupt. | |||
| * @arg SWPMI_IT_TXUNRIE : Transmit underrun error interrupt. | |||
| * @arg SWPMI_IT_RXOVRIE : Receive overrun error interrupt. | |||
| * @arg SWPMI_IT_RXBERIE : Receive CRC error interrupt. | |||
| * @arg SWPMI_IT_TXBEIE : Transmit buffer empty interrupt. | |||
| * @arg SWPMI_IT_RXBFIE : Receive buffer full interrupt. | |||
| * @arg SWPMI_IT_RDYIE Transceiver ready interrupt. | |||
| * @arg SWPMI_IT_SRIE Slave resume interrupt. | |||
| * @arg SWPMI_IT_TCIE Transmit complete interrupt. | |||
| * @arg SWPMI_IT_TIE Transmit interrupt. | |||
| * @arg SWPMI_IT_RIE Receive interrupt. | |||
| * @arg SWPMI_IT_TXUNRIE Transmit underrun error interrupt. | |||
| * @arg SWPMI_IT_RXOVRIE Receive overrun error interrupt. | |||
| * @arg SWPMI_IT_RXBERIE Receive CRC error interrupt. | |||
| * @arg SWPMI_IT_TXBEIE Transmit buffer empty interrupt. | |||
| * @arg SWPMI_IT_RXBFIE Receive buffer full interrupt. | |||
| * @retval The new state of __IT__ (TRUE or FALSE). | |||
| */ | |||
| #define __HAL_SWPMI_GET_IT_SOURCE(__HANDLE__, __IT__) ((READ_BIT((__HANDLE__)->Instance->IER, (__IT__)) == (__IT__)) ? SET : RESET) | |||
| @@ -375,6 +418,15 @@ HAL_StatusTypeDef HAL_SWPMI_DeInit(SWPMI_HandleTypeDef *hswpmi); | |||
| void HAL_SWPMI_MspInit(SWPMI_HandleTypeDef *hswpmi); | |||
| void HAL_SWPMI_MspDeInit(SWPMI_HandleTypeDef *hswpmi); | |||
| #if (USE_HAL_SWPMI_REGISTER_CALLBACKS == 1) | |||
| /* SWPMI callbacks register/unregister functions ********************************/ | |||
| HAL_StatusTypeDef HAL_SWPMI_RegisterCallback(SWPMI_HandleTypeDef *hswpmi, | |||
| HAL_SWPMI_CallbackIDTypeDef CallbackID, | |||
| pSWPMI_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_SWPMI_UnRegisterCallback(SWPMI_HandleTypeDef *hswpmi, | |||
| HAL_SWPMI_CallbackIDTypeDef CallbackID); | |||
| #endif | |||
| /* IO operation functions *****************************************************/ | |||
| HAL_StatusTypeDef HAL_SWPMI_Transmit(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size, uint32_t Timeout); | |||
| HAL_StatusTypeDef HAL_SWPMI_Receive(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size, uint32_t Timeout); | |||
| @@ -436,7 +488,7 @@ uint32_t HAL_SWPMI_GetError(SWPMI_HandleTypeDef *hswpmi); | |||
| #define IS_SWPMI_VOLTAGE_CLASS(__CLASS__) (((__CLASS__) == SWPMI_VOLTAGE_CLASS_C) || \ | |||
| ((__CLASS__) == SWPMI_VOLTAGE_CLASS_B)) | |||
| #define IS_SWPMI_BITRATE_VALUE(__VALUE__) (((__VALUE__) <= 63)) | |||
| #define IS_SWPMI_BITRATE_VALUE(__VALUE__) (((__VALUE__) <= 255U)) | |||
| #define IS_SWPMI_TX_BUFFERING_MODE(__MODE__) (((__MODE__) == SWPMI_TX_NO_SOFTWAREBUFFER) || \ | |||
| @@ -454,6 +506,7 @@ uint32_t HAL_SWPMI_GetError(SWPMI_HandleTypeDef *hswpmi); | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -462,6 +515,6 @@ uint32_t HAL_SWPMI_GetError(SWPMI_HandleTypeDef *hswpmi); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_SWPMI_H */ | |||
| #endif /* STM32H7xx_HAL_SWPMI_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_tim_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of TIM HAL Extended module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_TIM_EX_H | |||
| #define __STM32H7xx_HAL_TIM_EX_H | |||
| #ifndef STM32H7xx_HAL_TIM_EX_H | |||
| #define STM32H7xx_HAL_TIM_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -65,23 +47,25 @@ | |||
| typedef struct | |||
| { | |||
| uint32_t IC1Polarity; /*!< Specifies the active edge of the input signal. | |||
| This parameter can be a value of @ref TIM_Input_Capture_Polarity */ | |||
| This parameter can be a value of @ref TIM_Input_Capture_Polarity */ | |||
| uint32_t IC1Prescaler; /*!< Specifies the Input Capture Prescaler. | |||
| This parameter can be a value of @ref TIM_Input_Capture_Prescaler */ | |||
| uint32_t IC1Filter; /*!< Specifies the input capture filter. | |||
| This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF */ | |||
| uint32_t Commutation_Delay; /*!< Specifies the pulse value to be loaded into the Capture Compare Register. | |||
| This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */ | |||
| This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF */ | |||
| } TIM_HallSensor_InitTypeDef; | |||
| #if defined(TIM_BREAK_INPUT_SUPPORT) | |||
| /** | |||
| * @brief TIM Break/Break2 input configuration | |||
| */ | |||
| typedef struct { | |||
| typedef struct | |||
| { | |||
| uint32_t Source; /*!< Specifies the source of the timer break input. | |||
| This parameter can be a value of @ref TIMEx_Break_Input_Source */ | |||
| uint32_t Enable; /*!< Specifies whether or not the break input source is enabled. | |||
| @@ -89,334 +73,168 @@ typedef struct { | |||
| uint32_t Polarity; /*!< Specifies the break input source polarity. | |||
| This parameter can be a value of @ref TIMEx_Break_Input_Source_Polarity | |||
| Not relevant when analog watchdog output of the DFSDM1 used as break input source */ | |||
| } TIMEx_BreakInputConfigTypeDef; | |||
| } | |||
| TIMEx_BreakInputConfigTypeDef; | |||
| #endif /* TIM_BREAK_INPUT_SUPPORT */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* End of exported types -----------------------------------------------------*/ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup TIMEx_Exported_Constants TIM Extended Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup TIMEx_Channel TIM Extended Channel | |||
| * @{ | |||
| */ | |||
| #define TIM_CHANNEL_1 ((uint32_t)0x0000U) /*!< TIM Channel 1*/ | |||
| #define TIM_CHANNEL_2 ((uint32_t)0x0004U) /*!< TIM Channel 2*/ | |||
| #define TIM_CHANNEL_3 ((uint32_t)0x0008U) /*!< TIM Channel 3*/ | |||
| #define TIM_CHANNEL_4 ((uint32_t)0x000CU) /*!< TIM Channel 4*/ | |||
| #define TIM_CHANNEL_5 ((uint32_t)0x0010U) /*!< TIM Channel 5*/ | |||
| #define TIM_CHANNEL_6 ((uint32_t)0x0014U) /*!< TIM Channel 6*/ | |||
| #define TIM_CHANNEL_ALL ((uint32_t)0x003CU) /*!< TIM all Channels */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup TIMEx_Output_Compare_and_PWM_modes TIM Output Compare and PWM Modes | |||
| * @{ | |||
| */ | |||
| #define TIM_OCMODE_TIMING ((uint32_t)0x0000U) /*!< TIM Output timing mode */ | |||
| #define TIM_OCMODE_ACTIVE ((uint32_t)TIM_CCMR1_OC1M_0) /*!< TIM Output Active mode */ | |||
| #define TIM_OCMODE_INACTIVE ((uint32_t)TIM_CCMR1_OC1M_1) /*!< TIM Output Inactive mode */ | |||
| #define TIM_OCMODE_TOGGLE ((uint32_t)TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0) /*!< TIM Output Toggle mode */ | |||
| #define TIM_OCMODE_PWM1 ((uint32_t)TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1) /*!< TIM PWM mode 1 */ | |||
| #define TIM_OCMODE_PWM2 ((uint32_t)TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0) /*!< TIM PWM mode 2 */ | |||
| #define TIM_OCMODE_FORCED_ACTIVE ((uint32_t)TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_0) /*!< TIM Forced Active mode */ | |||
| #define TIM_OCMODE_FORCED_INACTIVE ((uint32_t)TIM_CCMR1_OC1M_2) /*!< TIM Forced Inactive mode */ | |||
| #define TIM_OCMODE_RETRIGERRABLE_OPM1 ((uint32_t)TIM_CCMR1_OC1M_3) /*!< TIM Rettrigerrable OPM mode 1 */ | |||
| #define TIM_OCMODE_RETRIGERRABLE_OPM2 ((uint32_t)TIM_CCMR1_OC1M_3 | TIM_CCMR1_OC1M_0) /*!< TIM Rettrigerrable OPM mode 2 */ | |||
| #define TIM_OCMODE_COMBINED_PWM1 ((uint32_t)TIM_CCMR1_OC1M_3 | TIM_CCMR1_OC1M_2) /*!< TIM Combined PWM mode 1 */ | |||
| #define TIM_OCMODE_COMBINED_PWM2 ((uint32_t)TIM_CCMR1_OC1M_3 | TIM_CCMR1_OC1M_0 | TIM_CCMR1_OC1M_2) /*!< TIM Combined PWM mode 2 */ | |||
| #define TIM_OCMODE_ASSYMETRIC_PWM1 ((uint32_t)TIM_CCMR1_OC1M_3 | TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2) /*!< TIM Asymetruc PWM mode 1 */ | |||
| #define TIM_OCMODE_ASSYMETRIC_PWM2 ((uint32_t)TIM_CCMR1_OC1M_3 | TIM_CCMR1_OC1M) /*!< TIM Asymetruc PWM mode 2 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup TIMEx_ClearInput_Source TIM Extended Clear Input Source | |||
| * @{ | |||
| */ | |||
| #define TIM_CLEARINPUTSOURCE_ETR ((uint32_t)0x0001U) /*!< TIM Clear input source connected to ETR */ | |||
| #define TIM_CLEARINPUTSOURCE_OCREFCLR ((uint32_t)0x0002U) /*!< TIM Clear input source connected to OCREFClear */ | |||
| #define TIM_CLEARINPUTSOURCE_NONE ((uint32_t)0x0000U) /*!< TIM Clear input source None */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup TIMEx_Break2_Input_enable_disable TIMEX Break input 2 Enable | |||
| * @{ | |||
| */ | |||
| #define TIM_BREAK2_DISABLE ((uint32_t)0x00000000U) /*!< TIM Break2 disabled */ | |||
| #define TIM_BREAK2_ENABLE ((uint32_t)TIM_BDTR_BK2E) /*!< TIM Break2 enabled */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup TIMEx_Break2_Polarity TIM Extended Break Input 2 Polarity | |||
| /** @defgroup TIMEx_Remap TIM Extended Remapping | |||
| * @{ | |||
| */ | |||
| #define TIM_BREAK2POLARITY_LOW ((uint32_t)0x00000000U) /*!< TIM Break2 polarity low */ | |||
| #define TIM_BREAK2POLARITY_HIGH ((uint32_t)TIM_BDTR_BK2P) /*!< TIM Break2 polarity high */ | |||
| #define TIM_TIM1_ETR_GPIO 0x00000000U /* !< TIM1_ETR is connected to GPIO */ | |||
| #define TIM_TIM1_ETR_COMP1 TIM1_AF1_ETRSEL_0 /* !< TIM1_ETR is connected to COMP1 OUT */ | |||
| #define TIM_TIM1_ETR_COMP2 TIM1_AF1_ETRSEL_1 /* !< TIM1_ETR is connected to COMP2 OUT */ | |||
| #define TIM_TIM1_ETR_ADC1_AWD1 (TIM1_AF1_ETRSEL_1 | TIM1_AF1_ETRSEL_0) /* !< TIM1_ETR is connected to ADC1 AWD1 */ | |||
| #define TIM_TIM1_ETR_ADC1_AWD2 (TIM1_AF1_ETRSEL_2) /* !< TIM1_ETR is connected to ADC1 AWD2 */ | |||
| #define TIM_TIM1_ETR_ADC1_AWD3 (TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_0) /* !< TIM1_ETR is connected to ADC1 AWD3 */ | |||
| #define TIM_TIM1_ETR_ADC3_AWD1 (TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_1) /* !< TIM1_ETR is connected to ADC3 AWD1 */ | |||
| #define TIM_TIM1_ETR_ADC3_AWD2 (TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_1 | TIM1_AF1_ETRSEL_0) /* !< TIM1_ETR is connected to ADC3 AWD2 */ | |||
| #define TIM_TIM1_ETR_ADC3_AWD3 TIM1_AF1_ETRSEL_3 /* !< TIM1_ETR is connected to ADC3 AWD3 */ | |||
| #define TIM_TIM8_ETR_GPIO 0x00000000U /* !< TIM8_ETR is connected to GPIO */ | |||
| #define TIM_TIM8_ETR_COMP1 TIM8_AF1_ETRSEL_0 /* !< TIM8_ETR is connected to COMP1 OUT */ | |||
| #define TIM_TIM8_ETR_COMP2 TIM8_AF1_ETRSEL_1 /* !< TIM8_ETR is connected to COMP2 OUT */ | |||
| #define TIM_TIM8_ETR_ADC1_AWD1 (TIM8_AF1_ETRSEL_1 | TIM8_AF1_ETRSEL_0) /* !< TIM8_ETR is connected to ADC1 AWD1 */ | |||
| #define TIM_TIM8_ETR_ADC1_AWD2 (TIM8_AF1_ETRSEL_2) /* !< TIM8_ETR is connected to ADC1 AWD2 */ | |||
| #define TIM_TIM8_ETR_ADC1_AWD3 (TIM8_AF1_ETRSEL_2 | TIM8_AF1_ETRSEL_0) /* !< TIM8_ETR is connected to ADC1 AWD3 */ | |||
| #define TIM_TIM8_ETR_ADC3_AWD1 (TIM8_AF1_ETRSEL_2 | TIM8_AF1_ETRSEL_1) /* !< TIM8_ETR is connected to ADC3 AWD1 */ | |||
| #define TIM_TIM8_ETR_ADC3_AWD2 (TIM8_AF1_ETRSEL_2 | TIM8_AF1_ETRSEL_1 | TIM8_AF1_ETRSEL_0) /* !< TIM8_ETR is connected to ADC3 AWD2 */ | |||
| #define TIM_TIM8_ETR_ADC3_AWD3 TIM8_AF1_ETRSEL_3 /* !< TIM8_ETR is connected to ADC3 AWD3 */ | |||
| #define TIM_TIM2_ETR_GPIO 0x00000000U /* !< TIM2_ETR is connected to GPIO */ | |||
| #define TIM_TIM2_ETR_COMP1 (TIM2_AF1_ETRSEL_0) /* !< TIM2_ETR is connected to COMP1 OUT */ | |||
| #define TIM_TIM2_ETR_COMP2 (TIM2_AF1_ETRSEL_1) /* !< TIM2_ETR is connected to COMP2 OUT */ | |||
| #define TIM_TIM2_ETR_RCC_LSE (TIM2_AF1_ETRSEL_1 | TIM8_AF1_ETRSEL_0) /* !< TIM2_ETR is connected to RCC LSE */ | |||
| #define TIM_TIM2_ETR_SAI1_FSA TIM2_AF1_ETRSEL_2 /* !< TIM2_ETR is connected to SAI1 FS_A */ | |||
| #define TIM_TIM2_ETR_SAI1_FSB (TIM2_AF1_ETRSEL_2 | TIM8_AF1_ETRSEL_0) /* !< TIM2_ETR is connected to SAI1 FS_B */ | |||
| #define TIM_TIM3_ETR_GPIO 0x00000000U /* !< TIM3_ETR is connected to GPIO */ | |||
| #define TIM_TIM3_ETR_COMP1 TIM3_AF1_ETRSEL_0 /* !< TIM3_ETR is connected to COMP1 OUT */ | |||
| #define TIM_TIM5_ETR_GPIO 0x00000000U /* !< TIM5_ETR is connected to GPIO */ | |||
| #define TIM_TIM5_ETR_SAI2_FSA TIM5_AF1_ETRSEL_0 /* !< TIM5_ETR is connected to SAI2 FS_A */ | |||
| #define TIM_TIM5_ETR_SAI2_FSB TIM5_AF1_ETRSEL_1 /* !< TIM5_ETR is connected to SAI2 FS_B */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #if defined(TIM_BREAK_INPUT_SUPPORT) | |||
| /** @defgroup TIMEx_Trigger_Selection TIM Trigger Selection | |||
| /** @defgroup TIMEx_Break_Input TIM Extended Break input | |||
| * @{ | |||
| */ | |||
| #define TIM_TS_ITR4 ((uint32_t)0x0100000) /*!< TIM Internal trigger 4 */ | |||
| #define TIM_TS_ITR5 ((uint32_t)0x0100010) /*!< TIM Internal trigger 5 */ | |||
| #define TIM_TS_ITR6 ((uint32_t)0x0100020) /*!< TIM Internal trigger 6 */ | |||
| #define TIM_TS_ITR7 ((uint32_t)0x0100030) /*!< TIM Internal trigger 7 */ | |||
| #define TIM_TS_ITR8 ((uint32_t)0x0100040) /*!< TIM Internal trigger 8 */ | |||
| #define TIM_BREAKINPUT_BRK 0x00000001U /* !< Timer break input */ | |||
| #define TIM_BREAKINPUT_BRK2 0x00000002U /* !< Timer break2 input */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup TIM_Event_Source TIM Extended Event Source | |||
| /** @defgroup TIMEx_Break_Input_Source TIM Extended Break input source | |||
| * @{ | |||
| */ | |||
| #define TIM_EVENTSOURCE_UPDATE TIM_EGR_UG /*!< Reinitialize the counter and generates an update of the registers */ | |||
| #define TIM_EVENTSOURCE_CC1 TIM_EGR_CC1G /*!< A capture/compare event is generated on channel 1 */ | |||
| #define TIM_EVENTSOURCE_CC2 TIM_EGR_CC2G /*!< A capture/compare event is generated on channel 2 */ | |||
| #define TIM_EVENTSOURCE_CC3 TIM_EGR_CC3G /*!< A capture/compare event is generated on channel 3 */ | |||
| #define TIM_EVENTSOURCE_CC4 TIM_EGR_CC4G /*!< A capture/compare event is generated on channel 4 */ | |||
| #define TIM_EVENTSOURCE_COM TIM_EGR_COMG /*!< A commutation event is generated */ | |||
| #define TIM_EVENTSOURCE_TRIGGER TIM_EGR_TG /*!< A trigger event is generated */ | |||
| #define TIM_EVENTSOURCE_BREAK TIM_EGR_BG /*!< A break event is generated */ | |||
| #define TIM_EVENTSOURCE_BREAK2 TIM_EGR_B2G /*!< A break 2 event is generated */ | |||
| #define TIM_BREAKINPUTSOURCE_BKIN 0x00000001U /* !< An external source (GPIO) is connected to the BKIN pin */ | |||
| #define TIM_BREAKINPUTSOURCE_COMP1 0x00000002U /* !< The COMP1 output is connected to the break input */ | |||
| #define TIM_BREAKINPUTSOURCE_COMP2 0x00000004U /* !< The COMP2 output is connected to the break input */ | |||
| #define TIM_BREAKINPUTSOURCE_DFSDM1 0x00000008U /* !< The analog watchdog output of the DFSDM1 peripheral is connected to the break input */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup TIM_DMA_Base_address TIM DMA Base Address | |||
| /** @defgroup TIMEx_Break_Input_Source_Enable TIM Extended Break input source enabling | |||
| * @{ | |||
| */ | |||
| #define TIM_DMABASE_CR1 (0x00000000U) /*!< TIM DMA Base Address is CR1 */ | |||
| #define TIM_DMABASE_CR2 (0x00000001U) /*!< TIM DMA Base Address is CR2 */ | |||
| #define TIM_DMABASE_SMCR (0x00000002U) /*!< TIM DMA Base Address is SMCR */ | |||
| #define TIM_DMABASE_DIER (0x00000003U) /*!< TIM DMA Base Address is DIER */ | |||
| #define TIM_DMABASE_SR (0x00000004U) /*!< TIM DMA Base Address is SR */ | |||
| #define TIM_DMABASE_EGR (0x00000005U) /*!< TIM DMA Base Address is EGR */ | |||
| #define TIM_DMABASE_CCMR1 (0x00000006U) /*!< TIM DMA Base Address is CCMR1 */ | |||
| #define TIM_DMABASE_CCMR2 (0x00000007U) /*!< TIM DMA Base Address is CCMR2*/ | |||
| #define TIM_DMABASE_CCER (0x00000008U) /*!< TIM DMA Base Address is CCER */ | |||
| #define TIM_DMABASE_CNT (0x00000009U) /*!< TIM DMA Base Address is CNT */ | |||
| #define TIM_DMABASE_PSC (0x0000000AU) /*!< TIM DMA Base Address is PSC */ | |||
| #define TIM_DMABASE_ARR (0x0000000BU) /*!< TIM DMA Base Address is ARR */ | |||
| #define TIM_DMABASE_RCR (0x0000000CU) /*!< TIM DMA Base Address is RCR */ | |||
| #define TIM_DMABASE_CCR1 (0x0000000DU) /*!< TIM DMA Base Address is CCR1 */ | |||
| #define TIM_DMABASE_CCR2 (0x0000000EU) /*!< TIM DMA Base Address is CCR2 */ | |||
| #define TIM_DMABASE_CCR3 (0x0000000FU) /*!< TIM DMA Base Address is CCR3 */ | |||
| #define TIM_DMABASE_CCR4 (0x00000010U) /*!< TIM DMA Base Address is CCR3 */ | |||
| #define TIM_DMABASE_BDTR (0x00000011U) /*!< TIM DMA Base Address is BDTR */ | |||
| #define TIM_DMABASE_DCR (0x00000012U) /*!< TIM DMA Base Address is DCR */ | |||
| #define TIM_DMABASE_DMAR (0x00000013U) /*!< TIM DMA Base Address is DMAR */ | |||
| #define TIM_DMABASE_AF1 (0x00000014U) /*!< TIM DMA Base Address is AF1 */ | |||
| #define TIM_DMABASE_CCMR3 (0x00000015U) /*!< TIM DMA Base Address is CCMR3 */ | |||
| #define TIM_DMABASE_CCR5 (0x00000016U) /*!< TIM DMA Base Address is CCR5 */ | |||
| #define TIM_DMABASE_CCR6 (0x00000017U) /*!< TIM DMA Base Address is CCR6 */ | |||
| #define TIM_DMABASE_AF2 (0x00000018U) /*!< TIM DMA Base Address is AF2 */ | |||
| #define TIM_DMABASE_AF3 (0x00000019U) /*!< TIM DMA Base Address is AF3 */ | |||
| #define TIM_DMABASE_TISEL (0x0000001AU) /*!< TIM DMA Base Address is TISEL */ | |||
| #define TIM_BREAKINPUTSOURCE_DISABLE 0x00000000U /* !< Break input source is disabled */ | |||
| #define TIM_BREAKINPUTSOURCE_ENABLE 0x00000001U /* !< Break input source is enabled */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup TIMEx_Remap TIM Extended Remapping | |||
| /** @defgroup TIMEx_Break_Input_Source_Polarity TIM Extended Break input polarity | |||
| * @{ | |||
| */ | |||
| #define TIM_TIM1_ETR_GPIO (0x00000000) /* !< TIM1_ETR is connected to GPIO */ | |||
| #define TIM_TIM1_ETR_ADC1_AWD1 (0x0000C000) /* !< TIM1_ETR is connected to ADC1 AWD1 */ | |||
| #define TIM_TIM1_ETR_ADC1_AWD2 (0x00010000) /* !< TIM1_ETR is connected to ADC1 AWD2 */ | |||
| #define TIM_TIM1_ETR_ADC1_AWD3 (0x00014000) /* !< TIM1_ETR is connected to ADC1 AWD3 */ | |||
| #define TIM_TIM1_ETR_ADC3_AWD1 (0x00018000) /* !< TIM1_ETR is connected to ADC3 AWD1 */ | |||
| #define TIM_TIM1_ETR_ADC3_AWD2 (0x0001C000) /* !< TIM1_ETR is connected to ADC3 AWD2 */ | |||
| #define TIM_TIM1_ETR_ADC3_AWD3 (0x00020000) /* !< TIM1_ETR is connected to ADC3 AWD3 */ | |||
| #define TIM_TIM1_ETR_COMP1_OUT (0x00004000) /* !< TIM1_ETR is connected to COMP1 OUT */ | |||
| #define TIM_TIM1_ETR_COMP2_OUT (0x00008000) /* !< TIM1_ETR is connected to COMP2 OUT */ | |||
| #define TIM_TIM8_ETR_GPIO (0x00000000) /* !< TIM8_ETR is connected to GPIO */ | |||
| #define TIM_TIM8_ETR_ADC2_AWD1 (0x0000C000) /* !< TIM8_ETR is connected to ADC2 AWD1 */ | |||
| #define TIM_TIM8_ETR_ADC2_AWD2 (0x00010000) /* !< TIM8_ETR is connected to ADC2 AWD2 */ | |||
| #define TIM_TIM8_ETR_ADC2_AWD3 (0x00014000) /* !< TIM8_ETR is connected to ADC2 AWD3 */ | |||
| #define TIM_TIM8_ETR_ADC3_AWD1 (0x00018000) /* !< TIM8_ETR is connected to ADC3 AWD1 */ | |||
| #define TIM_TIM8_ETR_ADC3_AWD2 (0x0001C000) /* !< TIM8_ETR is connected to ADC3 AWD2 */ | |||
| #define TIM_TIM8_ETR_ADC3_AWD3 (0x00020000) /* !< TIM8_ETR is connected to ADC3 AWD3 */ | |||
| #define TIM_TIM8_ETR_COMP1_OUT (0x00004000) /* !< TIM8_ETR is connected to COMP1 OUT */ | |||
| #define TIM_TIM8_ETR_COMP2_OUT (0x00008000) /* !< TIM8_ETR is connected to COMP2 OUT */ | |||
| #define TIM_TIM2_ETR_GPIO (0x00000000) /* !< TIM2_ETR is connected to GPIO */ | |||
| #define TIM_TIM2_ETR_COMP1_OUT (0x0000C000) /* !< TIM2_ETR is connected to COMP1 OUT */ | |||
| #define TIM_TIM2_ETR_COMP2_OUT (0x00010000) /* !< TIM2_ETR is connected to COMP2 OUT */ | |||
| #define TIM_TIM2_ETR_RCC_LSE (0x00014000) /* !< TIM2_ETR is connected to RCC LSE */ | |||
| #define TIM_TIM2_ETR_SAI1_FSA (0x00018000) /* !< TIM2_ETR is connected to SAI1 FS_A */ | |||
| #define TIM_TIM2_ETR_SAI1_FSB (0x0001C000) /* !< TIM2_ETR is connected to SAI1 FS_B */ | |||
| #define TIM_TIM3_ETR_GPIO (0x00000000) /* !< TIM3_ETR is connected to GPIO */ | |||
| #define TIM_TIM3_ETR_COMP1_OUT (0x00000000) /* !< TIM3_ETR is connected to COMP1 OUT */ | |||
| #define TIM_TIM5_ETR_GPIO (0x00000000) /* !< TIM5_ETR is connected to GPIO */ | |||
| #define TIM_TIM5_ETR_SAI2_FSA (0x00000000) /* !< TIM5_ETR is connected to SAI2 FS_A */ | |||
| #define TIM_TIM5_ETR_SAI2_FSB (0x00000000) /* !< TIM5_ETR is connected to SAI2 FS_B */ | |||
| #define TIM_TIM1_BKR_GPIO (0x00000000) /* !< TIM1_BKR is connected to GPIO */ | |||
| #define TIM_TIM1_BKR_COMP1_OUT (0x00000002) /* !< TIM1_BKR is connected to COMP1 OUT */ | |||
| #define TIM_TIM1_BKR_COMP2_OUT (0x00000004) /* !< TIM1_BKR is connected to COMP2 OUT */ | |||
| #define TIM_TIM1_BKR_DFSDM_BRK0 (0x00000000) /* !< TIM1_BKR is connected to DFSDM BRK0 */ | |||
| #define TIM_TIM8_BKR_GPIO (0x00000000) /* !< TIM8_BKR is connected to GPIO */ | |||
| #define TIM_TIM8_BKR_COMP1_OUT (0x00000002) /* !< TIM8_BKR is connected to COMP1 OUT */ | |||
| #define TIM_TIM8_BKR_COMP2_OUT (0x00000004) /* !< TIM8_BKR is connected to COMP2 OUT */ | |||
| #define TIM_TIM8_BKR_DFSDM_BRK2 (0x00000000) /* !< TIM8_BKR is connected to DFSDM BRK2 */ | |||
| #define TIM_TIM15_BKR_GPIO (0x00000000) /* !< TIM15_BKR is connected to GPIO */ | |||
| #define TIM_TIM15_BKR_COMP1_OUT (0x00000002) /* !< TIM15_BKR is connected to COMP1 OUT */ | |||
| #define TIM_TIM15_BKR_COMP2_OUT (0x00000004) /* !< TIM15_BKR is connected to COMP2 OUT */ | |||
| #define TIM_TIM15_BKR_DFSDM_BRK0 (0x00000000) /* !< TIM15_BKR is connected to DFSDM BRK0 */ | |||
| #define TIM_TIM16_BKR_GPIO (0x00000000) /* !< TIM16_BKR is connected to GPIO */ | |||
| #define TIM_TIM16_BKR_COMP1_OUT (0x00000002) /* !< TIM16_BKR is connected to COMP1 OUT */ | |||
| #define TIM_TIM16_BKR_COMP2_OUT (0x00000004) /* !< TIM16_BKR is connected to COMP2 OUT */ | |||
| #define TIM_TIM16_BKR_DFSDM_BRK1 (0x00000000) /* !< TIM16_BKR is connected to DFSDM BRK1 */ | |||
| #define TIM_TIM17_BKR_GPIO (0x00000000) /* !< TIM17_BKR is connected to GPIO */ | |||
| #define TIM_TIM17_BKR_COMP1_OUT (0x00000002) /* !< TIM17_BKR is connected to COMP1 OUT */ | |||
| #define TIM_TIM17_BKR_COMP2_OUT (0x00000004) /* !< TIM17_BKR is connected to COMP2 OUT */ | |||
| #define TIM_TIM17_BKR_DFSDM_BRK2 (0x00000000) /* !< TIM17_BKR is connected to DFSDM BRK2 */ | |||
| #define TIM_TIM1_BKR2_GPIO (0x00000000) /* !< TIM1_BKR2 is connected to GPIO */ | |||
| #define TIM_TIM1_BKR2_COMP1_OUT (0x00000002) /* !< TIM1_BKR2 is connected to COMP1 OUT */ | |||
| #define TIM_TIM1_BKR2_COMP2_OUT (0x00000004) /* !< TIM1_BKR2 is connected to COMP2 OUT */ | |||
| #define TIM_TIM1_BKR2_DFSDM_BRK1 (0x00000000) /* !< TIM1_BKR2 is connected to DFSDM BRK0 */ | |||
| #define TIM_TIM8_BKR2_GPIO (0x00000000) /* !< TIM8_BKR2 is connected to GPIO */ | |||
| #define TIM_TIM8_BKR2_COMP1_OUT (0x00000002) /* !< TIM8_BKR2 is connected to COMP1 OUT */ | |||
| #define TIM_TIM8_BKR2_COMP2_OUT (0x00000004) /* !< TIM8_BKR2 is connected to COMP2 OUT */ | |||
| #define TIM_TIM8_BKR2_DFSDM_BRK3 (0x00000000) /* !< TIM8_BKR2 is connected to DFSDM BRK3 */ | |||
| #define TIM_TIM1_TI1_GPIO (0x00000000) /* !< TIM1_TI1 is connected to GPIO */ | |||
| #define TIM_TIM1_TI1_COMP1_OUT (0x00000001) /* !< TIM1_TI1 is connected to COMP1 OUT */ | |||
| #define TIM_TIM8_TI1_GPIO (0x00000000) /* !< TIM8_TI1 is connected to GPIO */ | |||
| #define TIM_TIM8_TI1_COMP2_OUT (0x00000001) /* !< TIM8_TI1 is connected to COMP2 OUT */ | |||
| #define TIM_TIM2_TI4_GPIO (0x00000000) /* !< TIM2_TI4 is connected to GPIO */ | |||
| #define TIM_TIM2_TI4_COMP1_OUT (0x01000000) /* !< TIM2_TI4 is connected to COMP1 OUT */ | |||
| #define TIM_TIM2_TI4_COMP2_OUT (0x02000000) /* !< TIM2_TI4 is connected to COMP2 OUT */ | |||
| #define TIM_TIM2_TI4_COMP1COMP2_OUT (0x03000000) /* !< TIM2_TI4 is connected to COMP2 OUT OR COMP2 OUT */ | |||
| #define TIM_TIM3_TI1_GPIO (0x00000000) /* !< TIM3_TI1 is connected to GPIO */ | |||
| #define TIM_TIM3_TI1_COMP1_OUT (0x00000001) /* !< TIM3_TI1 is connected to COMP1 OUT */ | |||
| #define TIM_TIM3_TI1_COMP2_OUT (0x00000002) /* !< TIM3_TI1 is connected to COMP2 OUT */ | |||
| #define TIM_TIM3_TI1_COMP1COMP2_OUT (0x00000003) /* !< TIM3_TI1 is connected to COMP2 OUT OR COMP2 OUT */ | |||
| #define TIM_TIM5_TI1_GPIO (0x00000000) /* !< TIM5_TI1 is connected to GPIO */ | |||
| #define TIM_TIM5_TI1_CAN_TMP (0x00000001) /* !< TIM5_TI1 is connected to CAN TMP */ | |||
| #define TIM_TIM5_TI1_CAN_RTP (0x00000002) /* !< TIM5_TI1 is connected to CAN RTP */ | |||
| #define TIM_TIM15_TI1_GPIO (0x00000000) /* !< TIM15_TI1 is connected to GPIO */ | |||
| #define TIM_TIM15_TI1_TIM2_CH1 (0x00000001) /* !< TIM15_TI1 is connected to TIM2 CH1 */ | |||
| #define TIM_TIM15_TI1_TIM3_CH1 (0x00000002) /* !< TIM15_TI1 is connected to TIM3 CH1 */ | |||
| #define TIM_TIM15_TI1_TIM4_CH1 (0x00000003) /* !< TIM15_TI1 is connected to TIM4 CH1 */ | |||
| #define TIM_TIM15_TI1_RCC_LSE (0x00000004) /* !< TIM15_TI1 is connected to RCC LSE */ | |||
| #define TIM_TIM15_TI1_RCC_CSI (0x00000005) /* !< TIM15_TI1 is connected to RCC CSI */ | |||
| #define TIM_TIM15_TI1_RCC_MCO2 (0x00000006) /* !< TIM15_TI1 is connected to RCC MCO2 */ | |||
| #define TIM_TIM15_TI2_GPIO (0x00000000) /* !< TIM15_TI2 is connected to GPIO */ | |||
| #define TIM_TIM15_TI2_TIM2_CH2 (0x00000100) /* !< TIM15_TI2 is connected to TIM2 CH2 */ | |||
| #define TIM_TIM15_TI2_TIM3_CH2 (0x00000200) /* !< TIM15_TI2 is connected to TIM3 CH2 */ | |||
| #define TIM_TIM15_TI2_TIM4_CH2 (0x00000300) /* !< TIM15_TI2 is connected to TIM4 CH2 */ | |||
| #define TIM_TIM16_TI1_GPIO (0x00000000) /* !< TIM16 TI1 is connected to GPIO */ | |||
| #define TIM_TIM16_TI1_RCC_LSI (0x00000001) /* !< TIM16 TI1 is connected to RCC LSI */ | |||
| #define TIM_TIM16_TI1_RCC_LSE (0x00000002) /* !< TIM16 TI1 is connected to RCC LSE */ | |||
| #define TIM_TIM16_TI1_WKUP_IT (0x00000003) /* !< TIM16 TI1 is connected to WKUP_IT */ | |||
| #define TIM_TIM17_TI1_GPIO (0x00000000) /* !< TIM17 TI1 is connected to GPIO */ | |||
| #define TIM_TIM17_TI1_SPDIF_FS (0x00000001) /* !< TIM17 TI1 is connected to RCC LSI */ | |||
| #define TIM_TIM17_TI1_RCC_HSE1MHZ (0x00000002) /* !< TIM17 TI1 is connected to RCC LSE */ | |||
| #define TIM_TIM17_TI1_RCC_MCO1 (0x00000003) /* !< TIM17 TI1 is connected to RCC MCO1 */ | |||
| #define TIM_BREAKINPUTSOURCE_POLARITY_LOW 0x00000001U /* !< Break input source is active low */ | |||
| #define TIM_BREAKINPUTSOURCE_POLARITY_HIGH 0x00000000U /* !< Break input source is active_high */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* TIM_BREAK_INPUT_SUPPORT */ | |||
| /** @defgroup TIMEx_Group_Channel5 Group Channel 5 and Channel 1, 2 or 3 | |||
| * @{ | |||
| */ | |||
| #define TIM_GROUPCH5_NONE (uint32_t)0x00000000 /* !< No effect of OC5REF on OC1REFC, OC2REFC and OC3REFC */ | |||
| #define TIM_GROUPCH5_OC1REFC (TIM_CCR5_GC5C1) /* !< OC1REFC is the logical AND of OC1REFC and OC5REF */ | |||
| #define TIM_GROUPCH5_OC2REFC (TIM_CCR5_GC5C2) /* !< OC2REFC is the logical AND of OC2REFC and OC5REF */ | |||
| #define TIM_GROUPCH5_OC3REFC (TIM_CCR5_GC5C3) /* !< OC3REFC is the logical AND of OC3REFC and OC5REF */ | |||
| /** @defgroup TIMEx_Break_Input TIM Extended Break input | |||
| /** @defgroup TIMEx_Timer_Input_Selection TIM Extended Timer input selection | |||
| * @{ | |||
| */ | |||
| #define TIM_BREAKINPUT_BRK ((uint32_t)(0x00000001)) /* !< Timer break input */ | |||
| #define TIM_BREAKINPUT_BRK2 ((uint32_t)(0x00000002)) /* !< Timer break2 input */ | |||
| #define TIM_TIM1_TI1_GPIO 0x00000000U /* !< TIM1_TI1 is connected to GPIO */ | |||
| #define TIM_TIM1_TI1_COMP1 TIM_TISEL_TI1SEL_0 /* !< TIM1_TI1 is connected to COMP1 OUT */ | |||
| #define TIM_TIM8_TI1_GPIO 0x00000000U /* !< TIM8_TI1 is connected to GPIO */ | |||
| #define TIM_TIM8_TI1_COMP2 TIM_TISEL_TI1SEL_0 /* !< TIM8_TI1 is connected to COMP2 OUT */ | |||
| #define TIM_TIM2_TI4_GPIO 0x00000000U /* !< TIM2_TI4 is connected to GPIO */ | |||
| #define TIM_TIM2_TI4_COMP1 TIM_TISEL_TI4SEL_0 /* !< TIM2_TI4 is connected to COMP1 OUT */ | |||
| #define TIM_TIM2_TI4_COMP2 TIM_TISEL_TI4SEL_1 /* !< TIM2_TI4 is connected to COMP2 OUT */ | |||
| #define TIM_TIM2_TI4_COMP1_COMP2 (TIM_TISEL_TI4SEL_0 | TIM_TISEL_TI4SEL_1) /* !< TIM2_TI4 is connected to COMP2 OUT OR COMP2 OUT */ | |||
| #define TIM_TIM3_TI1_GPIO 0x00000000U /* !< TIM3_TI1 is connected to GPIO */ | |||
| #define TIM_TIM3_TI1_COMP1 TIM_TISEL_TI1SEL_0 /* !< TIM3_TI1 is connected to COMP1 OUT */ | |||
| #define TIM_TIM3_TI1_COMP2 TIM_TISEL_TI1SEL_1 /* !< TIM3_TI1 is connected to COMP2 OUT */ | |||
| #define TIM_TIM3_TI1_COMP1_COMP2 (TIM_TISEL_TI1SEL_0 | TIM_TISEL_TI1SEL_1) /* !< TIM3_TI1 is connected to COMP2 OUT OR COMP2 OUT */ | |||
| #define TIM_TIM5_TI1_GPIO 0x00000000U /* !< TIM5_TI1 is connected to GPIO */ | |||
| #define TIM_TIM5_TI1_CAN_TMP TIM_TISEL_TI1SEL_0 /* !< TIM5_TI1 is connected to CAN TMP */ | |||
| #define TIM_TIM5_TI1_CAN_RTP TIM_TISEL_TI1SEL_1 /* !< TIM5_TI1 is connected to CAN RTP */ | |||
| #define TIM_TIM15_TI1_GPIO 0x00000000U /* !< TIM15_TI1 is connected to GPIO */ | |||
| #define TIM_TIM15_TI1_TIM2_CH1 TIM_TISEL_TI1SEL_0 /* !< TIM15_TI1 is connected to TIM2 CH1 */ | |||
| #define TIM_TIM15_TI1_TIM3_CH1 TIM_TISEL_TI1SEL_1 /* !< TIM15_TI1 is connected to TIM3 CH1 */ | |||
| #define TIM_TIM15_TI1_TIM4_CH1 (TIM_TISEL_TI1SEL_0 | TIM_TISEL_TI1SEL_1) /* !< TIM15_TI1 is connected to TIM4 CH1 */ | |||
| #define TIM_TIM15_TI1_RCC_LSE (TIM_TISEL_TI1SEL_3) /* !< TIM15_TI1 is connected to RCC LSE */ | |||
| #define TIM_TIM15_TI1_RCC_CSI (TIM_TISEL_TI1SEL_3 | TIM_TISEL_TI1SEL_0) /* !< TIM15_TI1 is connected to RCC CSI */ | |||
| #define TIM_TIM15_TI1_RCC_MCO2 (TIM_TISEL_TI1SEL_3 | TIM_TISEL_TI1SEL_1) /* !< TIM15_TI1 is connected to RCC MCO2 */ | |||
| #define TIM_TIM15_TI2_GPIO 0x00000000U /* !< TIM15_TI2 is connected to GPIO */ | |||
| #define TIM_TIM15_TI2_TIM2_CH2 (TIM_TISEL_TI2SEL_0) /* !< TIM15_TI2 is connected to TIM2 CH2 */ | |||
| #define TIM_TIM15_TI2_TIM3_CH2 (TIM_TISEL_TI2SEL_1) /* !< TIM15_TI2 is connected to TIM3 CH2 */ | |||
| #define TIM_TIM15_TI2_TIM4_CH2 (TIM_TISEL_TI2SEL_0 | TIM_TISEL_TI2SEL_1) /* !< TIM15_TI2 is connected to TIM4 CH2 */ | |||
| #define TIM_TIM16_TI1_GPIO 0x00000000U /* !< TIM16 TI1 is connected to GPIO */ | |||
| #define TIM_TIM16_TI1_RCC_LSI TIM_TISEL_TI1SEL_0 /* !< TIM16 TI1 is connected to RCC LSI */ | |||
| #define TIM_TIM16_TI1_RCC_LSE TIM_TISEL_TI1SEL_1 /* !< TIM16 TI1 is connected to RCC LSE */ | |||
| #define TIM_TIM16_TI1_WKUP_IT (TIM_TISEL_TI1SEL_0 | TIM_TISEL_TI1SEL_1) /* !< TIM16 TI1 is connected to WKUP_IT */ | |||
| #define TIM_TIM17_TI1_GPIO 0x00000000U /* !< TIM17 TI1 is connected to GPIO */ | |||
| #define TIM_TIM17_TI1_SPDIF_FS TIM_TISEL_TI1SEL_0 /* !< TIM17 TI1 is connected to RCC LSI */ | |||
| #define TIM_TIM17_TI1_RCC_HSE1MHZ TIM_TISEL_TI1SEL_1 /* !< TIM17 TI1 is connected to RCC LSE */ | |||
| #define TIM_TIM17_TI1_RCC_MCO1 (TIM_TISEL_TI1SEL_0 | TIM_TISEL_TI1SEL_1) /* !< TIM17 TI1 is connected to RCC MCO1 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup TIMEx_Break_Input_Source TIM Extended Break input source | |||
| * @{ | |||
| */ | |||
| #define TIM_BREAKINPUTSOURCE_BKIN ((uint32_t)(0x00000001)) /* !< An external source (GPIO) is connected to the BKIN pin */ | |||
| #define TIM_BREAKINPUTSOURCE_COMP1 ((uint32_t)(0x00000002)) /* !< The COMP1 output is connected to the break input */ | |||
| #define TIM_BREAKINPUTSOURCE_COMP2 ((uint32_t)(0x00000004)) /* !< The COMP2 output is connected to the break input */ | |||
| #define TIM_BREAKINPUTSOURCE_DFSDM1 ((uint32_t)(0x00000008)) /* !< The analog watchdog output of the DFSDM1 peripheral is connected to the break input */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* End of exported constants -------------------------------------------------*/ | |||
| /** @defgroup TIMEx_Break_Input_Source_Enable TIM Extended Break input source enabling | |||
| * @{ | |||
| */ | |||
| #define TIM_BREAKINPUTSOURCE_DISABLE ((uint32_t)(0x00000000)) /* !< Break input source is disabled */ | |||
| #define TIM_BREAKINPUTSOURCE_ENABLE ((uint32_t)(0x00000001)) /* !< Break input source is enabled */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup TIMEx_Break_Input_Source_Polarity TIM Extended Break input polarity | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup TIMEx_Exported_Macros TIM Extended Exported Macros | |||
| * @{ | |||
| */ | |||
| #define TIM_BREAKINPUTSOURCE_POLARITY_LOW ((uint32_t)(0x00000001)) /* !< Break input source is active low */ | |||
| #define TIM_BREAKINPUTSOURCE_POLARITY_HIGH ((uint32_t)(0x00000000)) /* !< Break input source is active_high */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup TIMEx_Exported_Macros TIM Extended Exported Macros | |||
| * @{ | |||
| */ | |||
| /* End of exported macro -----------------------------------------------------*/ | |||
| /* Private macro -------------------------------------------------------------*/ | |||
| /** @defgroup TIMEx_Private_Macros TIM Extended Private Macros | |||
| * @{ | |||
| */ | |||
| #define IS_TIM_REMAP(__REMAP__) (((__REMAP__) <= (uint32_t)0x0001C01F)) | |||
| */ | |||
| #define IS_TIM_BREAKINPUT(__BREAKINPUT__) (((__BREAKINPUT__) == TIM_BREAKINPUT_BRK) || \ | |||
| ((__BREAKINPUT__) == TIM_BREAKINPUT_BRK2)) | |||
| @@ -431,100 +249,72 @@ typedef struct { | |||
| #define IS_TIM_BREAKINPUTSOURCE_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_BREAKINPUTSOURCE_POLARITY_LOW) || \ | |||
| ((__POLARITY__) == TIM_BREAKINPUTSOURCE_POLARITY_HIGH)) | |||
| #define IS_TIM_TISEL(TISEL) (((TISEL) == TIM_TIM1_TI1_GPIO) ||\ | |||
| ((TISEL) == TIM_TIM1_TI1_COMP1_OUT) ||\ | |||
| ((TISEL) == TIM_TIM8_TI1_GPIO) ||\ | |||
| ((TISEL) == TIM_TIM8_TI1_COMP2_OUT) ||\ | |||
| ((TISEL) == TIM_TIM2_TI4_GPIO) ||\ | |||
| ((TISEL) == TIM_TIM2_TI4_COMP1_OUT) ||\ | |||
| ((TISEL) == TIM_TIM2_TI4_COMP2_OUT) ||\ | |||
| ((TISEL) == TIM_TIM2_TI4_COMP1COMP2_OUT) ||\ | |||
| ((TISEL) == TIM_TIM3_TI1_GPIO) ||\ | |||
| ((TISEL) == TIM_TIM3_TI1_COMP1_OUT) ||\ | |||
| ((TISEL) == TIM_TIM3_TI1_COMP2_OUT) ||\ | |||
| ((TISEL) == TIM_TIM3_TI1_COMP1COMP2_OUT) ||\ | |||
| ((TISEL) == TIM_TIM5_TI1_GPIO) ||\ | |||
| ((TISEL) == TIM_TIM5_TI1_CAN_TMP) ||\ | |||
| ((TISEL) == TIM_TIM5_TI1_CAN_RTP) ||\ | |||
| ((TISEL) == TIM_TIM15_TI1_GPIO) ||\ | |||
| ((TISEL) == TIM_TIM15_TI1_TIM2_CH1) ||\ | |||
| ((TISEL) == TIM_TIM15_TI1_TIM3_CH1) ||\ | |||
| ((TISEL) == TIM_TIM15_TI1_TIM4_CH1) ||\ | |||
| ((TISEL) == TIM_TIM15_TI1_RCC_LSE) ||\ | |||
| ((TISEL) == TIM_TIM15_TI1_RCC_CSI) ||\ | |||
| ((TISEL) == TIM_TIM15_TI1_RCC_MCO2) ||\ | |||
| ((TISEL) == TIM_TIM15_TI2_GPIO) ||\ | |||
| ((TISEL) == TIM_TIM15_TI2_TIM2_CH2) ||\ | |||
| ((TISEL) == TIM_TIM15_TI2_TIM3_CH2) ||\ | |||
| ((TISEL) == TIM_TIM15_TI2_TIM4_CH2) ||\ | |||
| ((TISEL) == TIM_TIM16_TI1_GPIO) ||\ | |||
| ((TISEL) == TIM_TIM16_TI1_RCC_LSI) ||\ | |||
| ((TISEL) == TIM_TIM16_TI1_RCC_LSE) ||\ | |||
| ((TISEL) == TIM_TIM16_TI1_WKUP_IT) ||\ | |||
| ((TISEL) == TIM_TIM17_TI1_GPIO) ||\ | |||
| ((TISEL) == TIM_TIM17_TI1_SPDIF_FS) ||\ | |||
| ((TISEL) == TIM_TIM17_TI1_RCC_HSE1MHZ) ||\ | |||
| ((TISEL) == TIM_TIM17_TI1_RCC_MCO1)) | |||
| #define IS_TIM_BKR2REMAP(BK2RREMAP) (((BKR2REMAP) == TIM_TIM1_BKR_GPIO) ||\ | |||
| ((BKR2REMAP) == TIM_TIM1_BKR_GPIO) ||\ | |||
| ((BKR2REMAP) == TIM_TIM1_BKR_GPIO) ||\ | |||
| ((BKR2REMAP) == TIM_TIM1_BKR_GPIO) ||\ | |||
| ((BKR2REMAP) == TIM_TIM1_BKR_GPIO) ||\ | |||
| ((BKR2REMAP) == TIM_TIM1_BKR_GPIO) ||\ | |||
| ((BKR2REMAP) == TIM_TIM1_BKR_GPIO) ||\ | |||
| ((BKR2REMAP) == TIM_TIM1_BKR_GPIO)) | |||
| #define IS_TIM_BKRREMAP(BKRREMAP) (((BKRREMAP) == TIM_TIM1_BKR_GPIO) ||\ | |||
| ((BKRREMAP) == TIM_TIM1_BKR_COMP1_OUT) ||\ | |||
| ((BKRREMAP) == TIM_TIM1_BKR_COMP2_OUT) ||\ | |||
| ((BKRREMAP) == TIM_TIM1_BKR_DFSDM_BRK0) ||\ | |||
| ((BKRREMAP) == TIM_TIM8_BKR_GPIO) ||\ | |||
| ((BKRREMAP) == TIM_TIM8_BKR_COMP1_OUT) ||\ | |||
| ((BKRREMAP) == TIM_TIM8_BKR_COMP2_OUT) ||\ | |||
| ((BKRREMAP) == TIM_TIM8_BKR_DFSDM_BRK2) ||\ | |||
| ((BKRREMAP) == TIM_TIM15_BKR_GPIO) ||\ | |||
| ((BKRREMAP) == TIM_TIM15_BKR_COMP1_OUT) ||\ | |||
| ((BKRREMAP) == TIM_TIM15_BKR_COMP2_OUT) ||\ | |||
| ((BKRREMAP) == TIM_TIM15_BKR_DFSDM_BRK0) ||\ | |||
| ((BKRREMAP) == TIM_TIM16_BKR_GPIO) ||\ | |||
| ((BKRREMAP) == TIM_TIM16_BKR_COMP1_OUT) ||\ | |||
| ((BKRREMAP) == TIM_TIM16_BKR_COMP2_OUT) ||\ | |||
| ((BKRREMAP) == TIM_TIM16_BKR_DFSDM_BRK1) ||\ | |||
| ((BKRREMAP) == TIM_TIM17_BKR_GPIO) ||\ | |||
| ((BKRREMAP) == TIM_TIM17_BKR_COMP1_OUT) ||\ | |||
| ((BKRREMAP) == TIM_TIM17_BKR_COMP2_OUT) ||\ | |||
| ((BKRREMAP) == TIM_TIM17_BKR_DFSDM_BRK2)) | |||
| #define IS_TIM_ETRREMAP(ETRREMAP) (((ETRREMAP) == TIM_TIM1_ETR_GPIO) ||\ | |||
| ((ETRREMAP) == TIM_TIM1_ETR_ADC1_AWD1) ||\ | |||
| ((ETRREMAP) == TIM_TIM1_ETR_ADC1_AWD2) ||\ | |||
| ((ETRREMAP) == TIM_TIM1_ETR_ADC1_AWD3) ||\ | |||
| ((ETRREMAP) == TIM_TIM1_ETR_ADC3_AWD1) ||\ | |||
| ((ETRREMAP) == TIM_TIM1_ETR_ADC3_AWD2) ||\ | |||
| ((ETRREMAP) == TIM_TIM1_ETR_ADC3_AWD3) ||\ | |||
| ((ETRREMAP) == TIM_TIM1_ETR_COMP1_OUT) ||\ | |||
| ((ETRREMAP) == TIM_TIM1_ETR_COMP2_OUT) ||\ | |||
| ((ETRREMAP) == TIM_TIM8_ETR_GPIO) ||\ | |||
| ((ETRREMAP) == TIM_TIM8_ETR_ADC2_AWD1) ||\ | |||
| ((ETRREMAP) == TIM_TIM8_ETR_ADC2_AWD2) ||\ | |||
| ((ETRREMAP) == TIM_TIM8_ETR_ADC2_AWD3) ||\ | |||
| ((ETRREMAP) == TIM_TIM8_ETR_ADC3_AWD1) ||\ | |||
| ((ETRREMAP) == TIM_TIM8_ETR_ADC3_AWD2) ||\ | |||
| ((ETRREMAP) == TIM_TIM8_ETR_ADC3_AWD3) ||\ | |||
| ((ETRREMAP) == TIM_TIM8_ETR_COMP1_OUT) ||\ | |||
| ((ETRREMAP) == TIM_TIM8_ETR_COMP2_OUT) ||\ | |||
| ((ETRREMAP) == TIM_TIM2_ETR_GPIO) ||\ | |||
| ((ETRREMAP) == TIM_TIM2_ETR_COMP1_OUT) ||\ | |||
| ((ETRREMAP) == TIM_TIM2_ETR_COMP2_OUT) ||\ | |||
| ((ETRREMAP) == TIM_TIM2_ETR_RCC_LSE) ||\ | |||
| ((ETRREMAP) == TIM_TIM2_ETR_SAI1_FSA) ||\ | |||
| ((ETRREMAP) == TIM_TIM2_ETR_SAI1_FSB) ||\ | |||
| ((ETRREMAP) == TIM_TIM3_ETR_GPIO) ||\ | |||
| ((ETRREMAP) == TIM_TIM3_ETR_COMP1_OUT) ||\ | |||
| ((ETRREMAP) == TIM_TIM5_ETR_GPIO) ||\ | |||
| ((ETRREMAP) == TIM_TIM5_ETR_SAI2_FSA) |\ | |||
| ((ETRREMAP) == TIM_TIM5_ETR_SAI2_FSB)) | |||
| #define IS_TIM_TISEL(__TISEL__) (((__TISEL__) == TIM_TIM1_TI1_GPIO) ||\ | |||
| ((__TISEL__) == TIM_TIM1_TI1_COMP1) ||\ | |||
| ((__TISEL__) == TIM_TIM8_TI1_GPIO) ||\ | |||
| ((__TISEL__) == TIM_TIM8_TI1_COMP2) ||\ | |||
| ((__TISEL__) == TIM_TIM2_TI4_GPIO) ||\ | |||
| ((__TISEL__) == TIM_TIM2_TI4_COMP1) ||\ | |||
| ((__TISEL__) == TIM_TIM2_TI4_COMP2) ||\ | |||
| ((__TISEL__) == TIM_TIM2_TI4_COMP1_COMP2) ||\ | |||
| ((__TISEL__) == TIM_TIM3_TI1_GPIO) ||\ | |||
| ((__TISEL__) == TIM_TIM3_TI1_COMP1) ||\ | |||
| ((__TISEL__) == TIM_TIM3_TI1_COMP2) ||\ | |||
| ((__TISEL__) == TIM_TIM3_TI1_COMP1_COMP2) ||\ | |||
| ((__TISEL__) == TIM_TIM5_TI1_GPIO) ||\ | |||
| ((__TISEL__) == TIM_TIM5_TI1_CAN_TMP) ||\ | |||
| ((__TISEL__) == TIM_TIM5_TI1_CAN_RTP) ||\ | |||
| ((__TISEL__) == TIM_TIM15_TI1_GPIO) ||\ | |||
| ((__TISEL__) == TIM_TIM15_TI1_TIM2_CH1) ||\ | |||
| ((__TISEL__) == TIM_TIM15_TI1_TIM3_CH1) ||\ | |||
| ((__TISEL__) == TIM_TIM15_TI1_TIM4_CH1) ||\ | |||
| ((__TISEL__) == TIM_TIM15_TI1_RCC_LSE) ||\ | |||
| ((__TISEL__) == TIM_TIM15_TI1_RCC_CSI) ||\ | |||
| ((__TISEL__) == TIM_TIM15_TI1_RCC_MCO2) ||\ | |||
| ((__TISEL__) == TIM_TIM15_TI2_GPIO) ||\ | |||
| ((__TISEL__) == TIM_TIM15_TI2_TIM2_CH2) ||\ | |||
| ((__TISEL__) == TIM_TIM15_TI2_TIM3_CH2) ||\ | |||
| ((__TISEL__) == TIM_TIM15_TI2_TIM4_CH2) ||\ | |||
| ((__TISEL__) == TIM_TIM16_TI1_GPIO) ||\ | |||
| ((__TISEL__) == TIM_TIM16_TI1_RCC_LSI) ||\ | |||
| ((__TISEL__) == TIM_TIM16_TI1_RCC_LSE) ||\ | |||
| ((__TISEL__) == TIM_TIM16_TI1_WKUP_IT) ||\ | |||
| ((__TISEL__) == TIM_TIM17_TI1_GPIO) ||\ | |||
| ((__TISEL__) == TIM_TIM17_TI1_SPDIF_FS) ||\ | |||
| ((__TISEL__) == TIM_TIM17_TI1_RCC_HSE1MHZ) ||\ | |||
| ((__TISEL__) == TIM_TIM17_TI1_RCC_MCO1)) | |||
| #define IS_TIM_REMAP(__RREMAP__) (((__RREMAP__) == TIM_TIM1_ETR_GPIO) ||\ | |||
| ((__RREMAP__) == TIM_TIM1_ETR_ADC1_AWD1) ||\ | |||
| ((__RREMAP__) == TIM_TIM1_ETR_ADC1_AWD2) ||\ | |||
| ((__RREMAP__) == TIM_TIM1_ETR_ADC1_AWD3) ||\ | |||
| ((__RREMAP__) == TIM_TIM1_ETR_ADC3_AWD1) ||\ | |||
| ((__RREMAP__) == TIM_TIM1_ETR_ADC3_AWD2) ||\ | |||
| ((__RREMAP__) == TIM_TIM1_ETR_ADC3_AWD3) ||\ | |||
| ((__RREMAP__) == TIM_TIM1_ETR_COMP1) ||\ | |||
| ((__RREMAP__) == TIM_TIM1_ETR_COMP2) ||\ | |||
| ((__RREMAP__) == TIM_TIM8_ETR_GPIO) ||\ | |||
| ((__RREMAP__) == TIM_TIM8_ETR_ADC1_AWD1) ||\ | |||
| ((__RREMAP__) == TIM_TIM8_ETR_ADC1_AWD2) ||\ | |||
| ((__RREMAP__) == TIM_TIM8_ETR_ADC1_AWD3) ||\ | |||
| ((__RREMAP__) == TIM_TIM8_ETR_ADC3_AWD1) ||\ | |||
| ((__RREMAP__) == TIM_TIM8_ETR_ADC3_AWD2) ||\ | |||
| ((__RREMAP__) == TIM_TIM8_ETR_ADC3_AWD3) ||\ | |||
| ((__RREMAP__) == TIM_TIM8_ETR_COMP1) ||\ | |||
| ((__RREMAP__) == TIM_TIM8_ETR_COMP2) ||\ | |||
| ((__RREMAP__) == TIM_TIM2_ETR_GPIO) ||\ | |||
| ((__RREMAP__) == TIM_TIM2_ETR_COMP1) ||\ | |||
| ((__RREMAP__) == TIM_TIM2_ETR_COMP2) ||\ | |||
| ((__RREMAP__) == TIM_TIM2_ETR_RCC_LSE) ||\ | |||
| ((__RREMAP__) == TIM_TIM2_ETR_SAI1_FSA) ||\ | |||
| ((__RREMAP__) == TIM_TIM2_ETR_SAI1_FSB) ||\ | |||
| ((__RREMAP__) == TIM_TIM3_ETR_GPIO) ||\ | |||
| ((__RREMAP__) == TIM_TIM3_ETR_COMP1) ||\ | |||
| ((__RREMAP__) == TIM_TIM5_ETR_GPIO) ||\ | |||
| ((__RREMAP__) == TIM_TIM5_ETR_SAI2_FSA) ||\ | |||
| ((__RREMAP__) == TIM_TIM5_ETR_SAI2_FSB)) | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -536,17 +326,17 @@ typedef struct { | |||
| */ | |||
| /** @addtogroup TIMEx_Exported_Functions_Group1 Extended Timer Hall Sensor functions | |||
| * @brief Timer Hall Sensor functions | |||
| * @{ | |||
| */ | |||
| * @brief Timer Hall Sensor functions | |||
| * @{ | |||
| */ | |||
| /* Timer Hall Sensor functions **********************************************/ | |||
| HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, TIM_HallSensor_InitTypeDef* sConfig); | |||
| HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, TIM_HallSensor_InitTypeDef *sConfig); | |||
| HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim); | |||
| void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim); | |||
| void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim); | |||
| /* Blocking mode: Polling */ | |||
| /* Blocking mode: Polling */ | |||
| HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim); | |||
| HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim); | |||
| /* Non-Blocking mode: Interrupt */ | |||
| @@ -560,9 +350,9 @@ HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim); | |||
| */ | |||
| /** @addtogroup TIMEx_Exported_Functions_Group2 Extended Timer Complementary Output Compare functions | |||
| * @brief Timer Complementary Output Compare functions | |||
| * @{ | |||
| */ | |||
| * @brief Timer Complementary Output Compare functions | |||
| * @{ | |||
| */ | |||
| /* Timer Complementary Output Compare functions *****************************/ | |||
| /* Blocking mode: Polling */ | |||
| HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel); | |||
| @@ -580,9 +370,9 @@ HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Chann | |||
| */ | |||
| /** @addtogroup TIMEx_Exported_Functions_Group3 Extended Timer Complementary PWM functions | |||
| * @brief Timer Complementary PWM functions | |||
| * @{ | |||
| */ | |||
| * @brief Timer Complementary PWM functions | |||
| * @{ | |||
| */ | |||
| /* Timer Complementary PWM functions ****************************************/ | |||
| /* Blocking mode: Polling */ | |||
| HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef *htim, uint32_t Channel); | |||
| @@ -599,9 +389,9 @@ HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Chan | |||
| */ | |||
| /** @addtogroup TIMEx_Exported_Functions_Group4 Extended Timer Complementary One Pulse functions | |||
| * @brief Timer Complementary One Pulse functions | |||
| * @{ | |||
| */ | |||
| * @brief Timer Complementary One Pulse functions | |||
| * @{ | |||
| */ | |||
| /* Timer Complementary One Pulse functions **********************************/ | |||
| /* Blocking mode: Polling */ | |||
| HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel); | |||
| @@ -615,20 +405,27 @@ HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t | |||
| */ | |||
| /** @addtogroup TIMEx_Exported_Functions_Group5 Extended Peripheral Control functions | |||
| * @brief Peripheral Control functions | |||
| * @{ | |||
| */ | |||
| * @brief Peripheral Control functions | |||
| * @{ | |||
| */ | |||
| /* Extended Control functions ************************************************/ | |||
| HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource); | |||
| HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource); | |||
| HAL_StatusTypeDef HAL_TIMEx_ConfigCommutationEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource); | |||
| HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim, TIM_MasterConfigTypeDef * sMasterConfig); | |||
| HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim, TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig); | |||
| HAL_StatusTypeDef HAL_TIMEx_ConfigBreakInput(TIM_HandleTypeDef *htim, uint32_t BreakInput, TIMEx_BreakInputConfigTypeDef *sBreakInputConfig); | |||
| HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap); | |||
| HAL_StatusTypeDef HAL_TIMEx_TISelection(TIM_HandleTypeDef *htim, uint32_t TISelection , uint32_t Channel); | |||
| HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger, | |||
| uint32_t CommutationSource); | |||
| HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger, | |||
| uint32_t CommutationSource); | |||
| HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger, | |||
| uint32_t CommutationSource); | |||
| HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim, | |||
| TIM_MasterConfigTypeDef *sMasterConfig); | |||
| HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim, | |||
| TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig); | |||
| #if defined(TIM_BREAK_INPUT_SUPPORT) | |||
| HAL_StatusTypeDef HAL_TIMEx_ConfigBreakInput(TIM_HandleTypeDef *htim, uint32_t BreakInput, | |||
| TIMEx_BreakInputConfigTypeDef *sBreakInputConfig); | |||
| #endif /* TIM_BREAK_INPUT_SUPPORT */ | |||
| HAL_StatusTypeDef HAL_TIMEx_GroupChannel5(TIM_HandleTypeDef *htim, uint32_t Channels); | |||
| HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap); | |||
| HAL_StatusTypeDef HAL_TIMEx_TISelection(TIM_HandleTypeDef *htim, uint32_t TISelection, uint32_t Channel); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -637,10 +434,11 @@ HAL_StatusTypeDef HAL_TIMEx_GroupChannel5(TIM_HandleTypeDef *htim, uint32_t Chan | |||
| * @brief Extended Callbacks functions | |||
| * @{ | |||
| */ | |||
| /* Extended Callback *********************************************************/ | |||
| void HAL_TIMEx_CommutationCallback(TIM_HandleTypeDef *htim); | |||
| /* Extended Callback **********************************************************/ | |||
| void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim); | |||
| void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim); | |||
| void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim); | |||
| void HAL_TIMEx_Break2Callback(TIM_HandleTypeDef *htim); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -649,27 +447,27 @@ void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim); | |||
| * @brief Extended Peripheral State functions | |||
| * @{ | |||
| */ | |||
| /* Extended Peripheral State functions **************************************/ | |||
| /* Extended Peripheral State functions ***************************************/ | |||
| HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef *htim); | |||
| /** | |||
| * @} | |||
| */ | |||
| /* End of exported functions -------------------------------------------------*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* End of exported functions -------------------------------------------------*/ | |||
| /* Private functions----------------------------------------------------------*/ | |||
| /** @defgroup TIMEx_Private_Functions TIMEx Private Functions | |||
| * @{ | |||
| */ | |||
| void HAL_TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma); | |||
| /** | |||
| * @} | |||
| */ | |||
| /* End of private functions --------------------------------------------------*/ | |||
| /** @addtogroup TIMEx_Private_Functions TIMEx Private Functions | |||
| * @{ | |||
| */ | |||
| void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma); | |||
| void TIMEx_DMACommutationHalfCplt(DMA_HandleTypeDef *hdma); | |||
| /** | |||
| * @} | |||
| */ | |||
| /* End of private functions --------------------------------------------------*/ | |||
| /** | |||
| * @} | |||
| @@ -678,10 +476,12 @@ void HAL_TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma); | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_TIM_EX_H */ | |||
| #endif /* STM32H7xx_HAL_TIM_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_uart_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of UART HAL Extended module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_UART_EX_H | |||
| #define __STM32H7xx_HAL_UART_EX_H | |||
| #ifndef STM32H7xx_HAL_UART_EX_H | |||
| #define STM32H7xx_HAL_UART_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -64,7 +46,7 @@ | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t WakeUpEvent; /*!< Specifies which event will activat the Wakeup from Stop mode flag (WUF). | |||
| uint32_t WakeUpEvent; /*!< Specifies which event will activate the Wakeup from Stop mode flag (WUF). | |||
| This parameter can be a value of @ref UART_WakeUp_from_Stop_Selection. | |||
| If set to UART_WAKEUP_ON_ADDRESS, the two other fields below must | |||
| be filled up. */ | |||
| @@ -84,21 +66,59 @@ typedef struct | |||
| * @{ | |||
| */ | |||
| /** @defgroup UARTEx_Word_Length UART Word Length | |||
| /** @defgroup UARTEx_Word_Length UARTEx Word Length | |||
| * @{ | |||
| */ | |||
| #define UART_WORDLENGTH_7B ((uint32_t)USART_CR1_M1) /*!< 7-bit long UART frame */ | |||
| #define UART_WORDLENGTH_8B ((uint32_t)0x00000000U) /*!< 8-bit long UART frame */ | |||
| #define UART_WORDLENGTH_9B ((uint32_t)USART_CR1_M0) /*!< 9-bit long UART frame */ | |||
| #define UART_WORDLENGTH_7B USART_CR1_M1 /*!< 7-bit long UART frame */ | |||
| #define UART_WORDLENGTH_8B 0x00000000U /*!< 8-bit long UART frame */ | |||
| #define UART_WORDLENGTH_9B USART_CR1_M0 /*!< 9-bit long UART frame */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup UARTEx_WakeUp_Address_Length UART Extended WakeUp Address Length | |||
| /** @defgroup UARTEx_WakeUp_Address_Length UARTEx WakeUp Address Length | |||
| * @{ | |||
| */ | |||
| #define UART_ADDRESS_DETECT_4B ((uint32_t)0x00000000U) /*!< 4-bit long wake-up address */ | |||
| #define UART_ADDRESS_DETECT_7B ((uint32_t)USART_CR2_ADDM7) /*!< 7-bit long wake-up address */ | |||
| #define UART_ADDRESS_DETECT_4B 0x00000000U /*!< 4-bit long wake-up address */ | |||
| #define UART_ADDRESS_DETECT_7B USART_CR2_ADDM7 /*!< 7-bit long wake-up address */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup UARTEx_FIFO_mode UARTEx FIFO mode | |||
| * @brief UART FIFO mode | |||
| * @{ | |||
| */ | |||
| #define UART_FIFOMODE_DISABLE 0x00000000U /*!< FIFO mode disable */ | |||
| #define UART_FIFOMODE_ENABLE USART_CR1_FIFOEN /*!< FIFO mode enable */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup UARTEx_TXFIFO_threshold_level UARTEx TXFIFO threshold level | |||
| * @brief UART TXFIFO threshold level | |||
| * @{ | |||
| */ | |||
| #define UART_TXFIFO_THRESHOLD_1_8 0x00000000U /*!< TXFIFO reaches 1/8 of its depth */ | |||
| #define UART_TXFIFO_THRESHOLD_1_4 USART_CR3_TXFTCFG_0 /*!< TXFIFO reaches 1/4 of its depth */ | |||
| #define UART_TXFIFO_THRESHOLD_1_2 USART_CR3_TXFTCFG_1 /*!< TXFIFO reaches 1/2 of its depth */ | |||
| #define UART_TXFIFO_THRESHOLD_3_4 (USART_CR3_TXFTCFG_0|USART_CR3_TXFTCFG_1) /*!< TXFIFO reaches 3/4 of its depth */ | |||
| #define UART_TXFIFO_THRESHOLD_7_8 USART_CR3_TXFTCFG_2 /*!< TXFIFO reaches 7/8 of its depth */ | |||
| #define UART_TXFIFO_THRESHOLD_8_8 (USART_CR3_TXFTCFG_2|USART_CR3_TXFTCFG_0) /*!< TXFIFO becomes empty */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup UARTEx_RXFIFO_threshold_level UARTEx RXFIFO threshold level | |||
| * @brief UART RXFIFO threshold level | |||
| * @{ | |||
| */ | |||
| #define UART_RXFIFO_THRESHOLD_1_8 0x00000000U /*!< RXFIFO FIFO reaches 1/8 of its depth */ | |||
| #define UART_RXFIFO_THRESHOLD_1_4 USART_CR3_RXFTCFG_0 /*!< RXFIFO FIFO reaches 1/4 of its depth */ | |||
| #define UART_RXFIFO_THRESHOLD_1_2 USART_CR3_RXFTCFG_1 /*!< RXFIFO FIFO reaches 1/2 of its depth */ | |||
| #define UART_RXFIFO_THRESHOLD_3_4 (USART_CR3_RXFTCFG_0|USART_CR3_RXFTCFG_1) /*!< RXFIFO FIFO reaches 3/4 of its depth */ | |||
| #define UART_RXFIFO_THRESHOLD_7_8 USART_CR3_RXFTCFG_2 /*!< RXFIFO FIFO reaches 7/8 of its depth */ | |||
| #define UART_RXFIFO_THRESHOLD_8_8 (USART_CR3_RXFTCFG_2|USART_CR3_RXFTCFG_0) /*!< RXFIFO FIFO becomes full */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -124,7 +144,18 @@ HAL_StatusTypeDef HAL_RS485Ex_Init(UART_HandleTypeDef *huart, uint32_t Polarity, | |||
| * @} | |||
| */ | |||
| /* IO operation functions *****************************************************/ | |||
| /** @addtogroup UARTEx_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart); | |||
| void HAL_UARTEx_RxFifoFullCallback(UART_HandleTypeDef *huart); | |||
| void HAL_UARTEx_TxFifoEmptyCallback(UART_HandleTypeDef *huart); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup UARTEx_Exported_Functions_Group3 | |||
| * @{ | |||
| @@ -135,7 +166,10 @@ HAL_StatusTypeDef HAL_UARTEx_StopModeWakeUpSourceConfig(UART_HandleTypeDef *huar | |||
| HAL_StatusTypeDef HAL_UARTEx_EnableStopMode(UART_HandleTypeDef *huart); | |||
| HAL_StatusTypeDef HAL_UARTEx_DisableStopMode(UART_HandleTypeDef *huart); | |||
| HAL_StatusTypeDef HAL_MultiProcessorEx_AddressLength_Set(UART_HandleTypeDef *huart, uint32_t AddressLength); | |||
| void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart); | |||
| HAL_StatusTypeDef HAL_UARTEx_EnableFifoMode(UART_HandleTypeDef *huart); | |||
| HAL_StatusTypeDef HAL_UARTEx_DisableFifoMode(UART_HandleTypeDef *huart); | |||
| HAL_StatusTypeDef HAL_UARTEx_SetTxFifoThreshold(UART_HandleTypeDef *huart, uint32_t Threshold); | |||
| HAL_StatusTypeDef HAL_UARTEx_SetRxFifoThreshold(UART_HandleTypeDef *huart, uint32_t Threshold); | |||
| /** | |||
| * @} | |||
| @@ -151,16 +185,16 @@ void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart); | |||
| */ | |||
| /** @brief Report the UART clock source. | |||
| * @param __HANDLE__: specifies the UART Handle. | |||
| * @param __CLOCKSOURCE__: output variable. | |||
| * @param __HANDLE__ specifies the UART Handle. | |||
| * @param __CLOCKSOURCE__ output variable. | |||
| * @retval UART clocking source, written in __CLOCKSOURCE__. | |||
| */ | |||
| #define UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \ | |||
| do { \ | |||
| if((__HANDLE__)->Instance == USART1) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_USART1_SOURCE()) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_USART1_SOURCE()) \ | |||
| { \ | |||
| case RCC_USART1CLKSOURCE_D2PCLK2: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_D2PCLK2; \ | |||
| break; \ | |||
| @@ -179,12 +213,15 @@ void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart); | |||
| case RCC_USART1CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| } \ | |||
| default: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| else if((__HANDLE__)->Instance == USART2) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_USART2_SOURCE()) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_USART2_SOURCE()) \ | |||
| { \ | |||
| case RCC_USART2CLKSOURCE_D2PCLK1: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_D2PCLK1; \ | |||
| break; \ | |||
| @@ -203,12 +240,15 @@ void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart); | |||
| case RCC_USART2CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| } \ | |||
| default: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| else if((__HANDLE__)->Instance == USART3) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_USART3_SOURCE()) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_USART3_SOURCE()) \ | |||
| { \ | |||
| case RCC_USART3CLKSOURCE_D2PCLK1: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_D2PCLK1; \ | |||
| break; \ | |||
| @@ -227,12 +267,15 @@ void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart); | |||
| case RCC_USART3CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| } \ | |||
| default: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| else if((__HANDLE__)->Instance == UART4) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_UART4_SOURCE()) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_UART4_SOURCE()) \ | |||
| { \ | |||
| case RCC_UART4CLKSOURCE_D2PCLK1: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_D2PCLK1; \ | |||
| break; \ | |||
| @@ -251,12 +294,15 @@ void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart); | |||
| case RCC_UART4CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| } \ | |||
| default: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| else if ((__HANDLE__)->Instance == UART5) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_UART5_SOURCE()) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_UART5_SOURCE()) \ | |||
| { \ | |||
| case RCC_UART5CLKSOURCE_D2PCLK1: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_D2PCLK1; \ | |||
| break; \ | |||
| @@ -275,12 +321,15 @@ void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart); | |||
| case RCC_UART5CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| } \ | |||
| default: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| else if((__HANDLE__)->Instance == USART6) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_USART6_SOURCE()) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_USART6_SOURCE()) \ | |||
| { \ | |||
| case RCC_USART6CLKSOURCE_D2PCLK2: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_D2PCLK2; \ | |||
| break; \ | |||
| @@ -299,12 +348,15 @@ void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart); | |||
| case RCC_USART6CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| } \ | |||
| default: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| else if((__HANDLE__)->Instance == UART7) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_UART7_SOURCE()) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_UART7_SOURCE()) \ | |||
| { \ | |||
| case RCC_UART7CLKSOURCE_D2PCLK1: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_D2PCLK1; \ | |||
| break; \ | |||
| @@ -323,12 +375,15 @@ void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart); | |||
| case RCC_UART7CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| } \ | |||
| default: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| else if((__HANDLE__)->Instance == UART8) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_UART8_SOURCE()) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_UART8_SOURCE()) \ | |||
| { \ | |||
| case RCC_UART8CLKSOURCE_D2PCLK1: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_D2PCLK1; \ | |||
| break; \ | |||
| @@ -347,12 +402,15 @@ void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart); | |||
| case RCC_UART8CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| } \ | |||
| default: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| else if((__HANDLE__)->Instance == LPUART1) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_LPUART1_SOURCE()) \ | |||
| { \ | |||
| switch(__HAL_RCC_GET_LPUART1_SOURCE()) \ | |||
| { \ | |||
| case RCC_LPUART1CLKSOURCE_D3PCLK1: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_D3PCLK1; \ | |||
| break; \ | |||
| @@ -371,9 +429,16 @@ void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart); | |||
| case RCC_LPUART1CLKSOURCE_LSE: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \ | |||
| break; \ | |||
| } \ | |||
| default: \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ | |||
| break; \ | |||
| } \ | |||
| } \ | |||
| } while(0) | |||
| else \ | |||
| { \ | |||
| (__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \ | |||
| } \ | |||
| } while(0U) | |||
| /** @brief Report the UART mask to apply to retrieve the received data | |||
| * according to the word length and to the parity bits activation. | |||
| @@ -381,7 +446,7 @@ void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart); | |||
| * by the reception API(). | |||
| * This masking operation is not carried out in the case of | |||
| * DMA transfers. | |||
| * @param __HANDLE__: specifies the UART Handle. | |||
| * @param __HANDLE__ specifies the UART Handle. | |||
| * @retval None, the mask to apply to UART RDR register is stored in (__HANDLE__)->Mask field. | |||
| */ | |||
| #define UART_MASK_COMPUTATION(__HANDLE__) \ | |||
| @@ -390,41 +455,44 @@ void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart); | |||
| { \ | |||
| if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x01FF ; \ | |||
| (__HANDLE__)->Mask = 0x01FFU ; \ | |||
| } \ | |||
| else \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x00FF ; \ | |||
| (__HANDLE__)->Mask = 0x00FFU ; \ | |||
| } \ | |||
| } \ | |||
| else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_8B) \ | |||
| { \ | |||
| if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x00FF ; \ | |||
| (__HANDLE__)->Mask = 0x00FFU ; \ | |||
| } \ | |||
| else \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x007F ; \ | |||
| (__HANDLE__)->Mask = 0x007FU ; \ | |||
| } \ | |||
| } \ | |||
| else if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_7B) \ | |||
| { \ | |||
| if ((__HANDLE__)->Init.Parity == UART_PARITY_NONE) \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x007F ; \ | |||
| (__HANDLE__)->Mask = 0x007FU ; \ | |||
| } \ | |||
| else \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x003F ; \ | |||
| (__HANDLE__)->Mask = 0x003FU ; \ | |||
| } \ | |||
| } \ | |||
| } while(0) | |||
| else \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x0000U; \ | |||
| } \ | |||
| } while(0U) | |||
| /** | |||
| * @brief Ensure that UART frame length is valid. | |||
| * @param __LENGTH__: UART frame length. | |||
| * @param __LENGTH__ UART frame length. | |||
| * @retval SET (__LENGTH__ is valid) or RESET (__LENGTH__ is invalid) | |||
| */ | |||
| #define IS_UART_WORD_LENGTH(__LENGTH__) (((__LENGTH__) == UART_WORDLENGTH_7B) || \ | |||
| @@ -433,18 +501,42 @@ void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart); | |||
| /** | |||
| * @brief Ensure that UART wake-up address length is valid. | |||
| * @param __ADDRESS__: UART wake-up address length. | |||
| * @param __ADDRESS__ UART wake-up address length. | |||
| * @retval SET (__ADDRESS__ is valid) or RESET (__ADDRESS__ is invalid) | |||
| */ | |||
| #define IS_UART_ADDRESSLENGTH_DETECT(__ADDRESS__) (((__ADDRESS__) == UART_ADDRESS_DETECT_4B) || \ | |||
| ((__ADDRESS__) == UART_ADDRESS_DETECT_7B)) | |||
| /** | |||
| * @brief Ensure that UART TXFIFO threshold level is valid. | |||
| * @param __THRESHOLD__ UART TXFIFO threshold level. | |||
| * @retval SET (__THRESHOLD__ is valid) or RESET (__THRESHOLD__ is invalid) | |||
| */ | |||
| #define IS_UART_TXFIFO_THRESHOLD(__THRESHOLD__) (((__THRESHOLD__) == UART_TXFIFO_THRESHOLD_1_8) || \ | |||
| ((__THRESHOLD__) == UART_TXFIFO_THRESHOLD_1_4) || \ | |||
| ((__THRESHOLD__) == UART_TXFIFO_THRESHOLD_1_2) || \ | |||
| ((__THRESHOLD__) == UART_TXFIFO_THRESHOLD_3_4) || \ | |||
| ((__THRESHOLD__) == UART_TXFIFO_THRESHOLD_7_8) || \ | |||
| ((__THRESHOLD__) == UART_TXFIFO_THRESHOLD_8_8)) | |||
| /** | |||
| * @brief Ensure that UART RXFIFO threshold level is valid. | |||
| * @param __THRESHOLD__ UART RXFIFO threshold level. | |||
| * @retval SET (__THRESHOLD__ is valid) or RESET (__THRESHOLD__ is invalid) | |||
| */ | |||
| #define IS_UART_RXFIFO_THRESHOLD(__THRESHOLD__) (((__THRESHOLD__) == UART_RXFIFO_THRESHOLD_1_8) || \ | |||
| ((__THRESHOLD__) == UART_RXFIFO_THRESHOLD_1_4) || \ | |||
| ((__THRESHOLD__) == UART_RXFIFO_THRESHOLD_1_2) || \ | |||
| ((__THRESHOLD__) == UART_RXFIFO_THRESHOLD_3_4) || \ | |||
| ((__THRESHOLD__) == UART_RXFIFO_THRESHOLD_7_8) || \ | |||
| ((__THRESHOLD__) == UART_RXFIFO_THRESHOLD_8_8)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private functions ---------------------------------------------------------*/ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -457,6 +549,6 @@ void HAL_UARTEx_WakeupCallback(UART_HandleTypeDef *huart); | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_UART_EX_H */ | |||
| #endif /* STM32H7xx_HAL_UART_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,45 +2,27 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_usart_ex.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of USART HAL Extended module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_USART_EX_H | |||
| #define __STM32H7xx_HAL_USART_EX_H | |||
| #ifndef STM32H7xx_HAL_USART_EX_H | |||
| #define STM32H7xx_HAL_USART_EX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| @@ -64,17 +46,73 @@ | |||
| * @{ | |||
| */ | |||
| #define USART_WORDLENGTH_7B ((uint32_t)USART_CR1_M1) /*!< 7-bit long USART frame */ | |||
| #define USART_WORDLENGTH_8B ((uint32_t)0x00000000U) /*!< 8-bit long USART frame */ | |||
| #define USART_WORDLENGTH_8B 0x00000000U /*!< 8-bit long USART frame */ | |||
| #define USART_WORDLENGTH_9B ((uint32_t)USART_CR1_M0) /*!< 9-bit long USART frame */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup USARTEx_Slave_Select_management USARTEx Slave Select Management | |||
| * @{ | |||
| */ | |||
| #define USART_NSS_HARD 0x00000000U /*!< SPI slave selection depends on NSS input pin */ | |||
| #define USART_NSS_SOFT USART_CR2_DIS_NSS /*!< SPI slave is always selected and NSS input pin is ignored */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @defgroup USARTEx_Slave_Mode USARTEx Synchronous Slave mode enable | |||
| * @brief USART SLAVE mode | |||
| * @{ | |||
| */ | |||
| #define USART_SLAVEMODE_DISABLE 0x00000000U /*!< USART SPI Slave Mode Enable */ | |||
| #define USART_SLAVEMODE_ENABLE USART_CR2_SLVEN /*!< USART SPI Slave Mode Disable */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup USARTEx_FIFO_mode USARTEx FIFO mode | |||
| * @brief USART FIFO mode | |||
| * @{ | |||
| */ | |||
| #define USART_FIFOMODE_DISABLE 0x00000000U /*!< FIFO mode disable */ | |||
| #define USART_FIFOMODE_ENABLE USART_CR1_FIFOEN /*!< FIFO mode enable */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup USARTEx_TXFIFO_threshold_level USARTEx TXFIFO threshold level | |||
| * @brief USART TXFIFO level | |||
| * @{ | |||
| */ | |||
| #define USART_TXFIFO_THRESHOLD_1_8 0x00000000U /*!< TXFIFO reaches 1/8 of its depth */ | |||
| #define USART_TXFIFO_THRESHOLD_1_4 USART_CR3_TXFTCFG_0 /*!< TXFIFO reaches 1/4 of its depth */ | |||
| #define USART_TXFIFO_THRESHOLD_1_2 USART_CR3_TXFTCFG_1 /*!< TXFIFO reaches 1/2 of its depth */ | |||
| #define USART_TXFIFO_THRESHOLD_3_4 (USART_CR3_TXFTCFG_0|USART_CR3_TXFTCFG_1) /*!< TXFIFO reaches 3/4 of its depth */ | |||
| #define USART_TXFIFO_THRESHOLD_7_8 USART_CR3_TXFTCFG_2 /*!< TXFIFO reaches 7/8 of its depth */ | |||
| #define USART_TXFIFO_THRESHOLD_8_8 (USART_CR3_TXFTCFG_2|USART_CR3_TXFTCFG_0) /*!< TXFIFO becomes empty */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup USARTEx_RXFIFO_threshold_level USARTEx RXFIFO threshold level | |||
| * @brief USART RXFIFO level | |||
| * @{ | |||
| */ | |||
| #define USART_RXFIFO_THRESHOLD_1_8 0x00000000U /*!< RXFIFO FIFO reaches 1/8 of its depth */ | |||
| #define USART_RXFIFO_THRESHOLD_1_4 USART_CR3_RXFTCFG_0 /*!< RXFIFO FIFO reaches 1/4 of its depth */ | |||
| #define USART_RXFIFO_THRESHOLD_1_2 USART_CR3_RXFTCFG_1 /*!< RXFIFO FIFO reaches 1/2 of its depth */ | |||
| #define USART_RXFIFO_THRESHOLD_3_4 (USART_CR3_RXFTCFG_0|USART_CR3_RXFTCFG_1) /*!< RXFIFO FIFO reaches 3/4 of its depth */ | |||
| #define USART_RXFIFO_THRESHOLD_7_8 USART_CR3_RXFTCFG_2 /*!< RXFIFO FIFO reaches 7/8 of its depth */ | |||
| #define USART_RXFIFO_THRESHOLD_8_8 (USART_CR3_RXFTCFG_2|USART_CR3_RXFTCFG_0) /*!< RXFIFO FIFO becomes full */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /** @defgroup USARTEx_Private_Macros USARTEx Private Macros | |||
| @@ -87,7 +125,7 @@ | |||
| * by the reception API(). | |||
| * This masking operation is not carried out in the case of | |||
| * DMA transfers. | |||
| * @param __HANDLE__: specifies the USART Handle. | |||
| * @param __HANDLE__ specifies the USART Handle. | |||
| * @retval None, the mask to apply to USART RDR register is stored in (__HANDLE__)->Mask field. | |||
| */ | |||
| #define USART_MASK_COMPUTATION(__HANDLE__) \ | |||
| @@ -96,51 +134,139 @@ | |||
| { \ | |||
| if ((__HANDLE__)->Init.Parity == USART_PARITY_NONE) \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x01FF ; \ | |||
| (__HANDLE__)->Mask = 0x01FFU; \ | |||
| } \ | |||
| else \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x00FF ; \ | |||
| (__HANDLE__)->Mask = 0x00FFU; \ | |||
| } \ | |||
| } \ | |||
| else if ((__HANDLE__)->Init.WordLength == USART_WORDLENGTH_8B) \ | |||
| { \ | |||
| if ((__HANDLE__)->Init.Parity == USART_PARITY_NONE) \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x00FF ; \ | |||
| (__HANDLE__)->Mask = 0x00FFU; \ | |||
| } \ | |||
| else \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x007F ; \ | |||
| (__HANDLE__)->Mask = 0x007FU; \ | |||
| } \ | |||
| } \ | |||
| else if ((__HANDLE__)->Init.WordLength == USART_WORDLENGTH_7B) \ | |||
| { \ | |||
| if ((__HANDLE__)->Init.Parity == USART_PARITY_NONE) \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x007F ; \ | |||
| (__HANDLE__)->Mask = 0x007FU; \ | |||
| } \ | |||
| else \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x003F ; \ | |||
| (__HANDLE__)->Mask = 0x003FU; \ | |||
| } \ | |||
| } \ | |||
| } while(0) | |||
| else \ | |||
| { \ | |||
| (__HANDLE__)->Mask = 0x0000U; \ | |||
| } \ | |||
| } while(0U) | |||
| /** | |||
| * @brief Ensure that USART frame length is valid. | |||
| * @param __LENGTH__: USART frame length. | |||
| * @param __LENGTH__ USART frame length. | |||
| * @retval SET (__LENGTH__ is valid) or RESET (__LENGTH__ is invalid) | |||
| */ | |||
| #define IS_USART_WORD_LENGTH(__LENGTH__) (((__LENGTH__) == USART_WORDLENGTH_7B) || \ | |||
| ((__LENGTH__) == USART_WORDLENGTH_8B) || \ | |||
| ((__LENGTH__) == USART_WORDLENGTH_9B)) | |||
| /** | |||
| * @brief Ensure that USART Negative Slave Select (NSS) pin management is valid. | |||
| * @param __NSS__ USART Negative Slave Select pin management. | |||
| * @retval SET (__NSS__ is valid) or RESET (__NSS__ is invalid) | |||
| */ | |||
| #define IS_USART_NSS(__NSS__) (((__NSS__) == USART_NSS_HARD) || \ | |||
| ((__NSS__) == USART_NSS_SOFT)) | |||
| /** | |||
| * @brief Ensure that USART Slave Mode is valid. | |||
| * @param __STATE__ USART Slave Mode. | |||
| * @retval SET (__STATE__ is valid) or RESET (__STATE__ is invalid) | |||
| */ | |||
| #define IS_USART_SLAVEMODE(__STATE__) (((__STATE__) == USART_SLAVEMODE_DISABLE ) || \ | |||
| ((__STATE__) == USART_SLAVEMODE_ENABLE)) | |||
| /** | |||
| * @brief Ensure that USART FIFO mode is valid. | |||
| * @param __STATE__ USART FIFO mode. | |||
| * @retval SET (__STATE__ is valid) or RESET (__STATE__ is invalid) | |||
| */ | |||
| #define IS_USART_FIFO_MODE_STATE(__STATE__) (((__STATE__) == USART_FIFOMODE_DISABLE ) || \ | |||
| ((__STATE__) == USART_FIFOMODE_ENABLE)) | |||
| /** | |||
| * @brief Ensure that USART TXFIFO threshold level is valid. | |||
| * @param __THRESHOLD__ USART TXFIFO threshold level. | |||
| * @retval SET (__THRESHOLD__ is valid) or RESET (__THRESHOLD__ is invalid) | |||
| */ | |||
| #define IS_USART_TXFIFO_THRESHOLD(__THRESHOLD__) (((__THRESHOLD__) == USART_TXFIFO_THRESHOLD_1_8) || \ | |||
| ((__THRESHOLD__) == USART_TXFIFO_THRESHOLD_1_4) || \ | |||
| ((__THRESHOLD__) == USART_TXFIFO_THRESHOLD_1_2) || \ | |||
| ((__THRESHOLD__) == USART_TXFIFO_THRESHOLD_3_4) || \ | |||
| ((__THRESHOLD__) == USART_TXFIFO_THRESHOLD_7_8) || \ | |||
| ((__THRESHOLD__) == USART_TXFIFO_THRESHOLD_8_8)) | |||
| /** | |||
| * @brief Ensure that USART RXFIFO threshold level is valid. | |||
| * @param __THRESHOLD__ USART RXFIFO threshold level. | |||
| * @retval SET (__THRESHOLD__ is valid) or RESET (__THRESHOLD__ is invalid) | |||
| */ | |||
| #define IS_USART_RXFIFO_THRESHOLD(__THRESHOLD__) (((__THRESHOLD__) == USART_RXFIFO_THRESHOLD_1_8) || \ | |||
| ((__THRESHOLD__) == USART_RXFIFO_THRESHOLD_1_4) || \ | |||
| ((__THRESHOLD__) == USART_RXFIFO_THRESHOLD_1_2) || \ | |||
| ((__THRESHOLD__) == USART_RXFIFO_THRESHOLD_3_4) || \ | |||
| ((__THRESHOLD__) == USART_RXFIFO_THRESHOLD_7_8) || \ | |||
| ((__THRESHOLD__) == USART_RXFIFO_THRESHOLD_8_8)) | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @addtogroup USARTEx_Exported_Functions | |||
| * @{ | |||
| */ | |||
| /** @addtogroup USARTEx_Exported_Functions_Group1 | |||
| * @{ | |||
| */ | |||
| /* IO operation functions *****************************************************/ | |||
| void HAL_USARTEx_RxFifoFullCallback(USART_HandleTypeDef *husart); | |||
| void HAL_USARTEx_TxFifoEmptyCallback(USART_HandleTypeDef *husart); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @addtogroup USARTEx_Exported_Functions_Group2 | |||
| * @{ | |||
| */ | |||
| /* Peripheral Control functions ***********************************************/ | |||
| HAL_StatusTypeDef HAL_USARTEx_EnableSlaveMode(USART_HandleTypeDef *husart); | |||
| HAL_StatusTypeDef HAL_USARTEx_DisableSlaveMode(USART_HandleTypeDef *husart); | |||
| HAL_StatusTypeDef HAL_USARTEx_ConfigNSS(USART_HandleTypeDef *husart, uint32_t NSSConfig); | |||
| HAL_StatusTypeDef HAL_USARTEx_EnableFifoMode(USART_HandleTypeDef *husart); | |||
| HAL_StatusTypeDef HAL_USARTEx_DisableFifoMode(USART_HandleTypeDef *husart); | |||
| HAL_StatusTypeDef HAL_USARTEx_SetTxFifoThreshold(USART_HandleTypeDef *husart, uint32_t Threshold); | |||
| HAL_StatusTypeDef HAL_USARTEx_SetRxFifoThreshold(USART_HandleTypeDef *husart, uint32_t Threshold); | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| @@ -154,6 +280,6 @@ | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_HAL_USART_EX_H */ | |||
| #endif /* STM32H7xx_HAL_USART_EX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -2,42 +2,24 @@ | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_hal_wwdg.h | |||
| * @author MCD Application Team | |||
| * @version V1.2.0 | |||
| * @date 29-December-2017 | |||
| * @brief Header file of WWDG HAL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</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. | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_HAL_WWDG_H | |||
| #define __STM32H7xx_HAL_WWDG_H | |||
| #ifndef STM32H7xx_HAL_WWDG_H | |||
| #define STM32H7xx_HAL_WWDG_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| @@ -77,18 +59,44 @@ typedef struct | |||
| 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; | |||
| } WWDG_InitTypeDef; | |||
| /** | |||
| * @brief WWDG handle Structure definition | |||
| */ | |||
| #if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1) | |||
| typedef struct __WWDG_HandleTypeDef | |||
| #else | |||
| typedef struct | |||
| #endif | |||
| { | |||
| WWDG_TypeDef *Instance; /*!< Register base address */ | |||
| WWDG_InitTypeDef Init; /*!< WWDG required parameters */ | |||
| #if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1) | |||
| void (* EwiCallback)(struct __WWDG_HandleTypeDef *hwwdg); /*!< WWDG Early WakeUp Interrupt callback */ | |||
| void (* MspInitCallback)(struct __WWDG_HandleTypeDef *hwwdg); /*!< WWDG Msp Init callback */ | |||
| #endif | |||
| } WWDG_HandleTypeDef; | |||
| #if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1) | |||
| /** | |||
| * @brief HAL WWDG common Callback ID enumeration definition | |||
| */ | |||
| typedef enum | |||
| { | |||
| WWDG_TypeDef *Instance; /*!< Register base address */ | |||
| HAL_WWDG_EWI_CB_ID = 0x00u, /*!< WWDG EWI callback ID */ | |||
| HAL_WWDG_MSPINIT_CB_ID = 0x01u, /*!< WWDG MspInit callback ID */ | |||
| }HAL_WWDG_CallbackIDTypeDef; | |||
| WWDG_InitTypeDef Init; /*!< WWDG required parameters */ | |||
| /** | |||
| * @brief HAL WWDG Callback pointer definition | |||
| */ | |||
| typedef void (*pWWDG_CallbackTypeDef)(WWDG_HandleTypeDef * hppp); /*!< pointer to a WWDG common callback functions */ | |||
| }WWDG_HandleTypeDef; | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -119,15 +127,14 @@ typedef struct | |||
| /** @defgroup WWDG_Prescaler WWDG Prescaler | |||
| * @{ | |||
| */ | |||
| #define WWDG_PRESCALER_1 ((uint32_t)(0x00000000U)) /*!< WWDG counter clock = (PCLK1/4096)/1 */ | |||
| #define WWDG_PRESCALER_2 ((uint32_t)(WWDG_CFR_WDGTB0)) /*!< WWDG counter clock = (PCLK1/4096)/2 */ | |||
| #define WWDG_PRESCALER_4 ((uint32_t)(WWDG_CFR_WDGTB1)) /*!< WWDG counter clock = (PCLK1/4096)/4 */ | |||
| #define WWDG_PRESCALER_8 ((uint32_t)(WWDG_CFR_WDGTB1|WWDG_CFR_WDGTB0)) /*!< WWDG counter clock = (PCLK1/4096)/8 */ | |||
| #define WWDG_PRESCALER_16 ((uint32_t)(WWDG_CFR_WDGTB2)) /*!< WWDG counter clock = (PCLK1/4096)/16 */ | |||
| #define WWDG_PRESCALER_32 ((uint32_t)(WWDG_CFR_WDGTB2|WWDG_CFR_WDGTB0)) /*!< WWDG counter clock = (PCLK1/4096)/32 */ | |||
| #define WWDG_PRESCALER_64 ((uint32_t)(WWDG_CFR_WDGTB2|WWDG_CFR_WDGTB1)) /*!< WWDG counter clock = (PCLK1/4096)/64 */ | |||
| #define WWDG_PRESCALER_128 ((uint32_t)(WWDG_CFR_WDGTB2|WWDG_CFR_WDGTB1|WWDG_CFR_WDGTB0)) /*!< WWDG counter clock = (PCLK1/4096)/128 */ | |||
| #define WWDG_PRESCALER_1 0x00000000u /*!< WWDG counter clock = (PCLK1/4096)/1 */ | |||
| #define WWDG_PRESCALER_2 WWDG_CFR_WDGTB_0 /*!< WWDG counter clock = (PCLK1/4096)/2 */ | |||
| #define WWDG_PRESCALER_4 WWDG_CFR_WDGTB_1 /*!< WWDG counter clock = (PCLK1/4096)/4 */ | |||
| #define WWDG_PRESCALER_8 (WWDG_CFR_WDGTB_1 | WWDG_CFR_WDGTB_0) /*!< WWDG counter clock = (PCLK1/4096)/8 */ | |||
| #define WWDG_PRESCALER_16 WWDG_CFR_WDGTB_2 /*!< WWDG counter clock = (PCLK1/4096)/16 */ | |||
| #define WWDG_PRESCALER_32 (WWDG_CFR_WDGTB_2 | WWDG_CFR_WDGTB_0) /*!< WWDG counter clock = (PCLK1/4096)/32 */ | |||
| #define WWDG_PRESCALER_64 (WWDG_CFR_WDGTB_2 | WWDG_CFR_WDGTB_1) /*!< WWDG counter clock = (PCLK1/4096)/64 */ | |||
| #define WWDG_PRESCALER_128 WWDG_CFR_WDGTB /*!< WWDG counter clock = (PCLK1/4096)/128 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -159,9 +166,9 @@ typedef struct | |||
| ((__PRESCALER__) == WWDG_PRESCALER_64) || \ | |||
| ((__PRESCALER__) == WWDG_PRESCALER_128)) | |||
| #define IS_WWDG_WINDOW(__WINDOW__) (((__WINDOW__) >= WWDG_CFR_W6) && ((__WINDOW__) <= WWDG_CFR_W)) | |||
| #define IS_WWDG_WINDOW(__WINDOW__) (((__WINDOW__) >= WWDG_CFR_W_6) && ((__WINDOW__) <= WWDG_CFR_W)) | |||
| #define IS_WWDG_COUNTER(__COUNTER__) (((__COUNTER__) >= WWDG_CR_T6) && ((__COUNTER__) <= WWDG_CR_T)) | |||
| #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)) | |||
| @@ -231,7 +238,7 @@ typedef struct | |||
| * @arg WWDG_FLAG_EWIF: Early wakeup interrupt flag | |||
| * @retval None | |||
| */ | |||
| #define __HAL_WWDG_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(uint32_t)(__FLAG__)) | |||
| #define __HAL_WWDG_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__)) | |||
| /** @brief Check whether the specified WWDG interrupt source is enabled or not. | |||
| * @param __HANDLE__ WWDG Handle. | |||
| @@ -258,6 +265,12 @@ typedef struct | |||
| /* Initialization/de-initialization functions **********************************/ | |||
| HAL_StatusTypeDef HAL_WWDG_Init(WWDG_HandleTypeDef *hwwdg); | |||
| void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg); | |||
| /* Callbacks Register/UnRegister functions ***********************************/ | |||
| #if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1) | |||
| HAL_StatusTypeDef HAL_WWDG_RegisterCallback(WWDG_HandleTypeDef *hwwdg, HAL_WWDG_CallbackIDTypeDef CallbackID, pWWDG_CallbackTypeDef pCallback); | |||
| HAL_StatusTypeDef HAL_WWDG_UnRegisterCallback(WWDG_HandleTypeDef *hwwdg, HAL_WWDG_CallbackIDTypeDef CallbackID); | |||
| #endif | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -268,7 +281,7 @@ void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg); | |||
| /* 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); | |||
| void HAL_WWDG_EarlyWakeupCallback(WWDG_HandleTypeDef *hwwdg); | |||
| /** | |||
| * @} | |||
| */ | |||
| @@ -0,0 +1,755 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_ll_comp.h | |||
| * @author MCD Application Team | |||
| * @brief Header file of COMP LL module. | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© Copyright (c) 2017 STMicroelectronics. | |||
| * All rights reserved.</center></h2> | |||
| * | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef __STM32H7xx_LL_COMP_H | |||
| #define __STM32H7xx_LL_COMP_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx.h" | |||
| /** @addtogroup STM32H7xx_LL_Driver | |||
| * @{ | |||
| */ | |||
| #if defined (COMP1) || defined (COMP2) | |||
| /** @defgroup COMP_LL COMP | |||
| * @{ | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /** @defgroup COMP_LL_Private_Constants COMP Private Constants | |||
| * @{ | |||
| */ | |||
| /* COMP registers bits positions */ | |||
| #define LL_COMP_OUTPUT_LEVEL_BITOFFSET_POS (30U) /* Value equivalent to POSITION_VAL(COMP_CSR_VALUE) */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| #if defined(USE_FULL_LL_DRIVER) | |||
| /** @defgroup COMP_LL_ES_INIT COMP Exported Init structure | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief Structure definition of some features of COMP instance. | |||
| */ | |||
| typedef struct | |||
| { | |||
| uint32_t PowerMode; /*!< Set comparator operating mode to adjust power and speed. | |||
| This parameter can be a value of @ref COMP_LL_EC_POWERMODE | |||
| This feature can be modified afterwards using unitary function @ref LL_COMP_SetPowerMode(). */ | |||
| uint32_t InputPlus; /*!< Set comparator input plus (non-inverting input). | |||
| This parameter can be a value of @ref COMP_LL_EC_INPUT_PLUS | |||
| This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputPlus(). */ | |||
| uint32_t InputMinus; /*!< Set comparator input minus (inverting input). | |||
| This parameter can be a value of @ref COMP_LL_EC_INPUT_MINUS | |||
| This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputMinus(). */ | |||
| uint32_t InputHysteresis; /*!< Set comparator hysteresis mode of the input minus. | |||
| This parameter can be a value of @ref COMP_LL_EC_INPUT_HYSTERESIS | |||
| This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputHysteresis(). */ | |||
| uint32_t OutputPolarity; /*!< Set comparator output polarity. | |||
| This parameter can be a value of @ref COMP_LL_EC_OUTPUT_POLARITY | |||
| This feature can be modified afterwards using unitary function @ref LL_COMP_SetOutputPolarity(). */ | |||
| uint32_t OutputBlankingSource; /*!< Set comparator blanking source. | |||
| This parameter can be a value of @ref COMP_LL_EC_OUTPUT_BLANKING_SOURCE | |||
| This feature can be modified afterwards using unitary function @ref LL_COMP_SetOutputBlankingSource(). */ | |||
| } LL_COMP_InitTypeDef; | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* USE_FULL_LL_DRIVER */ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup COMP_LL_Exported_Constants COMP Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup COMP_LL_EC_COMMON_WINDOWMODE Comparator common modes - Window mode | |||
| * @{ | |||
| */ | |||
| #define LL_COMP_WINDOWMODE_DISABLE (0x00000000UL) /*!< Window mode disable: Comparators 1 and 2 are independent */ | |||
| #define LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON (COMP_CFGRx_WINMODE) /*!< Window mode enable: Comparators instances pair COMP1 and COMP2 have their input plus connected together. The common input is COMP1 input plus (COMP2 input plus is no more accessible). */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup COMP_LL_EC_POWERMODE Comparator modes - Power mode | |||
| * @{ | |||
| */ | |||
| #define LL_COMP_POWERMODE_HIGHSPEED (0x00000000UL) /*!< COMP power mode to high speed */ | |||
| #define LL_COMP_POWERMODE_MEDIUMSPEED (COMP_CFGRx_PWRMODE_0) /*!< COMP power mode to medium speed */ | |||
| #define LL_COMP_POWERMODE_ULTRALOWPOWER (COMP_CFGRx_PWRMODE_1 | COMP_CFGRx_PWRMODE_0) /*!< COMP power mode to ultra-low power */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup COMP_LL_EC_INPUT_PLUS Comparator inputs - Input plus (input non-inverting) selection | |||
| * @{ | |||
| */ | |||
| #define LL_COMP_INPUT_PLUS_IO1 (0x00000000UL) /*!< Comparator input plus connected to IO1 (pin PB0 for COMP1, pin PE9 for COMP2) */ | |||
| #define LL_COMP_INPUT_PLUS_IO2 (COMP_CFGRx_INPSEL) /*!< Comparator input plus connected to IO2 (pin PB2 for COMP1, pin PE11 for COMP2) */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup COMP_LL_EC_INPUT_MINUS Comparator inputs - Input minus (input inverting) selection | |||
| * @{ | |||
| */ | |||
| #define LL_COMP_INPUT_MINUS_1_4VREFINT ( COMP_CFGRx_SCALEN | COMP_CFGRx_BRGEN) /*!< Comparator input minus connected to 1/4 VrefInt */ | |||
| #define LL_COMP_INPUT_MINUS_1_2VREFINT ( COMP_CFGRx_INMSEL_0 | COMP_CFGRx_SCALEN | COMP_CFGRx_BRGEN) /*!< Comparator input minus connected to 1/2 VrefInt */ | |||
| #define LL_COMP_INPUT_MINUS_3_4VREFINT ( COMP_CFGRx_INMSEL_1 | COMP_CFGRx_SCALEN | COMP_CFGRx_BRGEN) /*!< Comparator input minus connected to 3/4 VrefInt */ | |||
| #define LL_COMP_INPUT_MINUS_VREFINT ( COMP_CFGRx_INMSEL_1 | COMP_CFGRx_INMSEL_0 | COMP_CFGRx_SCALEN ) /*!< Comparator input minus connected to VrefInt */ | |||
| #define LL_COMP_INPUT_MINUS_DAC1_CH1 (COMP_CFGRx_INMSEL_2 ) /*!< Comparator input minus connected to DAC1 channel 1 (DAC_OUT1) */ | |||
| #define LL_COMP_INPUT_MINUS_DAC1_CH2 (COMP_CFGRx_INMSEL_2 | COMP_CFGRx_INMSEL_0) /*!< Comparator input minus connected to DAC1 channel 2 (DAC_OUT2) */ | |||
| #define LL_COMP_INPUT_MINUS_IO1 (COMP_CFGRx_INMSEL_2 | COMP_CFGRx_INMSEL_1 ) /*!< Comparator input minus connected to IO1 (pin PB1 for COMP1, pin PE10 for COMP2) */ | |||
| #define LL_COMP_INPUT_MINUS_IO2 (COMP_CFGRx_INMSEL_2 | COMP_CFGRx_INMSEL_1 | COMP_CFGRx_INMSEL_0) /*!< Comparator input minus connected to IO2 (pin PC4 for COMP1, pin PE7 for COMP2) */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup COMP_LL_EC_INPUT_HYSTERESIS Comparator input - Hysteresis | |||
| * @{ | |||
| */ | |||
| #define LL_COMP_HYSTERESIS_NONE (0x00000000UL) /*!< No hysteresis */ | |||
| #define LL_COMP_HYSTERESIS_LOW ( COMP_CFGRx_HYST_0) /*!< Hysteresis level low */ | |||
| #define LL_COMP_HYSTERESIS_MEDIUM (COMP_CFGRx_HYST_1 ) /*!< Hysteresis level medium */ | |||
| #define LL_COMP_HYSTERESIS_HIGH (COMP_CFGRx_HYST_1 | COMP_CFGRx_HYST_0) /*!< Hysteresis level high */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup COMP_LL_EC_OUTPUT_POLARITY Comparator output - Output polarity | |||
| * @{ | |||
| */ | |||
| #define LL_COMP_OUTPUTPOL_NONINVERTED (0x00000000UL) /*!< COMP output polarity is not inverted: comparator output is high when the plus (non-inverting) input is at a higher voltage than the minus (inverting) input */ | |||
| #define LL_COMP_OUTPUTPOL_INVERTED (COMP_CFGRx_POLARITY) /*!< COMP output polarity is inverted: comparator output is low when the plus (non-inverting) input is at a lower voltage than the minus (inverting) input */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup COMP_LL_EC_OUTPUT_BLANKING_SOURCE Comparator output - Blanking source | |||
| * @{ | |||
| */ | |||
| #define LL_COMP_BLANKINGSRC_NONE (0x00000000UL) /*!<Comparator output without blanking */ | |||
| #define LL_COMP_BLANKINGSRC_TIM1_OC5 (COMP_CFGRx_BLANKING_0) /*!< Comparator output blanking source TIM1 OC5 (common to all COMP instances: COMP1, COMP2) */ | |||
| #define LL_COMP_BLANKINGSRC_TIM2_OC3 (COMP_CFGRx_BLANKING_1) /*!< Comparator output blanking source TIM2 OC3 (common to all COMP instances: COMP1, COMP2) */ | |||
| #define LL_COMP_BLANKINGSRC_TIM3_OC3 (COMP_CFGRx_BLANKING_0 |COMP_CFGRx_BLANKING_1) /*!< Comparator output blanking source TIM3 OC3 (common to all COMP instances: COMP1, COMP2) */ | |||
| #define LL_COMP_BLANKINGSRC_TIM3_OC4 (COMP_CFGRx_BLANKING_2) /*!< Comparator output blanking source TIM3 OC4 (common to all COMP instances: COMP1, COMP2) */ | |||
| #define LL_COMP_BLANKINGSRC_TIM8_OC5 (COMP_CFGRx_BLANKING_2|COMP_CFGRx_BLANKING_0) /*!< Comparator output blanking source TIM8 OC5 (common to all COMP instances: COMP1, COMP2) */ | |||
| #define LL_COMP_BLANKINGSRC_TIM15_OC1 (COMP_CFGRx_BLANKING_2|COMP_CFGRx_BLANKING_1) /*!< Comparator output blanking source TIM15 OC1 (common to all COMP instances: COMP1, COMP2) */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup COMP_LL_EC_OUTPUT_LEVEL Comparator output - Output level | |||
| * @{ | |||
| */ | |||
| #define LL_COMP_OUTPUT_LEVEL_LOW (0x00000000UL) /*!< Comparator output level low (if the polarity is not inverted, otherwise to be complemented) */ | |||
| #define LL_COMP_OUTPUT_LEVEL_HIGH (0x00000001UL) /*!< Comparator output level high (if the polarity is not inverted, otherwise to be complemented) */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup COMP_LL_EC_HW_DELAYS Definitions of COMP hardware constraints delays | |||
| * @note Only COMP IP HW delays are defined in COMP LL driver driver, | |||
| * not timeout values. | |||
| * For details on delays values, refer to descriptions in source code | |||
| * above each literal definition. | |||
| * @{ | |||
| */ | |||
| /* Delay for comparator startup time. */ | |||
| /* Note: Delay required to reach propagation delay specification. */ | |||
| /* Literal set to maximum value (refer to device datasheet, */ | |||
| /* parameter "tSTART"). */ | |||
| /* Unit: us */ | |||
| #define LL_COMP_DELAY_STARTUP_US ( 80UL) /*!< Delay for COMP startup time */ | |||
| /* Delay for comparator voltage scaler stabilization time. */ | |||
| /* Note: Voltage scaler is used when selecting comparator input */ | |||
| /* based on VrefInt: VrefInt or subdivision of VrefInt. */ | |||
| /* Literal set to maximum value (refer to device datasheet, */ | |||
| /* parameter "tSTART_SCALER"). */ | |||
| /* Unit: us */ | |||
| #define LL_COMP_DELAY_VOLTAGE_SCALER_STAB_US ( 200UL) /*!< Delay for COMP voltage scaler stabilization time */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /** @defgroup COMP_LL_Exported_Macros COMP Exported Macros | |||
| * @{ | |||
| */ | |||
| /** @defgroup COMP_LL_EM_WRITE_READ Common write and read registers macro | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief Write a value in COMP register | |||
| * @param __INSTANCE__ comparator instance | |||
| * @param __REG__ Register to be written | |||
| * @param __VALUE__ Value to be written in the register | |||
| * @retval None | |||
| */ | |||
| #define LL_COMP_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) | |||
| /** | |||
| * @brief Read a value in COMP register | |||
| * @param __INSTANCE__ comparator instance | |||
| * @param __REG__ Register to be read | |||
| * @retval Register value | |||
| */ | |||
| #define LL_COMP_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup COMP_LL_EM_HELPER_MACRO COMP helper macro | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief Helper macro to select the COMP common instance | |||
| * to which is belonging the selected COMP instance. | |||
| * @note COMP common register instance can be used to | |||
| * set parameters common to several COMP instances. | |||
| * Refer to functions having argument "COMPxy_COMMON" as parameter. | |||
| * @param __COMPx__ COMP instance | |||
| * @retval COMP common instance or value "0" if there is no COMP common instance. | |||
| */ | |||
| #define __LL_COMP_COMMON_INSTANCE(__COMPx__) \ | |||
| (COMP12_COMMON) | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @defgroup COMP_LL_Exported_Functions COMP Exported Functions | |||
| * @{ | |||
| */ | |||
| /** @defgroup COMP_LL_EF_Configuration_comparator_common Configuration of COMP hierarchical scope: common to several COMP instances | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief Set window mode of a pair of comparators instances | |||
| * (2 consecutive COMP instances odd and even COMP<x> and COMP<x+1>). | |||
| * @rmtoll CFGRx WINMODE LL_COMP_SetCommonWindowMode | |||
| * @param COMPxy_COMMON Comparator common instance | |||
| * (can be set directly from CMSIS definition or by using helper macro @ref __LL_COMP_COMMON_INSTANCE() ) | |||
| * @param WindowMode This parameter can be one of the following values: | |||
| * @arg @ref LL_COMP_WINDOWMODE_DISABLE | |||
| * @arg @ref LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_COMP_SetCommonWindowMode(COMP_Common_TypeDef *COMPxy_COMMON, uint32_t WindowMode) | |||
| { | |||
| /* Note: On this STM32 serie, window mode can be set only */ | |||
| /* from COMP instance: COMP2. */ | |||
| MODIFY_REG(COMPxy_COMMON->CFGR, COMP_CFGRx_WINMODE, WindowMode); | |||
| } | |||
| /** | |||
| * @brief Get window mode of a pair of comparators instances | |||
| * (2 consecutive COMP instances odd and even COMP<x> and COMP<x+1>). | |||
| * @rmtoll CFGRx WINMODE LL_COMP_GetCommonWindowMode | |||
| * @param COMPxy_COMMON Comparator common instance | |||
| * (can be set directly from CMSIS definition or by using helper macro @ref __LL_COMP_COMMON_INSTANCE() ) | |||
| * @retval Returned value can be one of the following values: | |||
| * @arg @ref LL_COMP_WINDOWMODE_DISABLE | |||
| * @arg @ref LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_COMP_GetCommonWindowMode(COMP_Common_TypeDef *COMPxy_COMMON) | |||
| { | |||
| return (uint32_t)(READ_BIT(COMPxy_COMMON->CFGR, COMP_CFGRx_WINMODE)); | |||
| } | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup COMP_LL_EF_Configuration_comparator_modes Configuration of comparator modes | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief Set comparator instance operating mode to adjust power and speed. | |||
| * @rmtoll CFGRx PWRMODE LL_COMP_SetPowerMode | |||
| * @param COMPx Comparator instance | |||
| * @param PowerMode This parameter can be one of the following values: | |||
| * @arg @ref LL_COMP_POWERMODE_HIGHSPEED | |||
| * @arg @ref LL_COMP_POWERMODE_MEDIUMSPEED | |||
| * @arg @ref LL_COMP_POWERMODE_ULTRALOWPOWER | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_COMP_SetPowerMode(COMP_TypeDef *COMPx, uint32_t PowerMode) | |||
| { | |||
| MODIFY_REG(COMPx->CFGR, COMP_CFGRx_PWRMODE, PowerMode); | |||
| } | |||
| /** | |||
| * @brief Get comparator instance operating mode to adjust power and speed. | |||
| * @rmtoll CFGRx PWRMODE LL_COMP_GetPowerMode | |||
| * @param COMPx Comparator instance | |||
| * @retval Returned value can be one of the following values: | |||
| * @arg @ref LL_COMP_POWERMODE_HIGHSPEED | |||
| * @arg @ref LL_COMP_POWERMODE_MEDIUMSPEED | |||
| * @arg @ref LL_COMP_POWERMODE_ULTRALOWPOWER | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_COMP_GetPowerMode(COMP_TypeDef *COMPx) | |||
| { | |||
| return (uint32_t)(READ_BIT(COMPx->CFGR, COMP_CFGRx_PWRMODE)); | |||
| } | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup COMP_LL_EF_Configuration_comparator_inputs Configuration of comparator inputs | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief Set comparator inputs minus (inverting) and plus (non-inverting). | |||
| * @note In case of comparator input selected to be connected to IO: | |||
| * GPIO pins are specific to each comparator instance. | |||
| * Refer to description of parameters or to reference manual. | |||
| * @note On this STM32 serie, scaler bridge is configurable: | |||
| * to optimize power consumption, this function enables the | |||
| * voltage scaler bridge only when required | |||
| * (when selecting comparator input based on VrefInt: VrefInt or | |||
| * subdivision of VrefInt). | |||
| * - For scaler bridge power consumption values, | |||
| * refer to device datasheet, parameter "IDDA(SCALER)". | |||
| * - Voltage scaler requires a delay for voltage stabilization. | |||
| * Refer to device datasheet, parameter "tSTART_SCALER". | |||
| * - Scaler bridge is common for all comparator instances, | |||
| * therefore if at least one of the comparator instance | |||
| * is requiring the scaler bridge, it remains enabled. | |||
| * @rmtoll CFGRx INMSEL LL_COMP_ConfigInputs\n | |||
| * CFGRx INPSEL LL_COMP_ConfigInputs\n | |||
| * CFGRx BRGEN LL_COMP_ConfigInputs\n | |||
| * CFGRx SCALEN LL_COMP_ConfigInputs | |||
| * @param COMPx Comparator instance | |||
| * @param InputMinus This parameter can be one of the following values: | |||
| * @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT | |||
| * @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT | |||
| * @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT | |||
| * @arg @ref LL_COMP_INPUT_MINUS_VREFINT | |||
| * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1 | |||
| * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2 | |||
| * @arg @ref LL_COMP_INPUT_MINUS_IO1 | |||
| * @arg @ref LL_COMP_INPUT_MINUS_IO2 | |||
| * @param InputPlus This parameter can be one of the following values: | |||
| * @arg @ref LL_COMP_INPUT_PLUS_IO1 | |||
| * @arg @ref LL_COMP_INPUT_PLUS_IO2 | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_COMP_ConfigInputs(COMP_TypeDef *COMPx, uint32_t InputMinus, uint32_t InputPlus) | |||
| { | |||
| MODIFY_REG(COMPx->CFGR, | |||
| COMP_CFGRx_INMSEL | COMP_CFGRx_INPSEL | COMP_CFGRx_SCALEN | COMP_CFGRx_BRGEN, | |||
| InputMinus | InputPlus); | |||
| } | |||
| /** | |||
| * @brief Set comparator input plus (non-inverting). | |||
| * @note In case of comparator input selected to be connected to IO: | |||
| * GPIO pins are specific to each comparator instance. | |||
| * Refer to description of parameters or to reference manual. | |||
| * @rmtoll CFGRx INPSEL LL_COMP_SetInputPlus | |||
| * @param COMPx Comparator instance | |||
| * @param InputPlus This parameter can be one of the following values: | |||
| * @arg @ref LL_COMP_INPUT_PLUS_IO1 | |||
| * @arg @ref LL_COMP_INPUT_PLUS_IO2 | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_COMP_SetInputPlus(COMP_TypeDef *COMPx, uint32_t InputPlus) | |||
| { | |||
| MODIFY_REG(COMPx->CFGR, COMP_CFGRx_INPSEL, InputPlus); | |||
| } | |||
| /** | |||
| * @brief Get comparator input plus (non-inverting). | |||
| * @note In case of comparator input selected to be connected to IO: | |||
| * GPIO pins are specific to each comparator instance. | |||
| * Refer to description of parameters or to reference manual. | |||
| * @rmtoll CFGRx INPSEL LL_COMP_GetInputPlus | |||
| * @param COMPx Comparator instance | |||
| * @retval Returned value can be one of the following values: | |||
| * @arg @ref LL_COMP_INPUT_PLUS_IO1 | |||
| * @arg @ref LL_COMP_INPUT_PLUS_IO2 | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_COMP_GetInputPlus(COMP_TypeDef *COMPx) | |||
| { | |||
| return (uint32_t)(READ_BIT(COMPx->CFGR, COMP_CFGRx_INPSEL)); | |||
| } | |||
| /** | |||
| * @brief Set comparator input minus (inverting). | |||
| * @note In case of comparator input selected to be connected to IO: | |||
| * GPIO pins are specific to each comparator instance. | |||
| * Refer to description of parameters or to reference manual. | |||
| * @note On this STM32 serie, scaler bridge is configurable: | |||
| * to optimize power consumption, this function enables the | |||
| * voltage scaler bridge only when required | |||
| * (when selecting comparator input based on VrefInt: VrefInt or | |||
| * subdivision of VrefInt). | |||
| * - For scaler bridge power consumption values, | |||
| * refer to device datasheet, parameter "IDDA(SCALER)". | |||
| * - Voltage scaler requires a delay for voltage stabilization. | |||
| * Refer to device datasheet, parameter "tSTART_SCALER". | |||
| * - Scaler bridge is common for all comparator instances, | |||
| * therefore if at least one of the comparator instance | |||
| * is requiring the scaler bridge, it remains enabled. | |||
| * @rmtoll CFGRx INMSEL LL_COMP_SetInputMinus\n | |||
| * CFGRx BRGEN LL_COMP_SetInputMinus\n | |||
| * CFGRx SCALEN LL_COMP_SetInputMinus | |||
| * @param COMPx Comparator instance | |||
| * @param InputMinus This parameter can be one of the following values: | |||
| * @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT | |||
| * @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT | |||
| * @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT | |||
| * @arg @ref LL_COMP_INPUT_MINUS_VREFINT | |||
| * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1 | |||
| * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2 | |||
| * @arg @ref LL_COMP_INPUT_MINUS_IO1 | |||
| * @arg @ref LL_COMP_INPUT_MINUS_IO2 | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_COMP_SetInputMinus(COMP_TypeDef *COMPx, uint32_t InputMinus) | |||
| { | |||
| MODIFY_REG(COMPx->CFGR, COMP_CFGRx_INMSEL | COMP_CFGRx_SCALEN | COMP_CFGRx_BRGEN, InputMinus); | |||
| } | |||
| /** | |||
| * @brief Get comparator input minus (inverting). | |||
| * @note In case of comparator input selected to be connected to IO: | |||
| * GPIO pins are specific to each comparator instance. | |||
| * Refer to description of parameters or to reference manual. | |||
| * @rmtoll CFGRx INMSEL LL_COMP_GetInputMinus\n | |||
| * CFGRx BRGEN LL_COMP_GetInputMinus\n | |||
| * CFGRx SCALEN LL_COMP_GetInputMinus | |||
| * @param COMPx Comparator instance | |||
| * @retval Returned value can be one of the following values: | |||
| * @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT | |||
| * @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT | |||
| * @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT | |||
| * @arg @ref LL_COMP_INPUT_MINUS_VREFINT | |||
| * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1 | |||
| * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2 | |||
| * @arg @ref LL_COMP_INPUT_MINUS_IO1 | |||
| * @arg @ref LL_COMP_INPUT_MINUS_IO2 | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_COMP_GetInputMinus(COMP_TypeDef *COMPx) | |||
| { | |||
| return (uint32_t)(READ_BIT(COMPx->CFGR, COMP_CFGRx_INMSEL | COMP_CFGRx_SCALEN | COMP_CFGRx_BRGEN)); | |||
| } | |||
| /** | |||
| * @brief Set comparator instance hysteresis mode of the input minus (inverting input). | |||
| * @rmtoll CFGRx HYST LL_COMP_SetInputHysteresis | |||
| * @param COMPx Comparator instance | |||
| * @param InputHysteresis This parameter can be one of the following values: | |||
| * @arg @ref LL_COMP_HYSTERESIS_NONE | |||
| * @arg @ref LL_COMP_HYSTERESIS_LOW | |||
| * @arg @ref LL_COMP_HYSTERESIS_MEDIUM | |||
| * @arg @ref LL_COMP_HYSTERESIS_HIGH | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_COMP_SetInputHysteresis(COMP_TypeDef *COMPx, uint32_t InputHysteresis) | |||
| { | |||
| MODIFY_REG(COMPx->CFGR, COMP_CFGRx_HYST, InputHysteresis); | |||
| } | |||
| /** | |||
| * @brief Get comparator instance hysteresis mode of the minus (inverting) input. | |||
| * @rmtoll CSR HYST LL_COMP_GetInputHysteresis | |||
| * @param COMPx Comparator instance | |||
| * @retval Returned value can be one of the following values: | |||
| * @arg @ref LL_COMP_HYSTERESIS_NONE | |||
| * @arg @ref LL_COMP_HYSTERESIS_LOW | |||
| * @arg @ref LL_COMP_HYSTERESIS_MEDIUM | |||
| * @arg @ref LL_COMP_HYSTERESIS_HIGH | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_COMP_GetInputHysteresis(COMP_TypeDef *COMPx) | |||
| { | |||
| return (uint32_t)(READ_BIT(COMPx->CFGR, COMP_CFGRx_HYST)); | |||
| } | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup COMP_LL_EF_Configuration_comparator_output Configuration of comparator output | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief Set comparator instance output polarity. | |||
| * @rmtoll CFGRx POLARITY LL_COMP_SetOutputPolarity | |||
| * @param COMPx Comparator instance | |||
| * @param OutputPolarity This parameter can be one of the following values: | |||
| * @arg @ref LL_COMP_OUTPUTPOL_NONINVERTED | |||
| * @arg @ref LL_COMP_OUTPUTPOL_INVERTED | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_COMP_SetOutputPolarity(COMP_TypeDef *COMPx, uint32_t OutputPolarity) | |||
| { | |||
| MODIFY_REG(COMPx->CFGR, COMP_CFGRx_POLARITY, OutputPolarity); | |||
| } | |||
| /** | |||
| * @brief Get comparator instance output polarity. | |||
| * @rmtoll CFGRx POLARITY LL_COMP_GetOutputPolarity | |||
| * @param COMPx Comparator instance | |||
| * @retval Returned value can be one of the following values: | |||
| * @arg @ref LL_COMP_OUTPUTPOL_NONINVERTED | |||
| * @arg @ref LL_COMP_OUTPUTPOL_INVERTED | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_COMP_GetOutputPolarity(COMP_TypeDef *COMPx) | |||
| { | |||
| return (uint32_t)(READ_BIT(COMPx->CFGR, COMP_CFGRx_POLARITY)); | |||
| } | |||
| /** | |||
| * @brief Set comparator instance blanking source. | |||
| * @note Blanking source may be specific to each comparator instance. | |||
| * Refer to description of parameters or to reference manual. | |||
| * @note Availability of parameters of blanking source from timer | |||
| * depends on timers availability on the selected device. | |||
| * @rmtoll CFGR BLANKING LL_COMP_SetOutputBlankingSource | |||
| * @param COMPx Comparator instance | |||
| * @param BlankingSource This parameter can be one of the following values: | |||
| * @arg @ref LL_COMP_BLANKINGSRC_NONE | |||
| * @arg @ref LL_COMP_BLANKINGSRC_TIM1_OC5 | |||
| * @arg @ref LL_COMP_BLANKINGSRC_TIM2_OC3 | |||
| * @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC3 | |||
| * @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC4 | |||
| * @arg @ref LL_COMP_BLANKINGSRC_TIM8_OC5 | |||
| * @arg @ref LL_COMP_BLANKINGSRC_TIM15_OC1 | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_COMP_SetOutputBlankingSource(COMP_TypeDef *COMPx, uint32_t BlankingSource) | |||
| { | |||
| MODIFY_REG(COMPx->CFGR, COMP_CFGRx_BLANKING, BlankingSource); | |||
| } | |||
| /** | |||
| * @brief Get comparator instance blanking source. | |||
| * @note Availability of parameters of blanking source from timer | |||
| * depends on timers availability on the selected device. | |||
| * @note Blanking source may be specific to each comparator instance. | |||
| * Refer to description of parameters or to reference manual. | |||
| * @rmtoll CFGR BLANKING LL_COMP_GetOutputBlankingSource | |||
| * @param COMPx Comparator instance | |||
| * @retval Returned value can be one of the following values: | |||
| * @arg @ref LL_COMP_BLANKINGSRC_NONE | |||
| * @arg @ref LL_COMP_BLANKINGSRC_TIM1_OC5 | |||
| * @arg @ref LL_COMP_BLANKINGSRC_TIM2_OC3 | |||
| * @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC3 | |||
| * @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC4 | |||
| * @arg @ref LL_COMP_BLANKINGSRC_TIM8_OC5 | |||
| * @arg @ref LL_COMP_BLANKINGSRC_TIM15_OC1 | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_COMP_GetOutputBlankingSource(COMP_TypeDef *COMPx) | |||
| { | |||
| return (uint32_t)(READ_BIT(COMPx->CFGR, COMP_CFGRx_BLANKING)); | |||
| } | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup COMP_LL_EF_Operation Operation on comparator instance | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief Enable comparator instance. | |||
| * @note After enable from off state, comparator requires a delay | |||
| * to reach reach propagation delay specification. | |||
| * Refer to device datasheet, parameter "tSTART". | |||
| * @rmtoll CFGR EN LL_COMP_Enable | |||
| * @param COMPx Comparator instance | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_COMP_Enable(COMP_TypeDef *COMPx) | |||
| { | |||
| SET_BIT(COMPx->CFGR, COMP_CFGRx_EN); | |||
| } | |||
| /** | |||
| * @brief Disable comparator instance. | |||
| * @rmtoll CFGR EN LL_COMP_Disable | |||
| * @param COMPx Comparator instance | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_COMP_Disable(COMP_TypeDef *COMPx) | |||
| { | |||
| CLEAR_BIT(COMPx->CFGR, COMP_CFGRx_EN); | |||
| } | |||
| /** | |||
| * @brief Get comparator enable state | |||
| * (0: COMP is disabled, 1: COMP is enabled) | |||
| * @rmtoll CFGR EN LL_COMP_IsEnabled | |||
| * @param COMPx Comparator instance | |||
| * @retval State of bit (1 or 0). | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_COMP_IsEnabled(COMP_TypeDef *COMPx) | |||
| { | |||
| return ((READ_BIT(COMPx->CFGR, COMP_CFGRx_EN) == (COMP_CFGRx_EN)) ? 1UL : 0UL); | |||
| } | |||
| /** | |||
| * @brief Lock comparator instance. | |||
| * @note Once locked, comparator configuration can be accessed in read-only. | |||
| * @note The only way to unlock the comparator is a device hardware reset. | |||
| * @rmtoll CFGR LOCK LL_COMP_Lock | |||
| * @param COMPx Comparator instance | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_COMP_Lock(COMP_TypeDef *COMPx) | |||
| { | |||
| SET_BIT(COMPx->CFGR, COMP_CFGRx_LOCK); | |||
| } | |||
| /** | |||
| * @brief Get comparator lock state | |||
| * (0: COMP is unlocked, 1: COMP is locked). | |||
| * @note Once locked, comparator configuration can be accessed in read-only. | |||
| * @note The only way to unlock the comparator is a device hardware reset. | |||
| * @rmtoll CFGR LOCK LL_COMP_IsLocked | |||
| * @param COMPx Comparator instance | |||
| * @retval State of bit (1 or 0). | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_COMP_IsLocked(COMP_TypeDef *COMPx) | |||
| { | |||
| return ((READ_BIT(COMPx->CFGR, COMP_CFGRx_LOCK) == (COMP_CFGRx_LOCK)) ? 1UL : 0UL); | |||
| } | |||
| /** | |||
| * @brief Read comparator instance output level. | |||
| * @note The comparator output level depends on the selected polarity | |||
| * (Refer to function @ref LL_COMP_SetOutputPolarity()). | |||
| * If the comparator polarity is not inverted: | |||
| * - Comparator output is low when the input plus | |||
| * is at a lower voltage than the input minus | |||
| * - Comparator output is high when the input plus | |||
| * is at a higher voltage than the input minus | |||
| * If the comparator polarity is inverted: | |||
| * - Comparator output is high when the input plus | |||
| * is at a lower voltage than the input minus | |||
| * - Comparator output is low when the input plus | |||
| * is at a higher voltage than the input minus | |||
| * @rmtoll CFGR VALUE LL_COMP_ReadOutputLevel | |||
| * @param COMPx Comparator instance | |||
| * @retval Returned value can be one of the following values: | |||
| * @arg @ref LL_COMP_OUTPUT_LEVEL_LOW | |||
| * @arg @ref LL_COMP_OUTPUT_LEVEL_HIGH | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_COMP_ReadOutputLevel(COMP_TypeDef *COMPx) | |||
| { | |||
| if (COMPx == COMP1) | |||
| { | |||
| return (uint32_t)(READ_BIT(COMP12->SR, COMP_SR_C1VAL)); | |||
| } | |||
| else | |||
| { | |||
| return (uint32_t)((READ_BIT(COMP12->SR, COMP_SR_C2VAL))>> 1); | |||
| } | |||
| } | |||
| /** | |||
| * @} | |||
| */ | |||
| #if defined(USE_FULL_LL_DRIVER) | |||
| /** @defgroup COMP_LL_EF_Init Initialization and de-initialization functions | |||
| * @{ | |||
| */ | |||
| ErrorStatus LL_COMP_DeInit(COMP_TypeDef *COMPx); | |||
| ErrorStatus LL_COMP_Init(COMP_TypeDef *COMPx, LL_COMP_InitTypeDef *COMP_InitStruct); | |||
| void LL_COMP_StructInit(LL_COMP_InitTypeDef *COMP_InitStruct); | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* USE_FULL_LL_DRIVER */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* COMP1 || COMP2 */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* __STM32H7xx_LL_COMP_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||
| @@ -0,0 +1,669 @@ | |||
| /** | |||
| ****************************************************************************** | |||
| * @file stm32h7xx_ll_cortex.h | |||
| * @author MCD Application Team | |||
| * @brief Header file of CORTEX LL module. | |||
| @verbatim | |||
| ============================================================================== | |||
| ##### How to use this driver ##### | |||
| ============================================================================== | |||
| [..] | |||
| The LL CORTEX driver contains a set of generic APIs that can be | |||
| used by user: | |||
| (+) SYSTICK configuration used by @ref LL_mDelay and @ref LL_Init1msTick | |||
| functions | |||
| (+) Low power mode configuration (SCB register of Cortex-MCU) | |||
| (+) MPU API to configure and enable regions | |||
| (+) API to access to MCU info (CPUID register) | |||
| (+) API to enable fault handler (SHCSR accesses) | |||
| @endverbatim | |||
| ****************************************************************************** | |||
| * @attention | |||
| * | |||
| * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics. | |||
| * All rights reserved.</center></h2> | |||
| * | |||
| * This software component is licensed by ST under BSD 3-Clause license, | |||
| * the "License"; You may not use this file except in compliance with the | |||
| * License. You may obtain a copy of the License at: | |||
| * opensource.org/licenses/BSD-3-Clause | |||
| * | |||
| ****************************************************************************** | |||
| */ | |||
| /* Define to prevent recursive inclusion -------------------------------------*/ | |||
| #ifndef STM32H7xx_LL_CORTEX_H | |||
| #define STM32H7xx_LL_CORTEX_H | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| /* Includes ------------------------------------------------------------------*/ | |||
| #include "stm32h7xx.h" | |||
| /** @addtogroup STM32H7xx_LL_Driver | |||
| * @{ | |||
| */ | |||
| /** @defgroup CORTEX_LL CORTEX | |||
| * @{ | |||
| */ | |||
| /* Private types -------------------------------------------------------------*/ | |||
| /* Private variables ---------------------------------------------------------*/ | |||
| /* Private constants ---------------------------------------------------------*/ | |||
| /* Private macros ------------------------------------------------------------*/ | |||
| /* Exported types ------------------------------------------------------------*/ | |||
| /* Exported constants --------------------------------------------------------*/ | |||
| /** @defgroup CORTEX_LL_Exported_Constants CORTEX Exported Constants | |||
| * @{ | |||
| */ | |||
| /** @defgroup CORTEX_LL_EC_CLKSOURCE_HCLK SYSTICK Clock Source | |||
| * @{ | |||
| */ | |||
| #define LL_SYSTICK_CLKSOURCE_HCLK_DIV8 0x00000000UL /*!< AHB clock divided by 8 selected as SysTick clock source.*/ | |||
| #define LL_SYSTICK_CLKSOURCE_HCLK SysTick_CTRL_CLKSOURCE_Msk /*!< AHB clock selected as SysTick clock source. */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CORTEX_LL_EC_FAULT Handler Fault type | |||
| * @{ | |||
| */ | |||
| #define LL_HANDLER_FAULT_USG SCB_SHCSR_USGFAULTENA_Msk /*!< Usage fault */ | |||
| #define LL_HANDLER_FAULT_BUS SCB_SHCSR_BUSFAULTENA_Msk /*!< Bus fault */ | |||
| #define LL_HANDLER_FAULT_MEM SCB_SHCSR_MEMFAULTENA_Msk /*!< Memory management fault */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #if __MPU_PRESENT | |||
| /** @defgroup CORTEX_LL_EC_CTRL_HFNMI_PRIVDEF MPU Control | |||
| * @{ | |||
| */ | |||
| #define LL_MPU_CTRL_HFNMI_PRIVDEF_NONE 0x00000000UL /*!< Disable NMI and privileged SW access */ | |||
| #define LL_MPU_CTRL_HARDFAULT_NMI MPU_CTRL_HFNMIENA_Msk /*!< Enables the operation of MPU during hard fault, NMI, and FAULTMASK handlers */ | |||
| #define LL_MPU_CTRL_PRIVILEGED_DEFAULT MPU_CTRL_PRIVDEFENA_Msk /*!< Enable privileged software access to default memory map */ | |||
| #define LL_MPU_CTRL_HFNMI_PRIVDEF (MPU_CTRL_HFNMIENA_Msk | MPU_CTRL_PRIVDEFENA_Msk) /*!< Enable NMI and privileged SW access */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CORTEX_LL_EC_REGION MPU Region Number | |||
| * @{ | |||
| */ | |||
| #define LL_MPU_REGION_NUMBER0 0x00UL /*!< REGION Number 0 */ | |||
| #define LL_MPU_REGION_NUMBER1 0x01UL /*!< REGION Number 1 */ | |||
| #define LL_MPU_REGION_NUMBER2 0x02UL /*!< REGION Number 2 */ | |||
| #define LL_MPU_REGION_NUMBER3 0x03UL /*!< REGION Number 3 */ | |||
| #define LL_MPU_REGION_NUMBER4 0x04UL /*!< REGION Number 4 */ | |||
| #define LL_MPU_REGION_NUMBER5 0x05UL /*!< REGION Number 5 */ | |||
| #define LL_MPU_REGION_NUMBER6 0x06UL /*!< REGION Number 6 */ | |||
| #define LL_MPU_REGION_NUMBER7 0x07UL /*!< REGION Number 7 */ | |||
| #if !defined(CORE_CM4) | |||
| #define LL_MPU_REGION_NUMBER8 0x08UL /*!< REGION Number 8 */ | |||
| #define LL_MPU_REGION_NUMBER9 0x09UL /*!< REGION Number 9 */ | |||
| #define LL_MPU_REGION_NUMBER10 0x0AUL /*!< REGION Number 10 */ | |||
| #define LL_MPU_REGION_NUMBER11 0x0BUL /*!< REGION Number 11 */ | |||
| #define LL_MPU_REGION_NUMBER12 0x0CUL /*!< REGION Number 12 */ | |||
| #define LL_MPU_REGION_NUMBER13 0x0DUL /*!< REGION Number 13 */ | |||
| #define LL_MPU_REGION_NUMBER14 0x0EUL /*!< REGION Number 14 */ | |||
| #define LL_MPU_REGION_NUMBER15 0x0FUL /*!< REGION Number 15 */ | |||
| #endif /* !defined(CORE_CM4) */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CORTEX_LL_EC_REGION_SIZE MPU Region Size | |||
| * @{ | |||
| */ | |||
| #define LL_MPU_REGION_SIZE_32B (0x04UL << MPU_RASR_SIZE_Pos) /*!< 32B Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_64B (0x05UL << MPU_RASR_SIZE_Pos) /*!< 64B Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_128B (0x06UL << MPU_RASR_SIZE_Pos) /*!< 128B Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_256B (0x07UL << MPU_RASR_SIZE_Pos) /*!< 256B Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_512B (0x08UL << MPU_RASR_SIZE_Pos) /*!< 512B Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_1KB (0x09UL << MPU_RASR_SIZE_Pos) /*!< 1KB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_2KB (0x0AUL << MPU_RASR_SIZE_Pos) /*!< 2KB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_4KB (0x0BUL << MPU_RASR_SIZE_Pos) /*!< 4KB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_8KB (0x0CUL << MPU_RASR_SIZE_Pos) /*!< 8KB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_16KB (0x0DUL << MPU_RASR_SIZE_Pos) /*!< 16KB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_32KB (0x0EUL << MPU_RASR_SIZE_Pos) /*!< 32KB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_64KB (0x0FUL << MPU_RASR_SIZE_Pos) /*!< 64KB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_128KB (0x10UL << MPU_RASR_SIZE_Pos) /*!< 128KB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_256KB (0x11UL << MPU_RASR_SIZE_Pos) /*!< 256KB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_512KB (0x12UL << MPU_RASR_SIZE_Pos) /*!< 512KB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_1MB (0x13UL << MPU_RASR_SIZE_Pos) /*!< 1MB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_2MB (0x14UL << MPU_RASR_SIZE_Pos) /*!< 2MB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_4MB (0x15UL << MPU_RASR_SIZE_Pos) /*!< 4MB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_8MB (0x16UL << MPU_RASR_SIZE_Pos) /*!< 8MB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_16MB (0x17UL << MPU_RASR_SIZE_Pos) /*!< 16MB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_32MB (0x18UL << MPU_RASR_SIZE_Pos) /*!< 32MB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_64MB (0x19UL << MPU_RASR_SIZE_Pos) /*!< 64MB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_128MB (0x1AUL << MPU_RASR_SIZE_Pos) /*!< 128MB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_256MB (0x1BUL << MPU_RASR_SIZE_Pos) /*!< 256MB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_512MB (0x1CUL << MPU_RASR_SIZE_Pos) /*!< 512MB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_1GB (0x1DUL << MPU_RASR_SIZE_Pos) /*!< 1GB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_2GB (0x1EUL << MPU_RASR_SIZE_Pos) /*!< 2GB Size of the MPU protection region */ | |||
| #define LL_MPU_REGION_SIZE_4GB (0x1FUL << MPU_RASR_SIZE_Pos) /*!< 4GB Size of the MPU protection region */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CORTEX_LL_EC_REGION_PRIVILEDGES MPU Region Privileges | |||
| * @{ | |||
| */ | |||
| #define LL_MPU_REGION_NO_ACCESS (0x00UL << MPU_RASR_AP_Pos) /*!< No access*/ | |||
| #define LL_MPU_REGION_PRIV_RW (0x01UL << MPU_RASR_AP_Pos) /*!< RW privileged (privileged access only)*/ | |||
| #define LL_MPU_REGION_PRIV_RW_URO (0x02UL << MPU_RASR_AP_Pos) /*!< RW privileged - RO user (Write in a user program generates a fault) */ | |||
| #define LL_MPU_REGION_FULL_ACCESS (0x03UL << MPU_RASR_AP_Pos) /*!< RW privileged & user (Full access) */ | |||
| #define LL_MPU_REGION_PRIV_RO (0x05UL << MPU_RASR_AP_Pos) /*!< RO privileged (privileged read only)*/ | |||
| #define LL_MPU_REGION_PRIV_RO_URO (0x06UL << MPU_RASR_AP_Pos) /*!< RO privileged & user (read only) */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CORTEX_LL_EC_TEX MPU TEX Level | |||
| * @{ | |||
| */ | |||
| #define LL_MPU_TEX_LEVEL0 (0x00UL << MPU_RASR_TEX_Pos) /*!< b000 for TEX bits */ | |||
| #define LL_MPU_TEX_LEVEL1 (0x01UL << MPU_RASR_TEX_Pos) /*!< b001 for TEX bits */ | |||
| #define LL_MPU_TEX_LEVEL2 (0x02UL << MPU_RASR_TEX_Pos) /*!< b010 for TEX bits */ | |||
| #define LL_MPU_TEX_LEVEL4 (0x04UL << MPU_RASR_TEX_Pos) /*!< b100 for TEX bits */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CORTEX_LL_EC_INSTRUCTION_ACCESS MPU Instruction Access | |||
| * @{ | |||
| */ | |||
| #define LL_MPU_INSTRUCTION_ACCESS_ENABLE 0x00UL /*!< Instruction fetches enabled */ | |||
| #define LL_MPU_INSTRUCTION_ACCESS_DISABLE MPU_RASR_XN_Msk /*!< Instruction fetches disabled*/ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CORTEX_LL_EC_SHAREABLE_ACCESS MPU Shareable Access | |||
| * @{ | |||
| */ | |||
| #define LL_MPU_ACCESS_SHAREABLE MPU_RASR_S_Msk /*!< Shareable memory attribute */ | |||
| #define LL_MPU_ACCESS_NOT_SHAREABLE 0x00UL /*!< Not Shareable memory attribute */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CORTEX_LL_EC_CACHEABLE_ACCESS MPU Cacheable Access | |||
| * @{ | |||
| */ | |||
| #define LL_MPU_ACCESS_CACHEABLE MPU_RASR_C_Msk /*!< Cacheable memory attribute */ | |||
| #define LL_MPU_ACCESS_NOT_CACHEABLE 0x00UL /*!< Not Cacheable memory attribute */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CORTEX_LL_EC_BUFFERABLE_ACCESS MPU Bufferable Access | |||
| * @{ | |||
| */ | |||
| #define LL_MPU_ACCESS_BUFFERABLE MPU_RASR_B_Msk /*!< Bufferable memory attribute */ | |||
| #define LL_MPU_ACCESS_NOT_BUFFERABLE 0x00UL /*!< Not Bufferable memory attribute */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* __MPU_PRESENT */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /* Exported macro ------------------------------------------------------------*/ | |||
| /* Exported functions --------------------------------------------------------*/ | |||
| /** @defgroup CORTEX_LL_Exported_Functions CORTEX Exported Functions | |||
| * @{ | |||
| */ | |||
| /** @defgroup CORTEX_LL_EF_SYSTICK SYSTICK | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief This function checks if the Systick counter flag is active or not. | |||
| * @note It can be used in timeout function on application side. | |||
| * @rmtoll STK_CTRL COUNTFLAG LL_SYSTICK_IsActiveCounterFlag | |||
| * @retval State of bit (1 or 0). | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_SYSTICK_IsActiveCounterFlag(void) | |||
| { | |||
| return (((SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) == (SysTick_CTRL_COUNTFLAG_Msk)) ? 1UL : 0UL); | |||
| } | |||
| /** | |||
| * @brief Configures the SysTick clock source | |||
| * @rmtoll STK_CTRL CLKSOURCE LL_SYSTICK_SetClkSource | |||
| * @param Source This parameter can be one of the following values: | |||
| * @arg @ref LL_SYSTICK_CLKSOURCE_HCLK_DIV8 | |||
| * @arg @ref LL_SYSTICK_CLKSOURCE_HCLK | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_SYSTICK_SetClkSource(uint32_t Source) | |||
| { | |||
| MODIFY_REG(SysTick->CTRL, LL_SYSTICK_CLKSOURCE_HCLK, Source); | |||
| } | |||
| /** | |||
| * @brief Get the SysTick clock source | |||
| * @rmtoll STK_CTRL CLKSOURCE LL_SYSTICK_GetClkSource | |||
| * @retval Returned value can be one of the following values: | |||
| * @arg @ref LL_SYSTICK_CLKSOURCE_HCLK_DIV8 | |||
| * @arg @ref LL_SYSTICK_CLKSOURCE_HCLK | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_SYSTICK_GetClkSource(void) | |||
| { | |||
| return (uint32_t)(READ_BIT(SysTick->CTRL, LL_SYSTICK_CLKSOURCE_HCLK)); | |||
| } | |||
| /** | |||
| * @brief Enable SysTick exception request | |||
| * @rmtoll STK_CTRL TICKINT LL_SYSTICK_EnableIT | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_SYSTICK_EnableIT(void) | |||
| { | |||
| SET_BIT(SysTick->CTRL, SysTick_CTRL_TICKINT_Msk); | |||
| } | |||
| /** | |||
| * @brief Disable SysTick exception request | |||
| * @rmtoll STK_CTRL TICKINT LL_SYSTICK_DisableIT | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_SYSTICK_DisableIT(void) | |||
| { | |||
| CLEAR_BIT(SysTick->CTRL, SysTick_CTRL_TICKINT_Msk); | |||
| } | |||
| /** | |||
| * @brief Checks if the SYSTICK interrupt is enabled or disabled. | |||
| * @rmtoll STK_CTRL TICKINT LL_SYSTICK_IsEnabledIT | |||
| * @retval State of bit (1 or 0). | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_SYSTICK_IsEnabledIT(void) | |||
| { | |||
| return ((READ_BIT(SysTick->CTRL, SysTick_CTRL_TICKINT_Msk) == (SysTick_CTRL_TICKINT_Msk)) ? 1UL : 0UL); | |||
| } | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CORTEX_LL_EF_LOW_POWER_MODE LOW POWER MODE | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief Processor uses sleep as its low power mode | |||
| * @rmtoll SCB_SCR SLEEPDEEP LL_LPM_EnableSleep | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_LPM_EnableSleep(void) | |||
| { | |||
| /* Clear SLEEPDEEP bit of Cortex System Control Register */ | |||
| CLEAR_BIT(SCB->SCR, SCB_SCR_SLEEPDEEP_Msk); | |||
| } | |||
| /** | |||
| * @brief Processor uses deep sleep as its low power mode | |||
| * @rmtoll SCB_SCR SLEEPDEEP LL_LPM_EnableDeepSleep | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_LPM_EnableDeepSleep(void) | |||
| { | |||
| /* Set SLEEPDEEP bit of Cortex System Control Register */ | |||
| SET_BIT(SCB->SCR, SCB_SCR_SLEEPDEEP_Msk); | |||
| } | |||
| /** | |||
| * @brief Configures sleep-on-exit when returning from Handler mode to Thread mode. | |||
| * @note Setting this bit to 1 enables an interrupt-driven application to avoid returning to an | |||
| * empty main application. | |||
| * @rmtoll SCB_SCR SLEEPONEXIT LL_LPM_EnableSleepOnExit | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_LPM_EnableSleepOnExit(void) | |||
| { | |||
| /* Set SLEEPONEXIT bit of Cortex System Control Register */ | |||
| SET_BIT(SCB->SCR, SCB_SCR_SLEEPONEXIT_Msk); | |||
| } | |||
| /** | |||
| * @brief Do not sleep when returning to Thread mode. | |||
| * @rmtoll SCB_SCR SLEEPONEXIT LL_LPM_DisableSleepOnExit | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_LPM_DisableSleepOnExit(void) | |||
| { | |||
| /* Clear SLEEPONEXIT bit of Cortex System Control Register */ | |||
| CLEAR_BIT(SCB->SCR, SCB_SCR_SLEEPONEXIT_Msk); | |||
| } | |||
| /** | |||
| * @brief Enabled events and all interrupts, including disabled interrupts, can wakeup the | |||
| * processor. | |||
| * @rmtoll SCB_SCR SEVEONPEND LL_LPM_EnableEventOnPend | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_LPM_EnableEventOnPend(void) | |||
| { | |||
| /* Set SEVEONPEND bit of Cortex System Control Register */ | |||
| SET_BIT(SCB->SCR, SCB_SCR_SEVONPEND_Msk); | |||
| } | |||
| /** | |||
| * @brief Only enabled interrupts or events can wakeup the processor, disabled interrupts are | |||
| * excluded | |||
| * @rmtoll SCB_SCR SEVEONPEND LL_LPM_DisableEventOnPend | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_LPM_DisableEventOnPend(void) | |||
| { | |||
| /* Clear SEVEONPEND bit of Cortex System Control Register */ | |||
| CLEAR_BIT(SCB->SCR, SCB_SCR_SEVONPEND_Msk); | |||
| } | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CORTEX_LL_EF_HANDLER HANDLER | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief Enable a fault in System handler control register (SHCSR) | |||
| * @rmtoll SCB_SHCSR MEMFAULTENA LL_HANDLER_EnableFault | |||
| * @param Fault This parameter can be a combination of the following values: | |||
| * @arg @ref LL_HANDLER_FAULT_USG | |||
| * @arg @ref LL_HANDLER_FAULT_BUS | |||
| * @arg @ref LL_HANDLER_FAULT_MEM | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_HANDLER_EnableFault(uint32_t Fault) | |||
| { | |||
| /* Enable the system handler fault */ | |||
| SET_BIT(SCB->SHCSR, Fault); | |||
| } | |||
| /** | |||
| * @brief Disable a fault in System handler control register (SHCSR) | |||
| * @rmtoll SCB_SHCSR MEMFAULTENA LL_HANDLER_DisableFault | |||
| * @param Fault This parameter can be a combination of the following values: | |||
| * @arg @ref LL_HANDLER_FAULT_USG | |||
| * @arg @ref LL_HANDLER_FAULT_BUS | |||
| * @arg @ref LL_HANDLER_FAULT_MEM | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_HANDLER_DisableFault(uint32_t Fault) | |||
| { | |||
| /* Disable the system handler fault */ | |||
| CLEAR_BIT(SCB->SHCSR, Fault); | |||
| } | |||
| /** | |||
| * @} | |||
| */ | |||
| /** @defgroup CORTEX_LL_EF_MCU_INFO MCU INFO | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief Get Implementer code | |||
| * @rmtoll SCB_CPUID IMPLEMENTER LL_CPUID_GetImplementer | |||
| * @retval Value should be equal to 0x41 for ARM | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_CPUID_GetImplementer(void) | |||
| { | |||
| return (uint32_t)(READ_BIT(SCB->CPUID, SCB_CPUID_IMPLEMENTER_Msk) >> SCB_CPUID_IMPLEMENTER_Pos); | |||
| } | |||
| /** | |||
| * @brief Get Variant number (The r value in the rnpn product revision identifier) | |||
| * @rmtoll SCB_CPUID VARIANT LL_CPUID_GetVariant | |||
| * @retval Value between 0 and 255 (0x0: revision 0) | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_CPUID_GetVariant(void) | |||
| { | |||
| return (uint32_t)(READ_BIT(SCB->CPUID, SCB_CPUID_VARIANT_Msk) >> SCB_CPUID_VARIANT_Pos); | |||
| } | |||
| /** | |||
| * @brief Get Constant number | |||
| * @rmtoll SCB_CPUID ARCHITECTURE LL_CPUID_GetConstant | |||
| * @retval Value should be equal to 0xF for Cortex-M7 and Cortex-M4 devices | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_CPUID_GetConstant(void) | |||
| { | |||
| return (uint32_t)(READ_BIT(SCB->CPUID, SCB_CPUID_ARCHITECTURE_Msk) >> SCB_CPUID_ARCHITECTURE_Pos); | |||
| } | |||
| /** | |||
| * @brief Get Part number | |||
| * @rmtoll SCB_CPUID PARTNO LL_CPUID_GetParNo | |||
| * @retval Value should be equal to 0xC27 for Cortex-M7 and equal to 0xC24 for Cortex-M4 | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_CPUID_GetParNo(void) | |||
| { | |||
| return (uint32_t)(READ_BIT(SCB->CPUID, SCB_CPUID_PARTNO_Msk) >> SCB_CPUID_PARTNO_Pos); | |||
| } | |||
| /** | |||
| * @brief Get Revision number (The p value in the rnpn product revision identifier, indicates patch release) | |||
| * @rmtoll SCB_CPUID REVISION LL_CPUID_GetRevision | |||
| * @retval Value between 0 and 255 (0x1: patch 1) | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_CPUID_GetRevision(void) | |||
| { | |||
| return (uint32_t)(READ_BIT(SCB->CPUID, SCB_CPUID_REVISION_Msk) >> SCB_CPUID_REVISION_Pos); | |||
| } | |||
| /** | |||
| * @} | |||
| */ | |||
| #if __MPU_PRESENT | |||
| /** @defgroup CORTEX_LL_EF_MPU MPU | |||
| * @{ | |||
| */ | |||
| /** | |||
| * @brief Enable MPU with input options | |||
| * @rmtoll MPU_CTRL ENABLE LL_MPU_Enable | |||
| * @param Options This parameter can be one of the following values: | |||
| * @arg @ref LL_MPU_CTRL_HFNMI_PRIVDEF_NONE | |||
| * @arg @ref LL_MPU_CTRL_HARDFAULT_NMI | |||
| * @arg @ref LL_MPU_CTRL_PRIVILEGED_DEFAULT | |||
| * @arg @ref LL_MPU_CTRL_HFNMI_PRIVDEF | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_MPU_Enable(uint32_t Options) | |||
| { | |||
| /* Enable the MPU*/ | |||
| WRITE_REG(MPU->CTRL, (MPU_CTRL_ENABLE_Msk | Options)); | |||
| /* Ensure MPU settings take effects */ | |||
| __DSB(); | |||
| /* Sequence instruction fetches using update settings */ | |||
| __ISB(); | |||
| } | |||
| /** | |||
| * @brief Disable MPU | |||
| * @rmtoll MPU_CTRL ENABLE LL_MPU_Disable | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_MPU_Disable(void) | |||
| { | |||
| /* Make sure outstanding transfers are done */ | |||
| __DMB(); | |||
| /* Disable MPU*/ | |||
| WRITE_REG(MPU->CTRL, 0U); | |||
| } | |||
| /** | |||
| * @brief Check if MPU is enabled or not | |||
| * @rmtoll MPU_CTRL ENABLE LL_MPU_IsEnabled | |||
| * @retval State of bit (1 or 0). | |||
| */ | |||
| __STATIC_INLINE uint32_t LL_MPU_IsEnabled(void) | |||
| { | |||
| return ((READ_BIT(MPU->CTRL, MPU_CTRL_ENABLE_Msk) == (MPU_CTRL_ENABLE_Msk)) ? 1UL : 0UL); | |||
| } | |||
| /** | |||
| * @brief Enable a MPU region | |||
| * @rmtoll MPU_RASR ENABLE LL_MPU_EnableRegion | |||
| * @param Region This parameter can be one of the following values: | |||
| * @arg @ref LL_MPU_REGION_NUMBER0 | |||
| * @arg @ref LL_MPU_REGION_NUMBER1 | |||
| * @arg @ref LL_MPU_REGION_NUMBER2 | |||
| * @arg @ref LL_MPU_REGION_NUMBER3 | |||
| * @arg @ref LL_MPU_REGION_NUMBER4 | |||
| * @arg @ref LL_MPU_REGION_NUMBER5 | |||
| * @arg @ref LL_MPU_REGION_NUMBER6 | |||
| * @arg @ref LL_MPU_REGION_NUMBER7 | |||
| * @arg @ref LL_MPU_REGION_NUMBER8 | |||
| * @arg @ref LL_MPU_REGION_NUMBER9 | |||
| * @arg @ref LL_MPU_REGION_NUMBER10 | |||
| * @arg @ref LL_MPU_REGION_NUMBER11 | |||
| * @arg @ref LL_MPU_REGION_NUMBER12 | |||
| * @arg @ref LL_MPU_REGION_NUMBER13 | |||
| * @arg @ref LL_MPU_REGION_NUMBER14 | |||
| * @arg @ref LL_MPU_REGION_NUMBER15 | |||
| * @note For cortex-M4 only 8 regions are available i.e only values from LL_MPU_REGION_NUMBER0 to LL_MPU_REGION_NUMBER7 are possible. | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_MPU_EnableRegion(uint32_t Region) | |||
| { | |||
| /* Set Region number */ | |||
| WRITE_REG(MPU->RNR, Region); | |||
| /* Enable the MPU region */ | |||
| SET_BIT(MPU->RASR, MPU_RASR_ENABLE_Msk); | |||
| } | |||
| /** | |||
| * @brief Configure and enable a region | |||
| * @rmtoll MPU_RNR REGION LL_MPU_ConfigRegion\n | |||
| * MPU_RBAR REGION LL_MPU_ConfigRegion\n | |||
| * MPU_RBAR ADDR LL_MPU_ConfigRegion\n | |||
| * MPU_RASR XN LL_MPU_ConfigRegion\n | |||
| * MPU_RASR AP LL_MPU_ConfigRegion\n | |||
| * MPU_RASR S LL_MPU_ConfigRegion\n | |||
| * MPU_RASR C LL_MPU_ConfigRegion\n | |||
| * MPU_RASR B LL_MPU_ConfigRegion\n | |||
| * MPU_RASR SIZE LL_MPU_ConfigRegion | |||
| * @param Region This parameter can be one of the following values: | |||
| * @arg @ref LL_MPU_REGION_NUMBER0 | |||
| * @arg @ref LL_MPU_REGION_NUMBER1 | |||
| * @arg @ref LL_MPU_REGION_NUMBER2 | |||
| * @arg @ref LL_MPU_REGION_NUMBER3 | |||
| * @arg @ref LL_MPU_REGION_NUMBER4 | |||
| * @arg @ref LL_MPU_REGION_NUMBER5 | |||
| * @arg @ref LL_MPU_REGION_NUMBER6 | |||
| * @arg @ref LL_MPU_REGION_NUMBER7 | |||
| * @arg @ref LL_MPU_REGION_NUMBER8 | |||
| * @arg @ref LL_MPU_REGION_NUMBER9 | |||
| * @arg @ref LL_MPU_REGION_NUMBER10 | |||
| * @arg @ref LL_MPU_REGION_NUMBER11 | |||
| * @arg @ref LL_MPU_REGION_NUMBER12 | |||
| * @arg @ref LL_MPU_REGION_NUMBER13 | |||
| * @arg @ref LL_MPU_REGION_NUMBER14 | |||
| * @arg @ref LL_MPU_REGION_NUMBER15 | |||
| * @param Address Value of region base address | |||
| * @param SubRegionDisable Sub-region disable value between Min_Data = 0x00 and Max_Data = 0xFF | |||
| * @param Attributes This parameter can be a combination of the following values: | |||
| * @arg @ref LL_MPU_REGION_SIZE_32B or @ref LL_MPU_REGION_SIZE_64B or @ref LL_MPU_REGION_SIZE_128B or @ref LL_MPU_REGION_SIZE_256B or @ref LL_MPU_REGION_SIZE_512B | |||
| * or @ref LL_MPU_REGION_SIZE_1KB or @ref LL_MPU_REGION_SIZE_2KB or @ref LL_MPU_REGION_SIZE_4KB or @ref LL_MPU_REGION_SIZE_8KB or @ref LL_MPU_REGION_SIZE_16KB | |||
| * or @ref LL_MPU_REGION_SIZE_32KB or @ref LL_MPU_REGION_SIZE_64KB or @ref LL_MPU_REGION_SIZE_128KB or @ref LL_MPU_REGION_SIZE_256KB or @ref LL_MPU_REGION_SIZE_512KB | |||
| * or @ref LL_MPU_REGION_SIZE_1MB or @ref LL_MPU_REGION_SIZE_2MB or @ref LL_MPU_REGION_SIZE_4MB or @ref LL_MPU_REGION_SIZE_8MB or @ref LL_MPU_REGION_SIZE_16MB | |||
| * or @ref LL_MPU_REGION_SIZE_32MB or @ref LL_MPU_REGION_SIZE_64MB or @ref LL_MPU_REGION_SIZE_128MB or @ref LL_MPU_REGION_SIZE_256MB or @ref LL_MPU_REGION_SIZE_512MB | |||
| * or @ref LL_MPU_REGION_SIZE_1GB or @ref LL_MPU_REGION_SIZE_2GB or @ref LL_MPU_REGION_SIZE_4GB | |||
| * @arg @ref LL_MPU_REGION_NO_ACCESS or @ref LL_MPU_REGION_PRIV_RW or @ref LL_MPU_REGION_PRIV_RW_URO or @ref LL_MPU_REGION_FULL_ACCESS | |||
| * or @ref LL_MPU_REGION_PRIV_RO or @ref LL_MPU_REGION_PRIV_RO_URO | |||
| * @arg @ref LL_MPU_TEX_LEVEL0 or @ref LL_MPU_TEX_LEVEL1 or @ref LL_MPU_TEX_LEVEL2 or @ref LL_MPU_TEX_LEVEL4 | |||
| * @arg @ref LL_MPU_INSTRUCTION_ACCESS_ENABLE or @ref LL_MPU_INSTRUCTION_ACCESS_DISABLE | |||
| * @arg @ref LL_MPU_ACCESS_SHAREABLE or @ref LL_MPU_ACCESS_NOT_SHAREABLE | |||
| * @arg @ref LL_MPU_ACCESS_CACHEABLE or @ref LL_MPU_ACCESS_NOT_CACHEABLE | |||
| * @arg @ref LL_MPU_ACCESS_BUFFERABLE or @ref LL_MPU_ACCESS_NOT_BUFFERABLE | |||
| * @note For cortex-M4 only 8 regions are available i.e only values from LL_MPU_REGION_NUMBER0 to LL_MPU_REGION_NUMBER7 are possible. | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_MPU_ConfigRegion(uint32_t Region, uint32_t SubRegionDisable, uint32_t Address, uint32_t Attributes) | |||
| { | |||
| /* Set Region number */ | |||
| WRITE_REG(MPU->RNR, Region); | |||
| /* Set base address */ | |||
| WRITE_REG(MPU->RBAR, (Address & 0xFFFFFFE0U)); | |||
| /* Configure MPU */ | |||
| WRITE_REG(MPU->RASR, (MPU_RASR_ENABLE_Msk | Attributes | (SubRegionDisable << MPU_RASR_SRD_Pos))); | |||
| } | |||
| /** | |||
| * @brief Disable a region | |||
| * @rmtoll MPU_RNR REGION LL_MPU_DisableRegion\n | |||
| * MPU_RASR ENABLE LL_MPU_DisableRegion | |||
| * @param Region This parameter can be one of the following values: | |||
| * @arg @ref LL_MPU_REGION_NUMBER0 | |||
| * @arg @ref LL_MPU_REGION_NUMBER1 | |||
| * @arg @ref LL_MPU_REGION_NUMBER2 | |||
| * @arg @ref LL_MPU_REGION_NUMBER3 | |||
| * @arg @ref LL_MPU_REGION_NUMBER4 | |||
| * @arg @ref LL_MPU_REGION_NUMBER5 | |||
| * @arg @ref LL_MPU_REGION_NUMBER6 | |||
| * @arg @ref LL_MPU_REGION_NUMBER7 | |||
| * @arg @ref LL_MPU_REGION_NUMBER8 | |||
| * @arg @ref LL_MPU_REGION_NUMBER9 | |||
| * @arg @ref LL_MPU_REGION_NUMBER10 | |||
| * @arg @ref LL_MPU_REGION_NUMBER11 | |||
| * @arg @ref LL_MPU_REGION_NUMBER12 | |||
| * @arg @ref LL_MPU_REGION_NUMBER13 | |||
| * @arg @ref LL_MPU_REGION_NUMBER14 | |||
| * @arg @ref LL_MPU_REGION_NUMBER15 | |||
| * @note For cortex-M4 only 8 regions are available i.e only values from LL_MPU_REGION_NUMBER0 to LL_MPU_REGION_NUMBER7 are possible. | |||
| * @retval None | |||
| */ | |||
| __STATIC_INLINE void LL_MPU_DisableRegion(uint32_t Region) | |||
| { | |||
| /* Set Region number */ | |||
| WRITE_REG(MPU->RNR, Region); | |||
| /* Disable the MPU region */ | |||
| CLEAR_BIT(MPU->RASR, MPU_RASR_ENABLE_Msk); | |||
| } | |||
| /** | |||
| * @} | |||
| */ | |||
| #endif /* __MPU_PRESENT */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| /** | |||
| * @} | |||
| */ | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif /* STM32H7xx_LL_CORTEX_H */ | |||
| /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | |||